mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 08:17:26 +00:00
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:
commit
c289286647
@ -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) {
|
|||||||
},
|
},
|
||||||
"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"},
|
||||||
|
Loading…
Reference in New Issue
Block a user