mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
update pod RBAC roles to work against head
This commit is contained in:
parent
6421405d0e
commit
4aeb3f3ffe
@ -184,7 +184,7 @@ func ClusterRoles() []rbac.ClusterRole {
|
|||||||
// TODO: restrict to creating a node with the same name they announce
|
// TODO: restrict to creating a node with the same name they announce
|
||||||
rbac.NewRule("create", "get", "list", "watch").Groups(legacyGroup).Resources("nodes").RuleOrDie(),
|
rbac.NewRule("create", "get", "list", "watch").Groups(legacyGroup).Resources("nodes").RuleOrDie(),
|
||||||
// TODO: restrict to the bound node once supported
|
// TODO: restrict to the bound node once supported
|
||||||
rbac.NewRule("update").Groups(legacyGroup).Resources("nodes/status").RuleOrDie(),
|
rbac.NewRule("update", "patch").Groups(legacyGroup).Resources("nodes/status").RuleOrDie(),
|
||||||
|
|
||||||
// TODO: restrict to the bound node as creator once supported
|
// TODO: restrict to the bound node as creator once supported
|
||||||
rbac.NewRule("create", "update", "patch").Groups(legacyGroup).Resources("events").RuleOrDie(),
|
rbac.NewRule("create", "update", "patch").Groups(legacyGroup).Resources("events").RuleOrDie(),
|
||||||
|
@ -167,6 +167,22 @@ func TestBootstrapClusterRoles(t *testing.T) {
|
|||||||
testObjects(t, list, "cluster-roles.yaml")
|
testObjects(t, list, "cluster-roles.yaml")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestBootstrapClusterRoleBindings(t *testing.T) {
|
||||||
|
list := &api.List{}
|
||||||
|
names := sets.NewString()
|
||||||
|
roleBindings := map[string]runtime.Object{}
|
||||||
|
bootstrapRoleBindings := bootstrappolicy.ClusterRoleBindings()
|
||||||
|
for i := range bootstrapRoleBindings {
|
||||||
|
role := bootstrapRoleBindings[i]
|
||||||
|
names.Insert(role.Name)
|
||||||
|
roleBindings[role.Name] = &role
|
||||||
|
}
|
||||||
|
for _, name := range names.List() {
|
||||||
|
list.Items = append(list.Items, roleBindings[name])
|
||||||
|
}
|
||||||
|
testObjects(t, list, "cluster-role-bindings.yaml")
|
||||||
|
}
|
||||||
|
|
||||||
func TestBootstrapControllerRoles(t *testing.T) {
|
func TestBootstrapControllerRoles(t *testing.T) {
|
||||||
list := &api.List{}
|
list := &api.List{}
|
||||||
names := sets.NewString()
|
names := sets.NewString()
|
||||||
|
78
plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-role-bindings.yaml
vendored
Normal file
78
plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-role-bindings.yaml
vendored
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
items:
|
||||||
|
- apiVersion: rbac.authorization.k8s.io/v1alpha1
|
||||||
|
kind: ClusterRoleBinding
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
kubernetes.io/bootstrapping: rbac-defaults
|
||||||
|
name: cluster-admin
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: ClusterRole
|
||||||
|
name: cluster-admin
|
||||||
|
subjects:
|
||||||
|
- kind: Group
|
||||||
|
name: system:masters
|
||||||
|
- apiVersion: rbac.authorization.k8s.io/v1alpha1
|
||||||
|
kind: ClusterRoleBinding
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
kubernetes.io/bootstrapping: rbac-defaults
|
||||||
|
name: system:basic-user
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: ClusterRole
|
||||||
|
name: system:basic-user
|
||||||
|
subjects:
|
||||||
|
- kind: Group
|
||||||
|
name: system:authenticated
|
||||||
|
- kind: Group
|
||||||
|
name: system:unauthenticated
|
||||||
|
- apiVersion: rbac.authorization.k8s.io/v1alpha1
|
||||||
|
kind: ClusterRoleBinding
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
kubernetes.io/bootstrapping: rbac-defaults
|
||||||
|
name: system:discovery
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: ClusterRole
|
||||||
|
name: system:discovery
|
||||||
|
subjects:
|
||||||
|
- kind: Group
|
||||||
|
name: system:authenticated
|
||||||
|
- kind: Group
|
||||||
|
name: system:unauthenticated
|
||||||
|
- apiVersion: rbac.authorization.k8s.io/v1alpha1
|
||||||
|
kind: ClusterRoleBinding
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
kubernetes.io/bootstrapping: rbac-defaults
|
||||||
|
name: system:node
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: ClusterRole
|
||||||
|
name: system:node
|
||||||
|
subjects:
|
||||||
|
- kind: Group
|
||||||
|
name: system:nodes
|
||||||
|
- apiVersion: rbac.authorization.k8s.io/v1alpha1
|
||||||
|
kind: ClusterRoleBinding
|
||||||
|
metadata:
|
||||||
|
creationTimestamp: null
|
||||||
|
labels:
|
||||||
|
kubernetes.io/bootstrapping: rbac-defaults
|
||||||
|
name: system:node-proxier
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: ClusterRole
|
||||||
|
name: system:node-proxier
|
||||||
|
subjects:
|
||||||
|
- kind: Group
|
||||||
|
name: system:nodes
|
||||||
|
kind: List
|
||||||
|
metadata: {}
|
@ -436,6 +436,7 @@ items:
|
|||||||
resources:
|
resources:
|
||||||
- nodes/status
|
- nodes/status
|
||||||
verbs:
|
verbs:
|
||||||
|
- patch
|
||||||
- update
|
- update
|
||||||
- apiGroups:
|
- apiGroups:
|
||||||
- ""
|
- ""
|
||||||
|
Loading…
Reference in New Issue
Block a user