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

Always emit the stopped leading event #111652

Merged
merged 1 commit into from Jan 23, 2023

Conversation

ash2k
Copy link
Member

@ash2k ash2k commented Aug 3, 2022

What type of PR is this?

/kind feature
/sig api-machinery

What this PR does / why we need it:

Currently my program emits only the became leader events and never stopped leading:

24m         Normal    LeaderElection            lease/agent-4-lock          pod-name became leader
19m         Normal    LeaderElection            lease/agent-4-lock          pod-name became leader
18m         Normal    LeaderElection            lease/agent-4-lock          pod-name became leader
17m         Normal    LeaderElection            lease/agent-4-lock          pod-name became leader
2m49s       Normal    LeaderElection            lease/agent-4-lock          pod-name became leader

I think it'd be good to also always emit the stopped leading event when program cleanly stops and aborts the leader elector (via context).

Does this PR introduce a user-facing change?

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/feature Categorizes issue or PR as related to a new feature. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Aug 3, 2022
@cici37
Copy link
Contributor

cici37 commented Aug 4, 2022

/assign @jiahuif
Would you mind looking at this one? Thank you
/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Aug 4, 2022
@ash2k
Copy link
Member Author

ash2k commented Oct 11, 2022

/assign @mikedanese

@ash2k ash2k force-pushed the ash2k/leader-elector-tweaks branch 2 times, most recently from 8557240 to a67bcd9 Compare October 12, 2022 09:53
@ash2k
Copy link
Member Author

ash2k commented Dec 19, 2022

ping @aojea :) I really want to get this merged, it has missed a few releases already.

@aojea
Copy link
Member

aojea commented Dec 19, 2022

can you add an unit test to assert this behavior?

@ash2k ash2k force-pushed the ash2k/leader-elector-tweaks branch from a67bcd9 to 33da2c6 Compare December 20, 2022 02:31
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Dec 20, 2022
@ash2k
Copy link
Member Author

ash2k commented Dec 20, 2022

/retest

@ash2k
Copy link
Member Author

ash2k commented Dec 20, 2022

@aojea Tests added.

@ash2k
Copy link
Member Author

ash2k commented Dec 29, 2022

ping @aojea

@ash2k ash2k requested review from aojea and removed request for ingvagabund and deads2k January 19, 2023 07:56
@aojea
Copy link
Member

aojea commented Jan 22, 2023

totally slipped, thanks
one comment but overall lgtm

/lgtm

/assign @liggitt @wojtek-t

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

LGTM label has been added.

Git tree hash: b0387c150cfd78b09a257ac13b51edba0b94190c

Copy link
Member

@wojtek-t wojtek-t left a comment

Choose a reason for hiding this comment

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

One small comment, but overall thanks for fixing it!

@ash2k ash2k force-pushed the ash2k/leader-elector-tweaks branch from 33da2c6 to 771ab74 Compare January 23, 2023 10:08
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 23, 2023
@wojtek-t
Copy link
Member

/lgtm
/approve

Thanks!

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

LGTM label has been added.

Git tree hash: 0585de64cdf55c2f47f8bc3ab6dddc220542c72d

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ash2k, wojtek-t

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 23, 2023
@ash2k
Copy link
Member Author

ash2k commented Jan 23, 2023

/retest

1 similar comment
@ash2k
Copy link
Member Author

ash2k commented Jan 23, 2023

/retest

@k8s-ci-robot k8s-ci-robot merged commit f21c603 into kubernetes:master Jan 23, 2023
@k8s-ci-robot k8s-ci-robot added this to the v1.27 milestone Jan 23, 2023
@ash2k ash2k deleted the ash2k/leader-elector-tweaks branch January 23, 2023 22:50
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. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants