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

Add clusterroles for approving CSRs easily #49284

Merged
merged 1 commit into from
Aug 1, 2017

Conversation

luxas
Copy link
Member

@luxas luxas commented Jul 20, 2017

What this PR does / why we need it:

Adds ClusterRoles for CSR approving. Currently consumers like kubeadm and GKE have to create these rules by themselves, but are doing it slightly differently which leads to sprawl. Instead, the ClusterRoles are created by core, and the actual bindings created by respective deployment method.

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #

fixes #48191

Special notes for your reviewer:

Release note:

The API Server now automatically creates RBAC ClusterRoles for CSR approving. 
Each deployment method should bind users/groups to the ClusterRoles if they are using this feature.

cc @kubernetes/sig-auth-pr-reviews @kubernetes/sig-cluster-lifecycle-pr-reviews

@k8s-ci-robot k8s-ci-robot added sig/auth Categorizes an issue or PR as relevant to SIG Auth. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jul 20, 2017
@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Jul 20, 2017
@luxas
Copy link
Member Author

luxas commented Jul 20, 2017

/retest

1 similar comment
@luxas
Copy link
Member Author

luxas commented Jul 20, 2017

/retest

},
{
// a role making the csrapprover controller approve a node server CSR requested by the node itself
ObjectMeta: metav1.ObjectMeta{Name: "system:csr-approver:approve-node-server-renewal-csr"},
Copy link
Contributor

Choose a reason for hiding this comment

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

This functionality is alpha. Can we name this experimental-*?

Copy link
Member Author

Choose a reason for hiding this comment

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

@ericchiang My understanding was that this would be beta in v1.8?
cc @mikedanese @jcbsmpsn

Copy link
Member

Choose a reason for hiding this comment

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

I'd rather gate with the feature flag rather than change the name. when the flag goes to beta and is enabled, this will be enabled as well

},
{
// a role making the csrapprover controller approve a node client CSR requested by the node itself
ObjectMeta: metav1.ObjectMeta{Name: "system:csr-approver:approve-node-client-renewal-csr"},
Copy link
Member

Choose a reason for hiding this comment

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

The second approve and csr are redundant. "Renewal" is generally referred to as "rotation" in this context. I don't like how these don't match the subject access review verbs at all.

Copy link
Member

Choose a reason for hiding this comment

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

also, rotation/renewal is one reason a node might request these, but is not the only reason... I'd omit that from the name entirely

Copy link
Member Author

Choose a reason for hiding this comment

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

@mikedanese would you be ok with system:csr-approver:node-{client,server}-{,rotation}-csr?

@luxas luxas force-pushed the csr_cluster_roles branch from 02d534c to 19df066 Compare July 20, 2017 18:14
@luxas
Copy link
Member Author

luxas commented Jul 20, 2017

@mikedanese @liggitt updated

@luxas luxas force-pushed the csr_cluster_roles branch 2 times, most recently from e6397ef to 3331dc2 Compare July 24, 2017 20:26
@@ -361,7 +363,32 @@ func ClusterRoles() []rbac.ClusterRole {
eventsRule(),
},
},
{
// a role making the csrapprover controller approve a node client CSR
ObjectMeta: metav1.ObjectMeta{Name: "system:csr-approver:node-client-csr"},
Copy link
Member

Choose a reason for hiding this comment

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

I suggest just using the name of the sar verbs. The final csr is redundent. E.g.:

system:csr-approver:nodeclient
system:csr-approver:selfnodeclient
system:csr-approver:selfnodeserver

@luxas luxas force-pushed the csr_cluster_roles branch from 3331dc2 to 2fff965 Compare July 24, 2017 20:56
@luxas
Copy link
Member Author

luxas commented Jul 24, 2017

@mikedanese updated, please LGTM

@mikedanese
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 24, 2017
@luxas luxas added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 24, 2017
@luxas
Copy link
Member Author

luxas commented Jul 24, 2017

(Mike should definitely have approval access for this part of the code, not sure why he doesn't)

@liggitt liggitt removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 24, 2017
@@ -361,7 +363,32 @@ func ClusterRoles() []rbac.ClusterRole {
eventsRule(),
},
},
{
// a role making the csrapprover controller approve a node client CSR
ObjectMeta: metav1.ObjectMeta{Name: "system:csr-approver:nodeclient"},
Copy link
Member

Choose a reason for hiding this comment

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

I like matching the name to the subresource, but the csr-approver namespacing is a little odd… this role doesn't let you approve things, it lets you submit things the autoapprover will approve. Is this the pattern we want to start for roles related to a particular component?

Copy link
Member

Choose a reason for hiding this comment

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

sharding by api group and possibly resource seems like a pattern that would work better in the future, e.g. system:certificates.k8s.io:certificatesigningrequests:nodeclient

Copy link
Member Author

Choose a reason for hiding this comment

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

@mikedanese Are you ok with that? SGTM

Copy link
Member

Choose a reason for hiding this comment

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

SGTM

@timothysc
Copy link
Member

@mattmoyer

@timothysc timothysc added this to the v1.8 milestone Jul 31, 2017
@liggitt
Copy link
Member

liggitt commented Jul 31, 2017

please open a corresponding PR against https://github.com/kubernetes/kubernetes.github.io/blob/release-1.8/docs/admin/authorization/rbac.md#other-component-roles (the 1.8 branch) when the names are finalized.

@luxas luxas force-pushed the csr_cluster_roles branch from 2fff965 to e0ff623 Compare July 31, 2017 20:45
@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 31, 2017
@luxas
Copy link
Member Author

luxas commented Jul 31, 2017

@liggitt @mikedanese PTAL

please open a corresponding PR against https://github.com/kubernetes/kubernetes.github.io/blob/release-1.8/docs/admin/authorization/rbac.md#other-component-roles (the 1.8 branch) when the names are finalized.

@liggitt I'll do that

@liggitt
Copy link
Member

liggitt commented Jul 31, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 31, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liggitt, luxas, mikedanese

Associated issue: 48191

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

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 31, 2017
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to @fejta).

Review the full test history for this PR.

2 similar comments
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to @fejta).

Review the full test history for this PR.

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to @fejta).

Review the full test history for this PR.

@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 49284, 49555, 47639, 49526, 49724)

@liggitt
Copy link
Member

liggitt commented Aug 20, 2017

@luxas also, when you open the doc PR, also update the TLS bootstrapping page to give specific examples of the roles you would need to bind to enable bootstrapping

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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/auth Categorizes an issue or PR as relevant to SIG Auth. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. 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.

Add ClusterRoles for CSR approval modes to RBAC bootstrappolicy
9 participants