Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: node create --k3s-arg flag #1032

Merged
merged 1 commit into from
Mar 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions cmd/node/nodeCreate.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ func NewCmdNodeCreate() *cobra.Command {

cmd.Flags().StringVarP(&createNodeOpts.ClusterToken, "token", "t", "", "Override cluster token (required when connecting to an external cluster)")

cmd.Flags().StringArray("k3s-arg", nil, "Additional args passed to k3d command")

// done
return cmd
}
Expand Down Expand Up @@ -180,6 +182,12 @@ func parseCreateNodeCmd(cmd *cobra.Command, args []string) ([]*k3d.Node, string)
l.Log().Fatalf("failed to get --network string slice flag: %v", err)
}

// --k3s-arg
k3sArgs, err := cmd.Flags().GetStringArray("k3s-arg")
if err != nil {
l.Log().Fatalf("failed to get --k3s-arg string array flag: %v", err)
}

// generate list of nodes
nodes := []*k3d.Node{}
for i := 0; i < replicas; i++ {
Expand All @@ -192,6 +200,7 @@ func parseCreateNodeCmd(cmd *cobra.Command, args []string) ([]*k3d.Node, string)
Restart: true,
Memory: memory,
Networks: networks,
Args: k3sArgs,
}
nodes = append(nodes, node)
}
Expand Down