diff --git a/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/policy.go b/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/policy.go index 79e643257a9..1e3b75cd68b 100644 --- a/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/policy.go +++ b/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/policy.go @@ -146,6 +146,9 @@ func viewRules() []rbacv1.PolicyRule { if utilfeature.DefaultFeatureGate.Enabled(features.DynamicResourceAllocation) { rules = append(rules, rbacv1helpers.NewRule(Read...).Groups(resourceGroup).Resources("resourceclaims", "resourceclaims/status", "resourceclaimtemplates").RuleOrDie()) } + if utilfeature.DefaultFeatureGate.Enabled(features.GenericWorkload) { + rules = append(rules, rbacv1helpers.NewRule(Read...).Groups(schedulingGroup).Resources("workloads").RuleOrDie()) + } return rules } @@ -187,6 +190,9 @@ func editRules() []rbacv1.PolicyRule { if utilfeature.DefaultFeatureGate.Enabled(features.DynamicResourceAllocation) { rules = append(rules, rbacv1helpers.NewRule(Write...).Groups(resourceGroup).Resources("resourceclaims", "resourceclaimtemplates").RuleOrDie()) } + if utilfeature.DefaultFeatureGate.Enabled(features.GenericWorkload) { + rules = append(rules, rbacv1helpers.NewRule(Write...).Groups(schedulingGroup).Resources("workloads").RuleOrDie()) + } return rules } diff --git a/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles-featuregates.yaml b/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles-featuregates.yaml index 3365e89836e..31d6a31bc30 100644 --- a/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles-featuregates.yaml +++ b/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles-featuregates.yaml @@ -260,6 +260,16 @@ items: - deletecollection - patch - update + - apiGroups: + - scheduling.k8s.io + resources: + - workloads + verbs: + - create + - delete + - deletecollection + - patch + - update - apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: @@ -414,6 +424,14 @@ items: - get - list - watch + - apiGroups: + - scheduling.k8s.io + resources: + - workloads + verbs: + - get + - list + - watch - apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: