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

feat: allow "runtime-only" configuration without default issuer #395

Merged

Conversation

ThatsMrTalbot
Copy link
Contributor

@ThatsMrTalbot ThatsMrTalbot commented Sep 2, 2024

Changes

Helm

  • Added app.certmanager.issuer.enabled to disable "default" non runtime issuer.

app.go

  • Wrapped the health checks to only run when issuer config is available. This means that we still go "not ready" if invalid issuer config is provided or the runtime config obtained is invalid.

options.go

  • Added --issuer-enabled flag to disable "default" non runtime issuer. By setting this to false you can start istio-csr up and have it idle waiting for runtime config (while being ready).

certmanager.go

  • Updated the runtime config watcher to prune subscriptions that are not in use. Functions like WaitForIssuerConfig only need a single channel event then stopped monitoring it. The addition of the ability to "close" the subscription means these functions can "unsubscribe".

  • Moved WaitForIssuerConfig into the manager, it makes sense in my mind for it to be there so multiple things can call it if needed.

configmap.go / tls.go

  • The original implementation of tls.Interface.RootCAs was blocking, this meant that if you had no "default" issuer config and the runtime config was not yet configured then the configmap controller Reconcile would block forever and delay graceful shutdown. The new implementation of RootCAs accepts a context so the controller can shut down gracefully.

@cert-manager-prow cert-manager-prow bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 2, 2024
@ThatsMrTalbot ThatsMrTalbot force-pushed the feat/idle-startup branch 2 times, most recently from a445350 to 7dc33f8 Compare September 2, 2024 13:27
@ThatsMrTalbot ThatsMrTalbot changed the title wip: feat: allow "runtime-only" configuration without default issuer feat: allow "runtime-only" configuration without default issuer Sep 2, 2024
@cert-manager-prow cert-manager-prow bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 2, 2024
Copy link
Member

@SgtCoDFish SgtCoDFish left a comment

Choose a reason for hiding this comment

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

One little comment - what do you think? It's not absolutely required!

Comment on lines 81 to 92
// IssuerChangeSubscription is a subscription that can be used to get changes
// to issuer config
type IssuerChangeSubscription struct {
C <-chan *cmmeta.ObjectReference

// The same channel as above is mirrored in c, but without the "<-"
// restriction. This allows the channel to be written to by this package.
c chan *cmmeta.ObjectReference

lock sync.Mutex
closed bool
}
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: I'm a bit squeamish about having two variables with the same name differing only in casing - I personally find that pretty hard to keep in my head.

I like C for the exported one, but maybe something like sendCh, internalCh or something else instead of c?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed it to sendChannel

@@ -57,7 +57,7 @@ type DynamicIstiodCertProvisioner struct {

issuerRefMutex sync.Mutex

issuerChangeChan <-chan *cmmeta.ObjectReference
issuerChangeChan *certmanager.IssuerChangeSubscription
Copy link
Member

Choose a reason for hiding this comment

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

nitpick (non-blocking): maybe rename because this isn't a channel any more?

Suggested change
issuerChangeChan *certmanager.IssuerChangeSubscription
issuerChangeSub *certmanager.IssuerChangeSubscription

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense - updated

Signed-off-by: Adam Talbot <adam.talbot@venafi.com>
Copy link
Member

@SgtCoDFish SgtCoDFish left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

Cheers! 🚀

@cert-manager-prow cert-manager-prow bot added the lgtm Indicates that a PR is ready to be merged. label Sep 2, 2024
@cert-manager-prow
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: SgtCoDFish

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

@cert-manager-prow cert-manager-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 2, 2024
@cert-manager-prow cert-manager-prow bot merged commit 570b54a into cert-manager:main Sep 2, 2024
14 checks passed
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. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. 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.

2 participants