Skip to content

Commit eeaf7bc

Browse files
committed
Fix deployment related SA's permissions
1 parent 3ace21a commit eeaf7bc

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

pkg/cmd/server/bootstrappolicy/controller_policy.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ func init() {
6464
ObjectMeta: metav1.ObjectMeta{Name: saRolePrefix + InfraDeployerControllerServiceAccountName},
6565
Rules: []rbac.PolicyRule{
6666
rbac.NewRule("create", "get", "list", "watch", "patch", "delete").Groups(kapiGroup).Resources("pods").RuleOrDie(),
67+
68+
// "delete" is required here for compatibility with older deployer images
69+
// (see https://github.com/openshift/origin/pull/14322#issuecomment-303968976)
70+
// TODO: remove "delete" rule few releases after 3.6
71+
rbac.NewRule("delete").Groups(kapiGroup).Resources("replicationcontrollers").RuleOrDie(),
6772
rbac.NewRule("get", "list", "watch", "update").Groups(kapiGroup).Resources("replicationcontrollers").RuleOrDie(),
6873
eventsRule(),
6974
},
@@ -73,7 +78,7 @@ func init() {
7378
addControllerRole(rbac.ClusterRole{
7479
ObjectMeta: metav1.ObjectMeta{Name: saRolePrefix + InfraDeploymentConfigControllerServiceAccountName},
7580
Rules: []rbac.PolicyRule{
76-
rbac.NewRule("create", "get", "list", "watch", "update", "delete").Groups(kapiGroup).Resources("replicationcontrollers").RuleOrDie(),
81+
rbac.NewRule("create", "get", "list", "watch", "update", "patch", "delete").Groups(kapiGroup).Resources("replicationcontrollers").RuleOrDie(),
7782
rbac.NewRule("update").Groups(deployGroup, legacyDeployGroup).Resources("deploymentconfigs/status").RuleOrDie(),
7883
rbac.NewRule("get", "list", "watch").Groups(deployGroup, legacyDeployGroup).Resources("deploymentconfigs").RuleOrDie(),
7984
eventsRule(),

pkg/cmd/server/bootstrappolicy/policy.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,10 @@ func GetOpenshiftBootstrapClusterRoles() []authorizationapi.ClusterRole {
631631
},
632632
},
633633
Rules: []authorizationapi.PolicyRule{
634+
// "delete" is required here for compatibility with older deployer images
635+
// (see https://github.com/openshift/origin/pull/14322#issuecomment-303968976)
636+
// TODO: remove "delete" rule few releases after 3.6
637+
authorizationapi.NewRule("delete").Groups(kapiGroup).Resources("replicationcontrollers").RuleOrDie(),
634638
authorizationapi.NewRule("get", "list", "watch", "update").Groups(kapiGroup).Resources("replicationcontrollers").RuleOrDie(),
635639
authorizationapi.NewRule("get", "list", "watch", "create").Groups(kapiGroup).Resources("pods").RuleOrDie(),
636640
authorizationapi.NewRule("get").Groups(kapiGroup).Resources("pods/log").RuleOrDie(),

test/testdata/bootstrappolicy/bootstrap_cluster_roles.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1968,6 +1968,13 @@ items:
19681968
creationTimestamp: null
19691969
name: system:deployer
19701970
rules:
1971+
- apiGroups:
1972+
- ""
1973+
attributeRestrictions: null
1974+
resources:
1975+
- replicationcontrollers
1976+
verbs:
1977+
- delete
19711978
- apiGroups:
19721979
- ""
19731980
attributeRestrictions: null
@@ -3617,6 +3624,13 @@ items:
36173624
- list
36183625
- patch
36193626
- watch
3627+
- apiGroups:
3628+
- ""
3629+
attributeRestrictions: null
3630+
resources:
3631+
- replicationcontrollers
3632+
verbs:
3633+
- delete
36203634
- apiGroups:
36213635
- ""
36223636
attributeRestrictions: null
@@ -3654,6 +3668,7 @@ items:
36543668
- delete
36553669
- get
36563670
- list
3671+
- patch
36573672
- update
36583673
- watch
36593674
- apiGroups:

0 commit comments

Comments
 (0)