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 flags to configure LeaseDuration and RenewDeadline #385

Merged
merged 1 commit into from
Jul 17, 2024

Conversation

jabdoa2
Copy link
Contributor

@jabdoa2 jabdoa2 commented Jul 15, 2024

This change will prevent trust-manager from restart looping when kube API server is (over-)loaded. Most kubernetes operators increase this value as the default (15s) is too low under load.

@cert-manager-prow cert-manager-prow bot added dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 15, 2024
@cert-manager-prow
Copy link
Contributor

Hi @jabdoa2. Thanks for your PR.

I'm waiting for a cert-manager member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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-sigs/prow repository.

@cert-manager-prow cert-manager-prow bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jul 15, 2024
@erikgb
Copy link
Contributor

erikgb commented Jul 15, 2024

Thanks, @jabdoa2! I think it makes sense to allow these values to be configured. WDYT?

@jabdoa2
Copy link
Contributor Author

jabdoa2 commented Jul 15, 2024

Thanks, @jabdoa2! I think it makes sense to allow these values to be configured. WDYT?

done.

@cert-manager-prow cert-manager-prow bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jul 15, 2024
@erikgb
Copy link
Contributor

erikgb commented Jul 15, 2024

/ok-to-test

@cert-manager-prow cert-manager-prow bot added ok-to-test and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 15, 2024
Copy link
Contributor

@erikgb erikgb left a comment

Choose a reason for hiding this comment

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

I think the flags should be given a bit more context. The suggested flag names are consistent with the equivalent flags in cert-manager.

cmd/trust-manager/app/options/options.go Outdated Show resolved Hide resolved
cmd/trust-manager/app/options/options.go Outdated Show resolved Hide resolved
@inteon inteon changed the title increase LeaseDuration and RenewDeadline Add LeaseDuration and RenewDeadline flags Jul 15, 2024
@inteon inteon changed the title Add LeaseDuration and RenewDeadline flags Add flags to configure LeaseDuration and RenewDeadline Jul 15, 2024
@@ -187,6 +194,14 @@ func (o *Options) addAppFlags(fs *pflag.FlagSet) {
"readiness-probe-path", "/readyz",
"HTTP path to expose the readiness probe server.")

fs.DurationVar(o.LeaseDuration,
"lease-duration", time.Second*60,
Copy link
Member

Choose a reason for hiding this comment

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

Let's start with making these durations configurable without changing the defaults.
In another PR, we can increase these values and discuss if that makes sense there.

Copy link
Contributor Author

@jabdoa2 jabdoa2 Jul 15, 2024

Choose a reason for hiding this comment

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

Ok will change that. Those defaults are really bad though. Even very mainstream controller (i.e. nginx-ingress) increase this by default (nginx-ingress does 30s renew for example).

cmd/trust-manager/app/options/options.go Outdated Show resolved Hide resolved
cmd/trust-manager/app/options/options.go Outdated Show resolved Hide resolved
Copy link
Contributor

@erikgb erikgb left a comment

Choose a reason for hiding this comment

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

/approve

Changes looks good to me. Can you try to figure out why CI is failing and squash commits, please @jabdoa2?

@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 Jul 15, 2024
@jabdoa2
Copy link
Contributor Author

jabdoa2 commented Jul 16, 2024

/approve

Changes looks good to me. Can you try to figure out why CI is failing and squash commits, please @jabdoa2?

Test is fixed and commits are squashed. Should be good to go.

@@ -74,12 +75,16 @@ func NewCommand() *cobra.Command {
eventBroadcaster.StartLogging(func(format string, args ...any) { mlog.V(3).Info(fmt.Sprintf(format, args...)) })
eventBroadcaster.StartRecordingToSink(&clientv1.EventSinkImpl{Interface: cl.CoreV1().Events("")})

renewDeadline := time.Second * 10
leaseDuration := time.Second * 15
Copy link
Contributor

Choose a reason for hiding this comment

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

While the tests are now green, we are not using the new flags. 😁 Can you try to fix this please, @jabdoa2?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ups. Left over from my tests. Will fix that. Sorry

Signed-off-by: Jan Kantert <jan-mpf@kantert.net>
Co-authored-by: Erik Godding Boye <egboye@gmail.com>
Copy link
Contributor

@erikgb erikgb left a comment

Choose a reason for hiding this comment

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

Thanks, @jabdoa2! 🚀

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: erikgb

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 merged commit f910537 into cert-manager:main Jul 17, 2024
6 checks passed
@jabdoa2 jabdoa2 deleted the robust_leader_election branch July 19, 2024 11:34
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. ok-to-test size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants