Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions pkg/cmd/server/bootstrappolicy/controller_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,13 @@ func init() {
ObjectMeta: metav1.ObjectMeta{Name: saRolePrefix + InfraSDNControllerServiceAccountName},
Rules: []rbac.PolicyRule{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This applies to the SDN master but not the nodes, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct

rbac.NewRule("get", "create", "update").Groups(networkGroup, legacyNetworkGroup).Resources("clusternetworks").RuleOrDie(),
rbac.NewRule("get", "list").Groups(networkGroup, legacyNetworkGroup).Resources("egressnetworkpolicies").RuleOrDie(),
rbac.NewRule("get", "list", "create", "delete").Groups(networkGroup, legacyNetworkGroup).Resources("hostsubnets").RuleOrDie(),
rbac.NewRule("get", "list", "create", "update", "delete").Groups(networkGroup, legacyNetworkGroup).Resources("netnamespaces").RuleOrDie(),
rbac.NewRule("get", "list", "watch", "create", "delete").Groups(networkGroup, legacyNetworkGroup).Resources("hostsubnets").RuleOrDie(),
rbac.NewRule("get", "list", "watch", "create", "update", "delete").Groups(networkGroup, legacyNetworkGroup).Resources("netnamespaces").RuleOrDie(),
rbac.NewRule("get", "list").Groups(kapiGroup).Resources("pods").RuleOrDie(),
Copy link
Contributor

@danwinship danwinship Jun 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW it doesn't currently need "get", though it does use "list" (at startup, to make sure that all running pods are inside the current clusterNetworkCIDR, if clusterNetworkCIDR has changed).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrm, can probably leave it. "get"/"list"/"watch" are so closely coupled that we probably should have just done a placeholder

rbac.NewRule("list").Groups(kapiGroup).Resources("services").RuleOrDie(),
rbac.NewRule("list").Groups(kapiGroup).Resources("namespaces").RuleOrDie(),
rbac.NewRule("get").Groups(kapiGroup).Resources("nodes").RuleOrDie(),
rbac.NewRule("get", "list", "watch").Groups(kapiGroup).Resources("services").RuleOrDie(),
rbac.NewRule("get", "list", "watch").Groups(kapiGroup).Resources("namespaces").RuleOrDie(),
rbac.NewRule("get", "list", "watch").Groups(kapiGroup).Resources("nodes").RuleOrDie(),
rbac.NewRule("update").Groups(kapiGroup).Resources("nodes/status").RuleOrDie(),
rbac.NewRule("list").Groups(extensionsGroup).Resources("networkPolicies").RuleOrDie(),

eventsRule(),
},
Expand Down
24 changes: 8 additions & 16 deletions test/testdata/bootstrappolicy/bootstrap_cluster_roles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3620,15 +3620,6 @@ items:
- create
- get
- update
- apiGroups:
- ""
- network.openshift.io
attributeRestrictions: null
resources:
- egressnetworkpolicies
verbs:
- get
- list
- apiGroups:
- ""
- network.openshift.io
Expand All @@ -3640,6 +3631,7 @@ items:
- delete
- get
- list
- watch
- apiGroups:
- ""
- network.openshift.io
Expand All @@ -3652,6 +3644,7 @@ items:
- get
- list
- update
- watch
- apiGroups:
- ""
attributeRestrictions: null
Expand All @@ -3666,35 +3659,34 @@ items:
resources:
- services
verbs:
- get
- list
- watch
- apiGroups:
- ""
attributeRestrictions: null
resources:
- namespaces
verbs:
- get
- list
- watch
- apiGroups:
- ""
attributeRestrictions: null
resources:
- nodes
verbs:
- get
- list
- watch
- apiGroups:
- ""
attributeRestrictions: null
resources:
- nodes/status
verbs:
- update
- apiGroups:
- extensions
attributeRestrictions: null
resources:
- networkPolicies
verbs:
- list
- apiGroups:
- ""
attributeRestrictions: null
Expand Down