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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃尡 Adding certwatcher as an external package #1441

Merged

Conversation

christopherhein
Copy link
Member

Per #1292 this exports the certwatcher package for use with other packages, for example custom Runnable's passed into a manager.

Closes #1292

Signed-off-by: Chris Hein me@chrishein.com

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 22, 2021
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 22, 2021
@christopherhein
Copy link
Member Author

/cc @vincepri @alvaroaleman

pkg/certwatcher/certwatcher_test.go Outdated Show resolved Hide resolved

func publicKey(priv interface{}) interface{} {
switch k := priv.(type) {
case *rsa.PrivateKey:
Copy link
Member

Choose a reason for hiding this comment

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

can we properly type the function signature if this effectively has to be a *rsa.PrivateKey?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I'll be honest cert gen was a bit of copy/pasta where they had the ability to create multiple algo based certs ecdsa/rsa etc and I just trimmed this down. Given this is only one algo I can just hard code this type on line https://github.com/kubernetes-sigs/controller-runtime/pull/1441/files/efd29024698fb095a8c004dea2641925655fb4ad#diff-cc4e056d68e41389001be7de46dfac27f508da1039369db677584b5721321ee4R162

derBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, publicKey(priv), priv)

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated.

@christopherhein
Copy link
Member Author

thanks for the review @alvaroaleman, both comments have been addressed.

Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

Changes LGTM, @christopherhein could we add a doc.go in this package to explain what certwatcher should/can be used for?

@christopherhein
Copy link
Member Author

Changes LGTM, @christopherhein could we add a doc.go in this package to explain what certwatcher should/can be used for?

Definitely! 馃憤

Signed-off-by: Chris Hein <me@chrishein.com>
@christopherhein
Copy link
Member Author

@vincepri I did ya one a little better, added a doc.go and an example_test.go to make these docs even more thorough.

Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/approve
/assign @alvaroaleman

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 22, 2021
Copy link
Member

@alvaroaleman alvaroaleman left a comment

Choose a reason for hiding this comment

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

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alvaroaleman, christopherhein, vincepri

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:
  • OWNERS [alvaroaleman,vincepri]

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 merged commit 197751d into kubernetes-sigs:master Mar 22, 2021
@k8s-ci-robot k8s-ci-robot added this to the v0.9.x milestone Mar 22, 2021
@christopherhein christopherhein deleted the export-certwatcher branch March 22, 2021 17:49
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. 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.

Export the certwatcher package
4 participants