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

Node admission/authorization #14227

Merged
merged 3 commits into from Sep 18, 2017
Merged

Node admission/authorization #14227

merged 3 commits into from Sep 18, 2017

Conversation

liggitt
Copy link
Contributor

@liggitt liggitt commented May 17, 2017

Enables the node authorizer and NodeRestriction admission plugins

@liggitt liggitt changed the title Node admission/authorization WIP - Node admission/authorization May 17, 2017
@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 9, 2017
@liggitt liggitt closed this Jul 12, 2017
@liggitt liggitt reopened this Jul 12, 2017
@liggitt
Copy link
Contributor Author

liggitt commented Jul 12, 2017

Will wait for the 1.7 rebase and drop all the upstream commits

@openshift-merge-robot openshift-merge-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jul 24, 2017
@openshift-merge-robot openshift-merge-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jul 28, 2017
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 18, 2017
@liggitt liggitt modified the milestone: 3.7.0 Aug 24, 2017
@openshift-merge-robot openshift-merge-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Aug 30, 2017
@stevekuznetsov stevekuznetsov changed the title WIP - Node admission/authorization WIP - Node admission/authorization Sep 7, 2017
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 7, 2017
@openshift-ci-robot
Copy link

@liggitt: Your pull request title starts with "WIP", so the do-not-merge/work-in-progress label will be added.

This label will ensure that your pull request will not be merged. Remove the prefix from your pull request title to trigger the removal of the label and allow for your pull request to be merged.

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.

@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 12, 2017
@openshift-ci-robot openshift-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 12, 2017
@liggitt liggitt changed the title WIP - Node admission/authorization Node admission/authorization Sep 12, 2017
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 12, 2017
@openshift openshift deleted a comment from openshift-bot Sep 12, 2017
@openshift openshift deleted a comment from openshift-bot Sep 12, 2017
@openshift openshift deleted a comment from openshift-bot Sep 12, 2017
@liggitt
Copy link
Contributor Author

liggitt commented Sep 12, 2017

cc @openshift/sig-security

@liggitt liggitt assigned enj and unassigned mfojtik Sep 12, 2017
simo5
simo5 previously requested changes Sep 12, 2017
Kind: "ClusterRole",
Name: NodeRoleName,
},
},
Copy link
Contributor

Choose a reason for hiding this comment

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

please use newOriginClusterBinding() or even better rbac.newClusterBinding() if you do not have to maintain a name difference between the role and the binding.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that helper does not allow empty subjects, which we want here.

Copy link
Contributor

Choose a reason for hiding this comment

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

very annoying, what is the purpose of a binding with no subjects ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so that tightening reconciliation removes the grant to the system:nodes group

for _, r := range miss {
t.Logf("\t%s", r.CompactString())
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this needed ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

to ensure there were no differences between our node role and the upstream node role as we converge

@@ -779,14 +777,25 @@ func buildKubeAuth(r rbacinformers.Interface) (kauthorizer.Authorizer, rbacregis
return kubeAuthorizer, ruleResolver, kubeSubjectLocator
}

func newAuthorizer(kubeAuthorizer kauthorizer.Authorizer, kubeSubjectLocator rbacauthorizer.SubjectLocator, clusterRoleGetter rbaclisters.ClusterRoleLister, projectRequestDenyMessage string) (kauthorizer.Authorizer, authorizer.SubjectLocator) {
func newAuthorizer(kubeAuthorizer kauthorizer.Authorizer, kubeSubjectLocator rbacauthorizer.SubjectLocator, informers InformerAccess, projectRequestDenyMessage string) (kauthorizer.Authorizer, authorizer.SubjectLocator) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We're trying to kill the big one. Plumb through the ones you want or make this a method on the config type or make a Complete method and we can try to start converging.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so plumbed

@simo5 simo5 dismissed their stale review September 12, 2017 20:16

explained why change can't be done

@liggitt
Copy link
Contributor Author

liggitt commented Sep 12, 2017

/retest

@liggitt
Copy link
Contributor Author

liggitt commented Sep 12, 2017

Router flake
/retest

@liggitt
Copy link
Contributor Author

liggitt commented Sep 14, 2017

any other comments?

Copy link
Contributor

@enj enj left a comment

Choose a reason for hiding this comment

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

Minor issue.

newOriginClusterBinding(NodeRoleBindingName, NodeRoleName).
Groups(NodesGroup).
BindingOrDie(),
// Preserve the empty node binding with no subjects for tightening reconciliation
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like we should have a GetDeadClusterRoleBindings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wouldn't want to chance someone calling this and missing calling that

Copy link
Contributor

Choose a reason for hiding this comment

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

We already trust callers to use GetBootstrapClusterRoles which gives them GetDeadClusterRoles. I would expect GetBootstrapClusterRoleBindings to have the same logic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, ok

Copy link
Contributor Author

Choose a reason for hiding this comment

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

created GetDeadClusterRoleBindings

@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 15, 2017
@liggitt
Copy link
Contributor Author

liggitt commented Sep 15, 2017

updated, and added an integration test that replicates the checks in https://github.com/kubernetes/kubernetes/blob/release-1.7/test/integration/auth/node_test.go against our wired API server to ensure our default authz/admission set up protects us.

// If an admin wants to grant the system:node role (which cannot partition Node API access), they will need to create their own clusterrolebinding.
// TODO: Remove the subjects from this binding in 1.8 (leave the empty binding for tightening reconciliation), and remove AddClusterRoleBindingFilter()
rbac.NewClusterBinding(systemNodeRoleName).Groups(user.NodesGroup).BindingOrDie(),
// This default binding of the system:node role to the system:nodes group is deprecated in 1.7 with the availability of the Node authorizer.
Copy link
Contributor

Choose a reason for hiding this comment

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

Uhh upstream commit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, pushed too fast. Will fix

@liggitt
Copy link
Contributor Author

liggitt commented Sep 17, 2017

comments addressed, PTAL

@enj
Copy link
Contributor

enj commented Sep 18, 2017

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: enj, liggitt

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-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 Sep 18, 2017

@liggitt: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/openshift-jenkins/cmd 7fa775c link /test cmd

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 16224, 14227)

@openshift-merge-robot openshift-merge-robot merged commit 09d04de into openshift:master Sep 18, 2017
@liggitt liggitt deleted the node-authz branch September 21, 2017 21:46
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. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants