Add label selector for plugin

This commit is contained in:
aca 2020-02-15 13:19:05 +09:00
parent 010563df2e
commit b096bf9ad9
9 changed files with 86 additions and 33 deletions

View file

@ -120,6 +120,13 @@ func AddDeploymentFlag(cmd *cobra.Command) *string {
return &v
}
// AddSelectorFlag adds a --selector flag to a cobra command
func AddSelectorFlag(cmd *cobra.Command) *string {
v := ""
cmd.Flags().StringVarP(&v, "selector", "l", "", "Selector (label query) of the ingress-nginx pod")
return &v
}
// GetNamespace takes a set of kubectl flag values and returns the namespace we should be operating in
func GetNamespace(flags *genericclioptions.ConfigFlags) string {
namespace, _, err := flags.ToRawKubeConfigLoader().Namespace()