Skip to content

Commit 98b52bf

Browse files
committed
Update OpenShift roles for networking.k8s.io
And fix some inconsistencies with the existing NetworkPolicy roles.
1 parent 892ae5d commit 98b52bf

File tree

3 files changed

+81
-3
lines changed

3 files changed

+81
-3
lines changed

pkg/cmd/server/bootstrappolicy/policy.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ func GetOpenshiftBootstrapClusterRoles() []rbac.ClusterRole {
279279
rbac.NewRule(readWrite...).Groups(batchGroup).Resources("jobs", "cronjobs").RuleOrDie(),
280280

281281
rbac.NewRule(readWrite...).Groups(appsGroup, extensionsGroup).Resources("replicationcontrollers/scale",
282-
"replicasets", "replicasets/scale", "deployments", "deployments/scale", "deployments/rollback", "networkpolicies").RuleOrDie(),
282+
"replicasets", "replicasets/scale", "deployments", "deployments/scale", "deployments/rollback").RuleOrDie(),
283283
rbac.NewRule(read...).Groups(appsGroup, extensionsGroup).Resources("daemonsets").RuleOrDie(),
284284

285285
rbac.NewRule(readWrite...).Groups(appsGroup).Resources("statefulsets", "deployments", "deployments/scale", "deployments/status").RuleOrDie(),
@@ -322,6 +322,8 @@ func GetOpenshiftBootstrapClusterRoles() []rbac.ClusterRole {
322322

323323
rbac.NewRule(readWrite...).Groups(templateGroup, legacyTemplateGroup).Resources("templates", "templateconfigs", "processedtemplates", "templateinstances").RuleOrDie(),
324324

325+
rbac.NewRule(readWrite...).Groups(extensionsGroup, networkingGroup).Resources("networkpolicies").RuleOrDie(),
326+
325327
// backwards compatibility
326328
rbac.NewRule(readWrite...).Groups(buildGroup, legacyBuildGroup).Resources("buildlogs").RuleOrDie(),
327329
rbac.NewRule(read...).Groups(kapiGroup).Resources("resourcequotausages").RuleOrDie(),
@@ -381,6 +383,8 @@ func GetOpenshiftBootstrapClusterRoles() []rbac.ClusterRole {
381383

382384
rbac.NewRule(readWrite...).Groups(templateGroup, legacyTemplateGroup).Resources("templates", "templateconfigs", "processedtemplates", "templateinstances").RuleOrDie(),
383385

386+
rbac.NewRule(readWrite...).Groups(extensionsGroup, networkingGroup).Resources("networkpolicies").RuleOrDie(),
387+
384388
// backwards compatibility
385389
rbac.NewRule(readWrite...).Groups(buildGroup, legacyBuildGroup).Resources("buildlogs").RuleOrDie(),
386390
rbac.NewRule(read...).Groups(kapiGroup).Resources("resourcequotausages").RuleOrDie(),
@@ -720,6 +724,7 @@ func GetOpenshiftBootstrapClusterRoles() []rbac.ClusterRole {
720724
rbac.NewRule(read...).Groups(networkGroup, legacyNetworkGroup).Resources("egressnetworkpolicies", "hostsubnets", "netnamespaces").RuleOrDie(),
721725
rbac.NewRule(read...).Groups(kapiGroup).Resources("nodes", "namespaces").RuleOrDie(),
722726
rbac.NewRule(read...).Groups(extensionsGroup).Resources("networkpolicies").RuleOrDie(),
727+
rbac.NewRule(read...).Groups(networkingGroup).Resources("networkpolicies").RuleOrDie(),
723728
rbac.NewRule("get").Groups(networkGroup, legacyNetworkGroup).Resources("clusternetworks").RuleOrDie(),
724729
},
725730
},

test/testdata/bootstrappolicy/bootstrap_cluster_roles.yaml

+36-1
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,6 @@ items:
703703
- deployments
704704
- deployments/rollback
705705
- deployments/scale
706-
- networkpolicies
707706
- replicasets
708707
- replicasets/scale
709708
- replicationcontrollers/scale
@@ -1001,6 +1000,20 @@ items:
10011000
- patch
10021001
- update
10031002
- watch
1003+
- apiGroups:
1004+
- extensions
1005+
- networking.k8s.io
1006+
resources:
1007+
- networkpolicies
1008+
verbs:
1009+
- create
1010+
- delete
1011+
- deletecollection
1012+
- get
1013+
- list
1014+
- patch
1015+
- update
1016+
- watch
10041017
- apiGroups:
10051018
- ""
10061019
- build.openshift.io
@@ -1360,6 +1373,20 @@ items:
13601373
- patch
13611374
- update
13621375
- watch
1376+
- apiGroups:
1377+
- extensions
1378+
- networking.k8s.io
1379+
resources:
1380+
- networkpolicies
1381+
verbs:
1382+
- create
1383+
- delete
1384+
- deletecollection
1385+
- get
1386+
- list
1387+
- patch
1388+
- update
1389+
- watch
13631390
- apiGroups:
13641391
- ""
13651392
- build.openshift.io
@@ -2362,6 +2389,14 @@ items:
23622389
- get
23632390
- list
23642391
- watch
2392+
- apiGroups:
2393+
- networking.k8s.io
2394+
resources:
2395+
- networkpolicies
2396+
verbs:
2397+
- get
2398+
- list
2399+
- watch
23652400
- apiGroups:
23662401
- ""
23672402
- network.openshift.io

test/testdata/bootstrappolicy/bootstrap_policy_file.yaml

+39-1
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,6 @@ items:
765765
- deployments
766766
- deployments/rollback
767767
- deployments/scale
768-
- networkpolicies
769768
- replicasets
770769
- replicasets/scale
771770
- replicationcontrollers/scale
@@ -1090,6 +1089,21 @@ items:
10901089
- patch
10911090
- update
10921091
- watch
1092+
- apiGroups:
1093+
- extensions
1094+
- networking.k8s.io
1095+
attributeRestrictions: null
1096+
resources:
1097+
- networkpolicies
1098+
verbs:
1099+
- create
1100+
- delete
1101+
- deletecollection
1102+
- get
1103+
- list
1104+
- patch
1105+
- update
1106+
- watch
10931107
- apiGroups:
10941108
- ""
10951109
- build.openshift.io
@@ -1479,6 +1493,21 @@ items:
14791493
- patch
14801494
- update
14811495
- watch
1496+
- apiGroups:
1497+
- extensions
1498+
- networking.k8s.io
1499+
attributeRestrictions: null
1500+
resources:
1501+
- networkpolicies
1502+
verbs:
1503+
- create
1504+
- delete
1505+
- deletecollection
1506+
- get
1507+
- list
1508+
- patch
1509+
- update
1510+
- watch
14821511
- apiGroups:
14831512
- ""
14841513
- build.openshift.io
@@ -2585,6 +2614,15 @@ items:
25852614
- get
25862615
- list
25872616
- watch
2617+
- apiGroups:
2618+
- networking.k8s.io
2619+
attributeRestrictions: null
2620+
resources:
2621+
- networkpolicies
2622+
verbs:
2623+
- get
2624+
- list
2625+
- watch
25882626
- apiGroups:
25892627
- ""
25902628
- network.openshift.io

0 commit comments

Comments
 (0)