mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Merge pull request #48267 from superbrothers/clusterrole-flag-completion
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Support completions for --clusterrole of kubectl create clusterrolebinding **What this PR does / why we need it**: This PR supports completion for --clusterrole of kubectl create clusterrolebinding. ``` $ kubectl create clusterrolebinding hoge --clusterrole <tab> admin system:controller:daemon-set-controller system:controller:node-controller system:controller:service-controller system:kube-scheduler cluster-admin system:controller:deployment-controller system:controller:persistent-volume-binder system:controller:statefulset-controller system:node edit system:controller:disruption-controller system:controller:pod-garbage-collector system:controller:ttl-controller system:node-bootstrapper system:auth-delegator system:controller:endpoint-controller system:controller:replicaset-controller system:discovery system:node-problem-detector system:basic-user system:controller:generic-garbage-collector system:controller:replication-controller system:heapster system:node-proxier system:controller:attachdetach-controller system:controller:horizontal-pod-autoscaler system:controller:resourcequota-controller system:kube-aggregator system:persistent-volume-provisioner system:controller:certificate-controller system:controller:job-controller system:controller:route-controller system:kube-controller-manager view system:controller:cronjob-controller system:controller:namespace-controller system:controller:service-account-controller system:kube-dns ``` **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # **Special notes for your reviewer**: I feel that it is better to except system clusterroles from completion candidates. What do you think about it? **Release note**: ```release-note Support completion for --clusterrole of kubectl create clusterrolebinding ```
This commit is contained in:
commit
551c4581c2
@ -130,6 +130,11 @@ __kubectl_get_resource_node()
|
||||
__kubectl_parse_get "node"
|
||||
}
|
||||
|
||||
__kubectl_get_resource_clusterrole()
|
||||
{
|
||||
__kubectl_parse_get "clusterrole"
|
||||
}
|
||||
|
||||
# $1 is the name of the pod we want to get the list of containers inside
|
||||
__kubectl_get_containers()
|
||||
{
|
||||
|
@ -53,6 +53,7 @@ func NewCmdCreateClusterRoleBinding(f cmdutil.Factory, cmdOut io.Writer) *cobra.
|
||||
cmdutil.AddPrinterFlags(cmd)
|
||||
cmdutil.AddGeneratorFlags(cmd, cmdutil.ClusterRoleBindingV1GeneratorName)
|
||||
cmd.Flags().String("clusterrole", "", i18n.T("ClusterRole this ClusterRoleBinding should reference"))
|
||||
cmd.MarkFlagCustom("clusterrole", "__kubectl_get_resource_clusterrole")
|
||||
cmd.Flags().StringArray("user", []string{}, "Usernames to bind to the role")
|
||||
cmd.Flags().StringArray("group", []string{}, "Groups to bind to the role")
|
||||
cmd.Flags().StringArray("serviceaccount", []string{}, "Service accounts to bind to the role, in the format <namespace>:<name>")
|
||||
|
Loading…
Reference in New Issue
Block a user