Skip to content
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

Merged

Conversation

danwinship
Copy link
Contributor

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.)

@danwinship danwinship added component/networking kind/bug Categorizes issue or PR as related to a bug. sig/networking labels Nov 30, 2017
@danwinship danwinship added this to the 3.8.0 milestone Nov 30, 2017
@openshift-merge-robot openshift-merge-robot added the vendor-update Touching vendor dir or related files label Nov 30, 2017
@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 30, 2017
@danwinship
Copy link
Contributor Author

/test extended_networking

@danwinship
Copy link
Contributor Author

cc @soltysh for overlap/conflict with #17491

@danwinship
Copy link
Contributor Author

flake #17519
/retest

@soltysh
Copy link
Contributor

soltysh commented Dec 1, 2017

cc @soltysh for overlap/conflict with #17491

Aha, I was right, I was missing these bits when I was going through policies. But since I haven't seen them in k8s I assumed them not needed in origin.

Copy link
Contributor

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 1, 2017
@simo5
Copy link
Contributor

simo5 commented Dec 1, 2017

@enj PTAL

@enj
Copy link
Contributor

enj commented Dec 1, 2017

/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).

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 1, 2017
@@ -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(),
Copy link
Contributor

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.

Copy link
Contributor Author

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(),
Copy link
Contributor

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(),
Copy link
Contributor

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?

Copy link
Contributor Author

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"

Copy link
Contributor

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 ?

@enj
Copy link
Contributor

enj commented Dec 1, 2017

@danwinship I am also unsure how changing the RBAC admin/edit/view upstream does anything for us (we have our own admin/edit/view)?

@danwinship
Copy link
Contributor Author

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?

@openshift-merge-robot openshift-merge-robot removed lgtm Indicates that a PR is ready to be merged. vendor-update Touching vendor dir or related files labels Dec 1, 2017
@danwinship
Copy link
Contributor Author

/test extended_networking

@danwinship
Copy link
Contributor Author

/retest

@soltysh soltysh mentioned this pull request Dec 6, 2017
@soltysh
Copy link
Contributor

soltysh commented Dec 6, 2017

@enj with the upstream bits dropped are you ok with this getting in?

@liggitt
Copy link
Contributor

liggitt commented Dec 6, 2017

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

@danwinship
Copy link
Contributor Author

This rule is also for the apps group, so don’t add network policies to this one. Make a separate extensions only one

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(),
Copy link
Contributor

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(),
Copy link
Contributor

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.
@openshift-ci-robot openshift-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 11, 2017
@danwinship
Copy link
Contributor Author

/retest

@danwinship
Copy link
Contributor Author

/test extended_conformance_install

@danwinship
Copy link
Contributor Author

tests pass. @liggitt ? (needs a "/hold cancel" too)

@liggitt
Copy link
Contributor

liggitt commented Dec 12, 2017

/lgtm
/hold cancel

@openshift-ci-robot openshift-ci-robot added lgtm Indicates that a PR is ready to be merged. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Dec 12, 2017
@openshift-ci-robot
Copy link

[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 /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 12, 2017
@deads2k
Copy link
Contributor

deads2k commented Dec 12, 2017

/hold

This will conflict with the rebase. Please merge after that.

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 12, 2017
@deads2k
Copy link
Contributor

deads2k commented Dec 13, 2017

rebase landed

/hold cancel

/test all

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 13, 2017
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@soltysh
Copy link
Contributor

soltysh commented Dec 14, 2017

/retest

3 similar comments
@danwinship
Copy link
Contributor Author

/retest

@danwinship
Copy link
Contributor Author

/retest

@danwinship
Copy link
Contributor Author

/retest

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot
Copy link
Contributor

/test all [submit-queue is verifying that this PR is safe to merge]

@openshift-ci-robot
Copy link

openshift-ci-robot commented Dec 15, 2017

@danwinship: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/openshift-jenkins/cmd 98b52bf link /test cmd
ci/openshift-jenkins/extended_conformance_gce 98b52bf link /test extended_conformance_gce

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.

@openshift-merge-robot
Copy link
Contributor

Automatic merge from submit-queue (batch tested with PRs 17549, 17785).

@openshift-merge-robot openshift-merge-robot merged commit bfc48b1 into openshift:master Dec 15, 2017
@danwinship danwinship deleted the networkpolicy-rbac branch March 7, 2018 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. component/networking kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. sig/networking size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants