Commit c2892866 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #42612 from CaoShuFeng/create_role_trival

Automatic merge from submit-queue add "bind" to validResourceVerbs in "create role" cli "bind" and "impersonate" are also a legal verbs according this: https://github.com/kubernetes/kubernetes.github.io/pull/2771/files **Release note**: ```NONE ```
parents e0ba40b6 877bf544
...@@ -43,10 +43,10 @@ var ( ...@@ -43,10 +43,10 @@ var (
kubectl create role pod-reader --verb=get --verb=list --verb=watch --resource=pods kubectl create role pod-reader --verb=get --verb=list --verb=watch --resource=pods
# Create a Role named "pod-reader" with ResourceName specified # Create a Role named "pod-reader" with ResourceName specified
kubectl create role pod-reader --verb=get --verg=list --verb=watch --resource=pods --resource-name=readablepod`)) kubectl create role pod-reader --verb=get --verb=list --verb=watch --resource=pods --resource-name=readablepod`))
// Valid resource verb list for validation. // Valid resource verb list for validation.
validResourceVerbs = []string{"*", "get", "delete", "list", "create", "update", "patch", "watch", "proxy", "redirect", "deletecollection", "use"} validResourceVerbs = []string{"*", "get", "delete", "list", "create", "update", "patch", "watch", "proxy", "redirect", "deletecollection", "use", "bind", "impersonate"}
) )
type CreateRoleOptions struct { type CreateRoleOptions struct {
......
...@@ -203,11 +203,12 @@ func TestValidate(t *testing.T) { ...@@ -203,11 +203,12 @@ func TestValidate(t *testing.T) {
}, },
"test-valid-case": { "test-valid-case": {
roleOptions: &CreateRoleOptions{ roleOptions: &CreateRoleOptions{
Name: "my-role", Name: "role-binder",
Verbs: []string{"get", "list"}, Verbs: []string{"get", "list", "bind"},
Resources: []schema.GroupVersionResource{ Resources: []schema.GroupVersionResource{
{ {
Resource: "pods", Resource: "roles",
Group: "rbac.authorization.k8s.io",
}, },
}, },
ResourceNames: []string{"foo"}, ResourceNames: []string{"foo"},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment