add "bind" and "impersonate" to legal verbs

"bind" and "impersonate" are also legal verbs according this:
https://github.com/kubernetes/kubernetes.github.io/pull/2771/files
This commit is contained in:
Cao Shufeng 2017-03-07 03:00:39 -05:00
parent 357af07718
commit 877bf54465
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"},