moving packages around
parent
ae8309f1e1
commit
593d3fc73e
|
@ -1,36 +0,0 @@
|
|||
/*
|
||||
Copyright 2020 The Kubernetes Authors All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package config
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var name string
|
||||
|
||||
var nodeAddCmd = &cobra.Command{
|
||||
Use: "add",
|
||||
Short: "Adds a node to the given cluster.",
|
||||
Long: "Adds a node to the given cluster config, without starting it.",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
Copyright 2020 The Kubernetes Authors All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package config
|
||||
|
||||
import "github.com/spf13/cobra"
|
||||
|
||||
var nodeDeleteCmd = &cobra.Command{
|
||||
Use: "delete",
|
||||
Short: "Deletes a node from a cluster.",
|
||||
Long: "Deletes a node from a cluster.",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
Copyright 2020 The Kubernetes Authors All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package config
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"k8s.io/minikube/pkg/minikube/exit"
|
||||
)
|
||||
|
||||
var NodeCmd = &cobra.Command{
|
||||
Use: "node",
|
||||
Short: "Node operations",
|
||||
Long: "Operations on nodes",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
exit.UsageT("Usage: minikube node [add|start|stop|delete]")
|
||||
},
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
Copyright 2020 The Kubernetes Authors All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package config
|
||||
|
||||
import "github.com/spf13/cobra"
|
||||
|
||||
var nodeStartCmd = &cobra.Command{
|
||||
Use: "start",
|
||||
Short: "Starts a node.",
|
||||
Long: "Starts a node.",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
Copyright 2020 The Kubernetes Authors All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package config
|
||||
|
||||
import "github.com/spf13/cobra"
|
||||
|
||||
var nodeStopCmd = &cobra.Command{
|
||||
Use: "delete",
|
||||
Short: "Stops a node in a cluster.",
|
||||
Long: "Stops a node in a cluster.",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
Copyright 2019 The Kubernetes Authors All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package cluster
|
||||
|
||||
import "k8s.io/minikube/pkg/minikube/config"
|
||||
|
||||
// AddNode adds a new node config to a cluster.
|
||||
func AddNode(cfg config.MachineConfig, name string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// StartNode starts the given node
|
||||
func StartNode(node config.Node) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// StopNode stops the given node
|
||||
func StopNode(node config.Node) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeleteNode deletes the given node from the given cluster
|
||||
func DeleteNode(cfg config.MachineConfig, node config.Node) error {
|
||||
return nil
|
||||
}
|
|
@ -19,6 +19,8 @@ package node
|
|||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/spf13/viper"
|
||||
"k8s.io/minikube/pkg/minikube/config"
|
||||
)
|
||||
|
||||
|
@ -43,10 +45,12 @@ func Add(cc *config.MachineConfig, name string, controlPlane bool, k8sVersion st
|
|||
|
||||
// Delete stops and deletes the given node from the given cluster
|
||||
func Delete(cc *config.MachineConfig, name string) error {
|
||||
nd := nil
|
||||
for _, n := range cc.Nodes {
|
||||
var nd *config.Node
|
||||
index := 0
|
||||
for i, n := range cc.Nodes {
|
||||
if n.Name == name {
|
||||
nd = n
|
||||
nd = &n
|
||||
index = i
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -54,8 +58,25 @@ func Delete(cc *config.MachineConfig, name string) error {
|
|||
if nd == nil {
|
||||
return errors.New("Could not find node " + name)
|
||||
}
|
||||
|
||||
err := Stop(cc, name)
|
||||
if err != nil {
|
||||
glog.Warningf("Failed to stop node %s. Will still try to delete.", name)
|
||||
}
|
||||
|
||||
// Spin down the machine, eventually.
|
||||
|
||||
cc.Nodes = append(cc.Nodes[:index], cc.Nodes[index+1:]...)
|
||||
return config.SaveProfile(viper.GetString(config.MachineProfile), cc)
|
||||
}
|
||||
|
||||
// Stop stops the node in the given cluster
|
||||
func Stop(cc *config.MachineConfig, name string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Start spins up a guest and starts the kubernetes node.
|
||||
func Start(cc *config.MachineConfig, name string) error {
|
||||
// Throw all the slop from cmd.start in here
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue