-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
KEP-2835: Add Prioritized Leader Election KEP #2836
Conversation
Hi @howardjohn. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the 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. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: howardjohn The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/assign @jiahuif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/ok-to-test
@howardjohn: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
|
||
### Non-Goals | ||
|
||
* User prioritized leader election in Kubernete's maintained controllers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the sig call, I think we decided that this should probably be a goal and it would benefit cases of upgrades with a weight for latest version.
HolderKey string `json:"holderKey"` | ||
} | ||
|
||
type LeaseSpec struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the API, I think we want to indicate what the weighting function is and an integer weight. That allows for different versions of a controller-manager to change its weighting function and for other leaders to be able to make an intelligent decision about what to do when they don't understand that weighting function.
For instance, when the lease is expired, old clients that do not understand the weighting function could still take the lease and simply indicate a weight of 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I didn't understand this in the call but I get it now. I am not sure an integer will support all cases.
Some examples
Newest version wins (string):
example key: v1.8.1
example key comparison function: return semver(myVersion).NewerThan(semver(existingKey)
Newest version wins (int):
example key: 8
(attempt to look at only the minor version
example key comparison function: return myVersion > existingKey
The issue with int here is we are trying to encode a SemVer into a single integer. There are ways around this, but not a good one. For example, if we later need to distinguish beyond minor version we cannot.
Selected controller wins (our primary use case
string:
example key: my-controller-identifier
example key comparison function: return existingKey != selectedIdentifier && myIdentifier == selectedIdentifier
(where selectedIdentifier is determined out-of-band)
int: not really possible
Select geographically closest controller
string:
example key: us-west
example key comparison function: return myKey is closer to TargetRegion than existingKey
int: not really possible unless we encode each region as an integer
// | ||
// KeyComparison functions should ensure they handle an empty existingKey, as "key" is not a required field. | ||
// | ||
// Warning: when a lock is stolen (from KeyComparison returning true), the old leader may not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since lease stealing will no longer be rare, I think avoiding a condition of having two leaders should be a goal. I think it's just a matter of waiting for a period longer than the LeaderElectionConfig.RetryPeriod, which would mean exposing that duration somewhere.
// leadership even if their is another un-expired leader. | ||
// | ||
// This can be used to implemented a prioritized leader election. For example, if multiple | ||
// versions of the same application run simultaneously, we can ensure the newest version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens in a scenario where the old client understands the key, its key is lower in priority but there is no current leader? Should the old client be able to acquire the lock? Maybe having a leader with lower priority is better than no leader?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is no current leader all clients will attempt to become the leader. Consider a case with two clients, priority=low and priority=high.
Case 1: p=low wins the election, and immediately is evicted by p=high when it takes over
Case 2: p=high wins the election
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close |
@k8s-triage-robot: Closed this PR. In response to this:
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. |
One-line PR description: Add initial data for KEP-2835
Issue link: Prioritized leader election #2835