Skip to content

Commit

Permalink
add: node create --k3s-arg flag (#1032)
Browse files Browse the repository at this point in the history
  • Loading branch information
iwilltry42 authored Mar 26, 2022
1 parent ff2931b commit b1374e5
Showing 1 changed file with 9 additions and 0 deletions.
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

0 comments on commit b1374e5

Please sign in to comment.