cloud-provider: Log additional options

The 'NewCloudControllerManagerCommand' function create a cobra.Command
object that is used for the main entry point to various CCM
implementations. This function accepts an 'additionalFlags' parameter,
allowing users to register additional controller-specific options
beyond the standard set used for all controllers. While we were dumping
the standard set of flags in the usage string - seen when running the
command with '--help' or when parsing fails - we were not dumping the
additional options. Correct this oversight.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane 2023-09-08 11:44:43 +01:00
parent c084719291
commit 48f453d649

View File

@ -150,11 +150,13 @@ the cloud specific control loops shipped with Kubernetes.`,
cmd.SetUsageFunc(func(cmd *cobra.Command) error {
fmt.Fprintf(cmd.OutOrStderr(), usageFmt, cmd.UseLine())
cliflag.PrintSections(cmd.OutOrStderr(), namedFlagSets, cols)
cliflag.PrintSections(cmd.OutOrStderr(), additionalFlags, cols)
return nil
})
cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
fmt.Fprintf(cmd.OutOrStdout(), "%s\n\n"+usageFmt, cmd.Long, cmd.UseLine())
cliflag.PrintSections(cmd.OutOrStdout(), namedFlagSets, cols)
cliflag.PrintSections(cmd.OutOrStdout(), additionalFlags, cols)
})
return cmd