-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NetworkPolicy RBAC fixes #17549
NetworkPolicy RBAC fixes #17549
Conversation
/test extended_networking |
flake #17519 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
@enj PTAL |
/hold Upstream does not seem to have a decision on who should be able to manipulate these objects by default. I am not sure even an admin for a project should be able to mess with this (do not have enough familiarly with network policy to definitely say). |
@@ -326,6 +326,7 @@ func GetOpenshiftBootstrapClusterRoles() []rbac.ClusterRole { | |||
rbac.NewRule(readWrite...).Groups(buildGroup, legacyBuildGroup).Resources("buildlogs").RuleOrDie(), | |||
rbac.NewRule(read...).Groups(kapiGroup).Resources("resourcequotausages").RuleOrDie(), | |||
rbac.NewRule("create").Groups(authzGroup, legacyAuthzGroup).Resources("resourceaccessreviews", "subjectaccessreviews").RuleOrDie(), | |||
rbac.NewRule(readWrite...).Groups(networkingGroup).Resources("networkpolicies").RuleOrDie(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how this is backwards compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, just jumped to the bottom of the block and didn't see that comment
@@ -720,6 +721,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(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one seems fine.
"replicasets", "replicasets/scale", "replicationcontrollers/scale", | ||
"networkpolicies").RuleOrDie(), | ||
|
||
rbac.NewRule(ReadWrite...).Groups(networkingGroup).Resources("networkpolicies").RuleOrDie(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems a bit powerful for edit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description says that "admin" is just "edit plus the power to grant permissions to other users", and the two have identical rules other than the two under "// additional admin powers" in "admin"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is in vendor/ shouldn't it go via a backport from upstream PR anyway ?
@danwinship I am also unsure how changing the RBAC admin/edit/view upstream does anything for us (we have our own admin/edit/view)? |
oh, hm, I was assuming there was some kind of merging between ours and theirs. It's actually the change to SDNReaderRoleName in the second commit that fixes the tests. I guess I can drop the UPSTREAM commit then? |
4f74e08
to
2461351
Compare
/test extended_networking |
/retest |
@enj with the upstream bits dropped are you ok with this getting in? |
I want sign-off on the upstream change (that namespace constrained users are expected to be able to modify network policy). There's also the question of whether write access would be limited to the admin role |
Ah... I just copied from the "admin" policies, but it looks like it's wrong there too now. (Got broken in the kube 1.8.1 rebase). Fixed for both "admin" and "edit" now. |
@@ -322,6 +322,9 @@ func GetOpenshiftBootstrapClusterRoles() []rbac.ClusterRole { | |||
|
|||
rbac.NewRule(readWrite...).Groups(templateGroup, legacyTemplateGroup).Resources("templates", "templateconfigs", "processedtemplates", "templateinstances").RuleOrDie(), | |||
|
|||
rbac.NewRule(readWrite...).Groups(extensionsGroup).Resources("networkpolicies").RuleOrDie(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can make these a single rule: Groups(appsGroup, extensionsGroup)
@@ -381,6 +384,9 @@ func GetOpenshiftBootstrapClusterRoles() []rbac.ClusterRole { | |||
|
|||
rbac.NewRule(readWrite...).Groups(templateGroup, legacyTemplateGroup).Resources("templates", "templateconfigs", "processedtemplates", "templateinstances").RuleOrDie(), | |||
|
|||
rbac.NewRule(readWrite...).Groups(extensionsGroup).Resources("networkpolicies").RuleOrDie(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here as well
And fix some inconsistencies with the existing NetworkPolicy roles.
7c5c6ba
to
98b52bf
Compare
/retest |
/test extended_conformance_install |
tests pass. @liggitt ? (needs a "/hold cancel" too) |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: danwinship, liggitt, soltysh The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/hold This will conflict with the rebase. Please merge after that. |
rebase landed /hold cancel /test all |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest |
3 similar comments
/retest |
/retest |
/retest |
/retest Please review the full test history for this PR and help us cut down flakes. |
/test all [submit-queue is verifying that this PR is safe to merge] |
@danwinship: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Automatic merge from submit-queue (batch tested with PRs 17549, 17785). |
As part of the k8s 1.8 rebase, the NetworkPolicy code was changed to use networking.NetworkPolicy rather than extensions.NetworkPolicy, but the roles weren't updated to have the right permissions.. (This wasn't caught because only extended-networking-minimal gets run on PRs by default, and that only tests multitenant.)
Fixes test_branch_origin_extended_networking
(kubernetes/kubernetes#56650 hasn't actually merged yet.)