You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
exit.Message(reason.Usage, `Target <remote file path> must be an absolute Path. Relative Path is not allowed (example: "minikube:/home/docker/copied.txt")`)
Copy file name to clipboardExpand all lines: cmd/minikube/cmd/node_add.go
+28-16
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,7 @@ package cmd
19
19
import (
20
20
"github.com/spf13/cobra"
21
21
"github.com/spf13/viper"
22
+
22
23
"k8s.io/minikube/pkg/minikube/cni"
23
24
"k8s.io/minikube/pkg/minikube/config"
24
25
"k8s.io/minikube/pkg/minikube/driver"
@@ -32,8 +33,9 @@ import (
32
33
)
33
34
34
35
var (
35
-
cpbool
36
-
workerbool
36
+
cpNodebool
37
+
workerNodebool
38
+
deleteNodeOnFailurebool
37
39
)
38
40
39
41
varnodeAddCmd=&cobra.Command{
@@ -48,20 +50,31 @@ var nodeAddCmd = &cobra.Command{
48
50
out.FailureT("none driver does not support multi-node clusters")
49
51
}
50
52
51
-
name:=node.Name(len(cc.Nodes) +1)
53
+
ifcpNode&&!config.HA(*cc) {
54
+
out.FailureT("Adding a control-plane node to a non-HA cluster is not currently supported. Please first delete the cluster and use 'minikube start --ha' to create new one.")
55
+
}
56
+
57
+
roles:= []string{}
58
+
ifworkerNode {
59
+
roles=append(roles, "worker")
60
+
}
61
+
ifcpNode {
62
+
roles=append(roles, "control-plane")
63
+
}
52
64
53
-
// for now control-plane feature is not supported
54
-
ifcp {
55
-
out.Step(style.Unsupported, "Adding a control-plane node is not yet supported, setting control-plane flag to false")
56
-
cp=false
65
+
// calculate appropriate new node name with id following the last existing one
@@ -77,7 +90,7 @@ var nodeAddCmd = &cobra.Command{
77
90
}
78
91
79
92
register.Reg.SetStep(register.InitialSetup)
80
-
iferr:=node.Add(cc, n, false); err!=nil {
93
+
iferr:=node.Add(cc, n, deleteNodeOnFailure); err!=nil {
81
94
_, err:=maybeDeleteAndRetry(cmd, *cc, n, nil, err)
82
95
iferr!=nil {
83
96
exit.Error(reason.GuestNodeAdd, "failed to add node", err)
@@ -93,10 +106,9 @@ var nodeAddCmd = &cobra.Command{
93
106
}
94
107
95
108
funcinit() {
96
-
// TODO(https://github.com/kubernetes/minikube/issues/7366): We should figure out which minikube start flags to actually import
97
-
nodeAddCmd.Flags().BoolVar(&cp, "control-plane", false, "This flag is currently unsupported.")
98
-
nodeAddCmd.Flags().BoolVar(&worker, "worker", true, "If true, the added node will be marked for work. Defaults to true.")
99
-
nodeAddCmd.Flags().Bool(deleteOnFailure, false, "If set, delete the current cluster if start fails and try again. Defaults to false.")
109
+
nodeAddCmd.Flags().BoolVar(&cpNode, "control-plane", false, "If set, added node will become a control-plane. Defaults to false. Currently only supported for existing HA clusters.")
110
+
nodeAddCmd.Flags().BoolVar(&workerNode, "worker", true, "If set, added node will be available as worker. Defaults to true.")
111
+
nodeAddCmd.Flags().BoolVar(&deleteNodeOnFailure, "delete-on-failure", false, "If set, delete the current cluster if start fails and try again. Defaults to false.")
0 commit comments