Skip to content

Commit

Permalink
clusterctl: Add 0 default to worker-machine-count help
Browse files Browse the repository at this point in the history
Cobra nicely adds the default value for arguments, except in the case
where the default is 0 or empty. This causes the help output for
`clusterctl generate cluster` `--worker-machine-count` to not include
its default of 0, unlike `--control-plane-machine-count` that has a
default of 1.

This change explicitly adds the default value to the help text for
`--worker-machine-count` to make it easier to discover what to expect
when running the command without this argument.

Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
  • Loading branch information
stmcginnis committed Feb 27, 2024
1 parent 219e438 commit 600f526
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/clusterctl/cmd/generate_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ func init() {
"The Kubernetes version to use for the workload cluster. If unspecified, the value from OS environment variables or the $XDG_CONFIG_HOME/cluster-api/clusterctl.yaml config file will be used.")
generateClusterClusterCmd.Flags().Int64Var(&gc.controlPlaneMachineCount, "control-plane-machine-count", 1,
"The number of control plane machines for the workload cluster.")
// Remove default from hard coded text if the default is ever changed from 0 since cobra would then add it
generateClusterClusterCmd.Flags().Int64Var(&gc.workerMachineCount, "worker-machine-count", 0,
"The number of worker machines for the workload cluster.")
"The number of worker machines for the workload cluster. (default 0)")

// flags for the repository source
generateClusterClusterCmd.Flags().StringVarP(&gc.infrastructureProvider, "infrastructure", "i", "",
Expand Down

0 comments on commit 600f526

Please sign in to comment.