Skip to content

Commit

Permalink
Update OpenShift roles for networking.k8s.io
Browse files Browse the repository at this point in the history
And fix some inconsistencies with the existing NetworkPolicy roles.
  • Loading branch information
danwinship committed Dec 11, 2017
1 parent 892ae5d commit 98b52bf
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 3 deletions.
7 changes: 6 additions & 1 deletion pkg/cmd/server/bootstrappolicy/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ func GetOpenshiftBootstrapClusterRoles() []rbac.ClusterRole {
rbac.NewRule(readWrite...).Groups(batchGroup).Resources("jobs", "cronjobs").RuleOrDie(),

rbac.NewRule(readWrite...).Groups(appsGroup, extensionsGroup).Resources("replicationcontrollers/scale",
"replicasets", "replicasets/scale", "deployments", "deployments/scale", "deployments/rollback", "networkpolicies").RuleOrDie(),
"replicasets", "replicasets/scale", "deployments", "deployments/scale", "deployments/rollback").RuleOrDie(),
rbac.NewRule(read...).Groups(appsGroup, extensionsGroup).Resources("daemonsets").RuleOrDie(),

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

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

rbac.NewRule(readWrite...).Groups(extensionsGroup, networkingGroup).Resources("networkpolicies").RuleOrDie(),

// backwards compatibility
rbac.NewRule(readWrite...).Groups(buildGroup, legacyBuildGroup).Resources("buildlogs").RuleOrDie(),
rbac.NewRule(read...).Groups(kapiGroup).Resources("resourcequotausages").RuleOrDie(),
Expand Down Expand Up @@ -381,6 +383,8 @@ func GetOpenshiftBootstrapClusterRoles() []rbac.ClusterRole {

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

rbac.NewRule(readWrite...).Groups(extensionsGroup, networkingGroup).Resources("networkpolicies").RuleOrDie(),

// backwards compatibility
rbac.NewRule(readWrite...).Groups(buildGroup, legacyBuildGroup).Resources("buildlogs").RuleOrDie(),
rbac.NewRule(read...).Groups(kapiGroup).Resources("resourcequotausages").RuleOrDie(),
Expand Down Expand Up @@ -720,6 +724,7 @@ func GetOpenshiftBootstrapClusterRoles() []rbac.ClusterRole {
rbac.NewRule(read...).Groups(networkGroup, legacyNetworkGroup).Resources("egressnetworkpolicies", "hostsubnets", "netnamespaces").RuleOrDie(),
rbac.NewRule(read...).Groups(kapiGroup).Resources("nodes", "namespaces").RuleOrDie(),
rbac.NewRule(read...).Groups(extensionsGroup).Resources("networkpolicies").RuleOrDie(),
rbac.NewRule(read...).Groups(networkingGroup).Resources("networkpolicies").RuleOrDie(),
rbac.NewRule("get").Groups(networkGroup, legacyNetworkGroup).Resources("clusternetworks").RuleOrDie(),
},
},
Expand Down
37 changes: 36 additions & 1 deletion test/testdata/bootstrappolicy/bootstrap_cluster_roles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,6 @@ items:
- deployments
- deployments/rollback
- deployments/scale
- networkpolicies
- replicasets
- replicasets/scale
- replicationcontrollers/scale
Expand Down Expand Up @@ -1001,6 +1000,20 @@ items:
- patch
- update
- watch
- apiGroups:
- extensions
- networking.k8s.io
resources:
- networkpolicies
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
- build.openshift.io
Expand Down Expand Up @@ -1360,6 +1373,20 @@ items:
- patch
- update
- watch
- apiGroups:
- extensions
- networking.k8s.io
resources:
- networkpolicies
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
- build.openshift.io
Expand Down Expand Up @@ -2362,6 +2389,14 @@ items:
- get
- list
- watch
- apiGroups:
- networking.k8s.io
resources:
- networkpolicies
verbs:
- get
- list
- watch
- apiGroups:
- ""
- network.openshift.io
Expand Down
40 changes: 39 additions & 1 deletion test/testdata/bootstrappolicy/bootstrap_policy_file.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,6 @@ items:
- deployments
- deployments/rollback
- deployments/scale
- networkpolicies
- replicasets
- replicasets/scale
- replicationcontrollers/scale
Expand Down Expand Up @@ -1090,6 +1089,21 @@ items:
- patch
- update
- watch
- apiGroups:
- extensions
- networking.k8s.io
attributeRestrictions: null
resources:
- networkpolicies
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
- build.openshift.io
Expand Down Expand Up @@ -1479,6 +1493,21 @@ items:
- patch
- update
- watch
- apiGroups:
- extensions
- networking.k8s.io
attributeRestrictions: null
resources:
- networkpolicies
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
- build.openshift.io
Expand Down Expand Up @@ -2585,6 +2614,15 @@ items:
- get
- list
- watch
- apiGroups:
- networking.k8s.io
attributeRestrictions: null
resources:
- networkpolicies
verbs:
- get
- list
- watch
- apiGroups:
- ""
- network.openshift.io
Expand Down

0 comments on commit 98b52bf

Please sign in to comment.