From 61e53998e5b15fd8d11f3f4ade6af1d8cb585335 Mon Sep 17 00:00:00 2001 From: xilabao Date: Wed, 26 Apr 2017 17:55:16 +0800 Subject: [PATCH] ResourceName could possibly contain a comma should use StringArray, not StringSlice --- pkg/kubectl/cmd/create_clusterrole.go | 4 ++-- pkg/kubectl/cmd/create_role.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/kubectl/cmd/create_clusterrole.go b/pkg/kubectl/cmd/create_clusterrole.go index 63c553c453b..a4b27cd4a88 100644 --- a/pkg/kubectl/cmd/create_clusterrole.go +++ b/pkg/kubectl/cmd/create_clusterrole.go @@ -36,7 +36,7 @@ var ( kubectl create clusterrole pod-reader --verb=get,list,watch --resource=pods # Create a ClusterRole named "pod-reader" with ResourceName specified - kubectl create clusterrole pod-reader --verb=get,list,watch --resource=pods --resource-name=readablepod + kubectl create clusterrole pod-reader --verb=get,list,watch --resource=pods --resource-name=readablepod --resource-name=anotherpod # Create a ClusterRole named "foo" with API Group specified kubectl create clusterrole foo --verb=get,list,watch --resource=rs.extensions @@ -73,7 +73,7 @@ func NewCmdCreateClusterRole(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command cmdutil.AddDryRunFlag(cmd) cmd.Flags().StringSliceVar(&c.Verbs, "verb", []string{}, "verb that applies to the resources contained in the rule") cmd.Flags().StringSlice("resource", []string{}, "resource that the rule applies to") - cmd.Flags().StringSliceVar(&c.ResourceNames, "resource-name", []string{}, "resource in the white list that the rule applies to") + cmd.Flags().StringArrayVar(&c.ResourceNames, "resource-name", []string{}, "resource in the white list that the rule applies to, repeat this flag for multiple items") return cmd } diff --git a/pkg/kubectl/cmd/create_role.go b/pkg/kubectl/cmd/create_role.go index 151122c98fc..a890b33d828 100644 --- a/pkg/kubectl/cmd/create_role.go +++ b/pkg/kubectl/cmd/create_role.go @@ -43,7 +43,7 @@ var ( kubectl create role pod-reader --verb=get --verb=list --verb=watch --resource=pods # Create a Role named "pod-reader" with ResourceName specified - kubectl create role pod-reader --verb=get --verb=list --verb=watch --resource=pods --resource-name=readablepod + kubectl create role pod-reader --verb=get,list,watch --resource=pods --resource-name=readablepod --resource-name=anotherpod # Create a Role named "foo" with API Group specified kubectl create role foo --verb=get,list,watch --resource=rs.extensions @@ -98,7 +98,7 @@ func NewCmdCreateRole(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command { cmdutil.AddDryRunFlag(cmd) cmd.Flags().StringSliceVar(&c.Verbs, "verb", []string{}, "verb that applies to the resources contained in the rule") cmd.Flags().StringSlice("resource", []string{}, "resource that the rule applies to") - cmd.Flags().StringSliceVar(&c.ResourceNames, "resource-name", []string{}, "resource in the white list that the rule applies to") + cmd.Flags().StringArrayVar(&c.ResourceNames, "resource-name", []string{}, "resource in the white list that the rule applies to, repeat this flag for multiple items") return cmd }