Revert "add --node-label flag for node create command (#584, @developer-guy, @ejose, @dentrax)"
This reverts commit 5fe8a3c6c7
.
This commit is contained in:
parent
770aaa4913
commit
70872648b3
@ -23,7 +23,6 @@ package node
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
@ -74,8 +73,6 @@ func NewCmdNodeCreate() *cobra.Command {
|
|||||||
cmd.Flags().BoolVar(&createNodeOpts.Wait, "wait", false, "Wait for the node(s) to be ready before returning.")
|
cmd.Flags().BoolVar(&createNodeOpts.Wait, "wait", false, "Wait for the node(s) to be ready before returning.")
|
||||||
cmd.Flags().DurationVar(&createNodeOpts.Timeout, "timeout", 0*time.Second, "Maximum waiting time for '--wait' before canceling/returning.")
|
cmd.Flags().DurationVar(&createNodeOpts.Timeout, "timeout", 0*time.Second, "Maximum waiting time for '--wait' before canceling/returning.")
|
||||||
|
|
||||||
cmd.Flags().StringSliceP("k3s-node-label", "", []string{}, "Specify k3s node labels in format \"foo=bar\"")
|
|
||||||
|
|
||||||
// done
|
// done
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
@ -127,21 +124,6 @@ func parseCreateNodeCmd(cmd *cobra.Command, args []string) ([]*k3d.Node, *k3d.Cl
|
|||||||
log.Errorf("Provided memory limit value is invalid")
|
log.Errorf("Provided memory limit value is invalid")
|
||||||
}
|
}
|
||||||
|
|
||||||
k3sNodeLabelsFlag, err := cmd.Flags().GetStringSlice("k3s-node-label")
|
|
||||||
if err != nil {
|
|
||||||
log.Errorln("No node-label specified")
|
|
||||||
log.Fatalln(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
k3sNodeLabels := make(map[string]string, len(k3sNodeLabelsFlag))
|
|
||||||
for _, label := range k3sNodeLabelsFlag {
|
|
||||||
labelSplitted := strings.Split(label, "=")
|
|
||||||
if len(labelSplitted) != 2 {
|
|
||||||
log.Fatalf("unknown label format format: %s, use format \"foo=bar\"", label)
|
|
||||||
}
|
|
||||||
k3sNodeLabels[labelSplitted[0]] = labelSplitted[1]
|
|
||||||
}
|
|
||||||
|
|
||||||
// generate list of nodes
|
// generate list of nodes
|
||||||
nodes := []*k3d.Node{}
|
nodes := []*k3d.Node{}
|
||||||
for i := 0; i < replicas; i++ {
|
for i := 0; i < replicas; i++ {
|
||||||
@ -152,7 +134,6 @@ func parseCreateNodeCmd(cmd *cobra.Command, args []string) ([]*k3d.Node, *k3d.Cl
|
|||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
k3d.LabelRole: roleStr,
|
k3d.LabelRole: roleStr,
|
||||||
},
|
},
|
||||||
K3sNodeLabels: k3sNodeLabels,
|
|
||||||
Restart: true,
|
Restart: true,
|
||||||
Memory: memory,
|
Memory: memory,
|
||||||
}
|
}
|
||||||
|
@ -481,11 +481,6 @@ func patchAgentSpec(node *k3d.Node) error {
|
|||||||
if node.Cmd == nil {
|
if node.Cmd == nil {
|
||||||
node.Cmd = []string{"agent"}
|
node.Cmd = []string{"agent"}
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, v := range node.K3sNodeLabels {
|
|
||||||
node.Args = append(node.Args, "--node-label", fmt.Sprintf("%s=%s", k, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,7 +341,6 @@ type Node struct {
|
|||||||
Restart bool `yaml:"restart" json:"restart,omitempty"`
|
Restart bool `yaml:"restart" json:"restart,omitempty"`
|
||||||
Created string `yaml:"created" json:"created,omitempty"`
|
Created string `yaml:"created" json:"created,omitempty"`
|
||||||
Labels map[string]string // filled automatically
|
Labels map[string]string // filled automatically
|
||||||
K3sNodeLabels map[string]string `yaml:"k3sNodeLabels" json:"k3sNodeLabels,omitempty"`
|
|
||||||
Networks []string // filled automatically
|
Networks []string // filled automatically
|
||||||
ExtraHosts []string // filled automatically
|
ExtraHosts []string // filled automatically
|
||||||
ServerOpts ServerOpts `yaml:"serverOpts" json:"serverOpts,omitempty"`
|
ServerOpts ServerOpts `yaml:"serverOpts" json:"serverOpts,omitempty"`
|
||||||
|
Loading…
Reference in New Issue
Block a user