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

modify the signing/approving controller to tolerate either set of usages for kubelet client and serving certificates #111061

Merged
merged 1 commit into from Aug 3, 2022

Conversation

pacoxu
Copy link
Member

@pacoxu pacoxu commented Jul 11, 2022

What type of PR is this?

/kind bug

What this PR does / why we need it:

Which issue(s) this PR fixes:

xref #109077

  • set it to optional in this release, but the default will use it
  • in the next release, we can set the default not to include it.

Special notes for your reviewer:

  1. API validation of CSR create and update requests
  2. Controller tolerating CSR objects with/without that usage
  3. Kubelets requesting CSRs properly without that usage if given a non-RSA key

func validAPIServerClientUsages(usages []capi.KeyUsage) error {
hasClientAuth := false
for _, u := range usages {
switch u {
// these usages are optional
case capi.UsageDigitalSignature, capi.UsageKeyEncipherment:
case capi.UsageClientAuth:
hasClientAuth = true
default:
return fmt.Errorf("invalid usage for client certificate: %s", u)
}
}
if !hasClientAuth {
return fmt.Errorf("missing required usage for client certificate: %s", capi.UsageClientAuth)
}
return nil
}

The controller already tolerates it.

Does this PR introduce a user-facing change?

Modify the signing/approving controller to tolerate either set of usages for kubelet client and serving certificates without key encipherment

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jul 11, 2022
@k8s-ci-robot
Copy link
Contributor

@pacoxu: This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

@k8s-ci-robot k8s-ci-robot added the needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label Jul 11, 2022
@k8s-ci-robot k8s-ci-robot added area/kubelet sig/auth Categorizes an issue or PR as relevant to SIG Auth. sig/node Categorizes an issue or PR as relevant to SIG Node. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jul 11, 2022
@pacoxu pacoxu marked this pull request as draft July 11, 2022 03:35
@k8s-ci-robot k8s-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 Jul 11, 2022
@pacoxu pacoxu force-pushed the key-encipherment-optional branch 2 times, most recently from e56f450 to a80b502 Compare July 11, 2022 04:07
@pacoxu pacoxu marked this pull request as ready for review July 11, 2022 04:07
@k8s-ci-robot k8s-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 Jul 11, 2022
@k8s-ci-robot k8s-ci-robot added the sig/apps Categorizes an issue or PR as relevant to SIG Apps. label Jul 11, 2022
@pacoxu pacoxu changed the title Set Key encipherment optional [WIP]Set Key encipherment optional Jul 11, 2022
@k8s-ci-robot k8s-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 Jul 11, 2022
@pacoxu pacoxu force-pushed the key-encipherment-optional branch 2 times, most recently from 6f2ae41 to fb06fd2 Compare July 14, 2022 09:36
@k8s-ci-robot k8s-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 Jul 14, 2022
@pacoxu pacoxu force-pushed the key-encipherment-optional branch from fb06fd2 to bed76fa Compare July 14, 2022 15:07
@pacoxu pacoxu requested a review from liggitt August 2, 2022 15:02
Copy link
Member

@liggitt liggitt left a comment

Choose a reason for hiding this comment

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

one test nit, then lgtm

pkg/apis/certificates/v1beta1/defaults_test.go Outdated Show resolved Hide resolved
…ges for kubelet client and serving certificates

Signed-off-by: Paco Xu <paco.xu@daocloud.io>
@pacoxu pacoxu requested a review from liggitt August 2, 2022 21:13
@liggitt
Copy link
Member

liggitt commented Aug 2, 2022

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 2, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 2, 2022
@liggitt
Copy link
Member

liggitt commented Aug 2, 2022

once this merges, if you don't mind, can you open the PR we'll merge in 1.26 relaxing the API defaulting?

@pacoxu
Copy link
Member Author

pacoxu commented Aug 2, 2022

once this merges, if you don't mind, can you open the PR we'll merge in 1.26 relaxing the API defaulting?

of course.

Thanks for your detailed review and guide.

@pacoxu
Copy link
Member Author

pacoxu commented Aug 3, 2022

/retest

@k8s-ci-robot k8s-ci-robot merged commit cb41d50 into kubernetes:master Aug 3, 2022
SIG Node PR Triage automation moved this from Triage to Done Aug 3, 2022
@pacoxu
Copy link
Member Author

pacoxu commented Aug 3, 2022

I opened #111660 for v1.26.

@sftim
Copy link
Contributor

sftim commented Aug 10, 2022

Could we update the changelog entry to mention that this change is in connection with CertificateSigningRequest?

@pacoxu
Copy link
Member Author

pacoxu commented Aug 10, 2022

Could we update the changelog entry to mention that this change is in connection with CertificateSigningRequest?

Modify the signing/approving controller to tolerate either set of usages for kubelet client and serving certificates without key encipherment

I tried to change it like above to mention the sign request approval.

mansikulkarni96 added a commit to mansikulkarni96/windows-machine-config-operator that referenced this pull request May 11, 2023
This commit modifies the existing CSr approver to tolerate
a set of usages for kubelet client and serving certificates
without key encipherment to accomodate recent upstream
changes around key encipherment.

Releated upstream PR's:
kubernetes/kubernetes#111061
kubernetes/kubernetes#111660
mansikulkarni96 added a commit to mansikulkarni96/windows-machine-config-operator that referenced this pull request May 11, 2023
This commit modifies the existing CSr approver to tolerate
a set of usages for kubelet client and serving certificates
without key encipherment to accomodate recent upstream
changes around key encipherment.

Releated upstream PR's:
kubernetes/kubernetes#111061
kubernetes/kubernetes#111660
mansikulkarni96 added a commit to mansikulkarni96/windows-machine-config-operator that referenced this pull request May 11, 2023
This commit modifies the existing CSr approver to tolerate
a set of usages for kubelet client and serving certificates
without key encipherment to accomodate recent upstream
changes around key encipherment.

Releated upstream PR's:
kubernetes/kubernetes#111061
kubernetes/kubernetes#111660
mansikulkarni96 added a commit to mansikulkarni96/windows-machine-config-operator that referenced this pull request May 15, 2023
This commit modifies the existing CSr approver to tolerate
a set of usages for kubelet client and serving certificates
without key encipherment to accomodate recent upstream
changes around key encipherment.

Releated upstream PR's:
kubernetes/kubernetes#111061
kubernetes/kubernetes#111660
mansikulkarni96 added a commit to mansikulkarni96/windows-machine-config-operator that referenced this pull request May 17, 2023
This commit modifies the existing CSr approver to tolerate
a set of usages for kubelet client and serving certificates
without key encipherment to accomodate recent upstream
changes around key encipherment.

Releated upstream PR's:
kubernetes/kubernetes#111061
kubernetes/kubernetes#111660
mansikulkarni96 added a commit to mansikulkarni96/windows-machine-config-operator that referenced this pull request May 17, 2023
This commit modifies the existing CSr approver to tolerate
a set of usages for kubelet client and serving certificates
without key encipherment to accomodate recent upstream
changes around key encipherment.

Releated upstream PR's:
kubernetes/kubernetes#111061
kubernetes/kubernetes#111660
mansikulkarni96 added a commit to mansikulkarni96/windows-machine-config-operator that referenced this pull request May 17, 2023
This commit modifies the existing CSr approver to tolerate
a set of usages for kubelet client and serving certificates
without key encipherment to accomodate recent upstream
changes around key encipherment.

Releated upstream PR's:
kubernetes/kubernetes#111061
kubernetes/kubernetes#111660
mansikulkarni96 added a commit to mansikulkarni96/windows-machine-config-operator that referenced this pull request May 17, 2023
This commit modifies the existing CSr approver to tolerate
a set of usages for kubelet client and serving certificates
without key encipherment to accomodate recent upstream
changes around key encipherment.

Releated upstream PR's:
kubernetes/kubernetes#111061
kubernetes/kubernetes#111660
mansikulkarni96 added a commit to mansikulkarni96/windows-machine-config-operator that referenced this pull request May 17, 2023
This commit modifies the existing CSR approval process to
accept a set of CSR usages with and without key encipherment.
This is required after the recent upstream  changes where
kubelet may request a CSR without the key encipherment usage
when given a non-RSA key.

Releated upstream PR's:
kubernetes/kubernetes#111061
kubernetes/kubernetes#111660
wgahnagl pushed a commit to wgahnagl/windows-machine-config-operator that referenced this pull request Aug 28, 2023
This commit modifies the existing CSR approval process to
accept a set of CSR usages with and without key encipherment.
This is required after the recent upstream  changes where
kubelet may request a CSR without the key encipherment usage
when given a non-RSA key.

Releated upstream PR's:
kubernetes/kubernetes#111061
kubernetes/kubernetes#111660
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. area/kubelet cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/auth Categorizes an issue or PR as relevant to SIG Auth. sig/node Categorizes an issue or PR as relevant to SIG Node. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants