8000 Enables disabling enabled cert-manager-controller controllers by JoshVanL · Pull Request #3791 · cert-manager/cert-manager · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Enables disabling enabled cert-manager-controller controllers #3791

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

Conversation

JoshVanL
Copy link
Contributor
@JoshVanL JoshVanL commented Mar 23, 2021

/kind feature
/assign @jakexks @irbekrm

Allows disabling enabled cert-manager-controller controller, for example '--controllers=*,-foo'

@jetstack-bot jetstack-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. labels Mar 23, 2021
@jetstack-bot jetstack-bot added area/deploy Indicates a PR modifies deployment configuration approved Indicates a PR has been approved by an approver from all required OWNERS files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 23, 2021
@SgtCoDFish SgtCoDFish self-assigned this Mar 24, 2021
@munnerz
Copy link
Member
munnerz commented Mar 24, 2021

Is this the same approach that kube-controller-manager takes for disabling controllers? I thought we could prefix the name of a controller with a - in the list of --controllers, but perhaps I am wrong..

@@ -81,7 +81,7 @@ func Run(opts *options.ControllerOptions, stopCh <-chan struct{}) {
log := log.WithValues("controller", n)

// only run a controller if it's been enabled
if !util.Contains(opts.EnabledControllers, n) {
if !util.Contains(opts.EnabledControllers, n) || util.Contains(opts.DisabledControllers, n) {
Copy link
Member

Choose a reason for hiding this comment

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

It would be good to have this specifically be unit tested with a few combinations of enabled and disabled controllers. Could be a new func in util which is called from here:

func IsDisabled(n string, enabledControllers []string, disabledControllers []string) bool

I don't think it's required, though.

@@ -222,6 +225,8 @@ func (s *ControllerOptions) AddFlags(fs *pflag.FlagSet) {

fs.StringSliceVar(&s.EnabledControllers, "controllers", defaultEnabledControllers, ""+
"The set of controllers to enable.")
fs.StringSliceVar(&s.DisabledControllers, "disabled-controllers", defaultDisabledControllers, ""+
"The set of controllers to disable. Supersedes --controllers.")
Copy link
Member

Choose a reason for hiding this comment

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

nit: I'm not sure if "supersedes" is the right word here:

supersede: take the place of (a person or thing previously in authority or use); supplant.

I first read the comment as meaning:

"The set of controllers to disable. Replaces --controllers."

But it doesn't really replace --controllers, since EnabledControllers is still used. Maybe:

"The set of controllers to disable. Takes priority over --controllers."

@JoshVanL
Copy link
Contributor Author

Is this the same approach that kube-controller-manager takes for disabling controllers? I thought we could prefix the name of a controller with a - in the list of --controllers, but perhaps I am wrong..

Thanks, I'll add the same behaviour encoded here https://github.com/kubernetes/controller-manager/blob/385c02a3964be0e326cc5803e410aa1028939249/options/generic.go#L97

@jetstack-bot jetstack-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 24, 2021
Copy link
Contributor
@irbekrm irbekrm left a comment

Choose a reason for hiding this comment

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

Looks good to me!

I have one request to remove the remaining bit from --disabled-controllers flag and two optional suggestions that could be ignored, otherwise happy to lgt/approve this.

I have tried deploying this with various options and seemed working well.
(The disabled controllers seem to take preference as if I pass both -foo and foo it ends up being disabled.)

@JoshVanL JoshVanL changed the title Adds a cert-manager-controller flag to disable controllers, for example, the certificaterequests-approver Enables disabling enabled cert-manager-controller controllers Mar 25, 2021
Copy link
Contributor
@irbekrm irbekrm left a comment

Choose a reason for hiding this comment

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

Looks good to me!

I've tried to deploy with the latest change passing the flag.
Output showing enabled controllers:

cert-manager/controller "msg"="enabled controllers: map[CertificateIssuing:{} CertificateKeyManager:{} CertificateMetrics:{} CertificateReadiness:{} CertificateRequestManager:{} CertificateTrigger:{} certificaterequests-issuer-acme:{} certificaterequests-issuer-ca:{} certificaterequests-issuer-selfsigned:{} certificaterequests-issuer-vault:{} certificaterequests-issuer-venafi:{} challenges:{} clusterissuers:{} ingress-shim:{} issuers:{} orders:{}]"  

@jetstack-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: irbekrm, JoshVanL

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

@irbekrm
Copy link
Contributor
irbekrm commented Mar 26, 2021

Feel free to unhold when ready to merge 😄

/retest
/hold
/lgtm

@jetstack-bot jetstack-bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm Indicates that a PR is ready to be merged. labels Mar 26, 2021
@irbekrm
Copy link
Contributor
irbekrm commented Mar 26, 2021

oh that's a genuine failure https://prow.build-infra.jetstack.net/view/gcs/jetstack-logs/pr-logs/pull/jetstack_cert-manager/3791/pull-cert-manager-bazel/1375387357871607808

@JoshVanL JoshVanL force-pushed the cert-manager-controller-diabled-controllers-flag branch from ad69d39 to e810a11 Compare March 26, 2021 10:25
@jetstack-bot jetstack-bot removed the lgtm Indicates that a PR is ready to be merged. label Mar 26, 2021
@JoshVanL
Copy link
Contributor Author

@irbekrm Should be good to look at again

@JoshVanL JoshVanL added this to the v1.3 milestone Mar 26, 2021
@irbekrm
Copy link
Contributor
irbekrm commented Mar 26, 2021

🥳
/lgtm

@jetstack-bot jetstack-bot added the lgtm Indicates that a PR is ready to be merged. label Mar 26, 2021
@irbekrm
Copy link
Contributor
irbekrm commented Mar 26, 2021

/hold cancel

@jetstack-bot jetstack-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 26, 2021
the certificaterequests-approver

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
same behaviour as kube-controller-manager

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
log enabled controllers on start

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
@JoshVanL JoshVanL force-pushed the cert-manager-controller-diabled-controllers-flag branch from e810a11 to 8f5b034 Compare March 26, 2021 11:31
@jetstack-bot jetstack-bot removed the lgtm Indicates that a PR is ready to be merged. label Mar 26, 2021
@JoshVanL
Copy link
Contributor Author

/retest

@irbekrm
Copy link
Contributor
irbekrm commented Mar 26, 2021

/lgtm

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/deploy Indicates a PR modifies deployment configuration dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. kind/feature Categorizes issue or PR as related to a new feature. lgtm 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. 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.

6 participants
0