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
```
This commit is contained in:
Kubernetes Submit Queue 2017-04-22 12:18:00 -07:00 committed by GitHub
commit c289286647
2 changed files with 6 additions and 5 deletions

View File

@ -43,10 +43,10 @@ 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 --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.
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 {

View File

@ -203,11 +203,12 @@ func TestValidate(t *testing.T) {
},
"test-valid-case": {
roleOptions: &CreateRoleOptions{
Name: "my-role",
Verbs: []string{"get", "list"},
Name: "role-binder",
Verbs: []string{"get", "list", "bind"},
Resources: []schema.GroupVersionResource{
{
Resource: "pods",
Resource: "roles",
Group: "rbac.authorization.k8s.io",
},
},
ResourceNames: []string{"foo"},