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

Closes #102: Make max backoff interval configurable #106

Merged
merged 2 commits into from
Aug 30, 2022

Conversation

caueasantos
Copy link
Contributor

@caueasantos caueasantos commented Apr 15, 2022

Description of the change:

Closes #102
This pull requests aims to give users the ability of specifying custom duration intervals between attempts to become the leader. I tried to keep this change extremely simple exporting a new field to the become's Option.

Motivation for the change:

The 16s hard-coded interval between attempts might cause unnecessary leaderless time during deployment. For example, we have a homemade crons solution responsible for handling jobs scheduling and we noticed a gap of jobs that have not been triggered here and there throughout the day as a result of a few seconds without a leader. Reducing the interval to become a leader should consistently prevent that from happening.

* Renamed maxBackoffInterval constant
* Added MaxBackoffInterval field into Config
* Check if duration interval to become a leader is meaningful

Fixes operator-framework#102
@openshift-ci openshift-ci bot requested review from hasbro17 and jmrodri April 15, 2022 00:06
@openshift-ci
Copy link

openshift-ci bot commented Apr 15, 2022

Hi @caueasantos. Thanks for your PR.

I'm waiting for a operator-framework 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/test-infra repository.

@openshift-ci openshift-ci bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 15, 2022
@jmrodri
Copy link
Member

jmrodri commented Apr 16, 2022

/ok-to-test

@openshift-ci openshift-ci bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 16, 2022
@coveralls
Copy link

Pull Request Test Coverage Report for Build 2170237167

  • 3 of 4 (75.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.07%) to 80.965%

Changes Missing Coverage Covered Lines Changed/Added Lines %
leader/leader.go 3 4 75.0%
Totals Coverage Status
Change from base Build 2064088101: 0.07%
Covered Lines: 621
Relevant Lines: 767

💛 - Coveralls

@caueasantos
Copy link
Contributor Author

@jmrodri Have I done something wrong? The CI errors seems not related to the changes and I'm not too sure how to move forward. What do you suggest?

@openshift-bot
Copy link

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 10, 2022
@caueasantos
Copy link
Contributor Author

/remove-lifecycle stale

@openshift-ci openshift-ci bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 10, 2022
@caueasantos
Copy link
Contributor Author

@jmrodri Can I get a review of this please? 🙏🏼

Copy link
Member

@jmrodri jmrodri left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 30, 2022
Copy link
Member

@varshaprasad96 varshaprasad96 left a comment

Choose a reason for hiding this comment

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

/lgtm
@caueasantos Thanks for the PR! The change looks good. Just curious on the reason why you are using leader election from this repository? This follows the leader for life approach, which we may deprecate (not sure when) in near future, since SDK has moved to using controller-runtime's leader for lease.

@joelanford
Copy link
Member

/approve

@openshift-ci
Copy link

openshift-ci bot commented Aug 30, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: joelanford

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 30, 2022
@openshift-merge-robot openshift-merge-robot merged commit 58f9b32 into operator-framework:main Aug 30, 2022
@caueasantos
Copy link
Contributor Author

/lgtm @caueasantos Thanks for the PR! The change looks good. Just curious on the reason why you are using leader election from this repository? This follows the leader for life approach, which we may deprecate (not sure when) in near future, since SDK has moved to using controller-runtime's leader for lease.

/lgtm @caueasantos Thanks for the PR! The change looks good. Just curious on the reason why you are using leader election from this repository? This follows the leader for life approach, which we may deprecate (not sure when) in near future, since SDK has moved to using controller-runtime's leader for lease.

No specific reason 😄 I'm going to take look and see if we can migrate it. Thank you

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. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configurable max backoff interval in leader-for-life
7 participants