K8SPXC-1805 make election params configurable#2403
Open
nmarukovich wants to merge 23 commits intomainfrom
Open
K8SPXC-1805 make election params configurable#2403nmarukovich wants to merge 23 commits intomainfrom
nmarukovich wants to merge 23 commits intomainfrom
Conversation
egegunes
previously approved these changes
Mar 18, 2026
…ator into K8SPXC-1805_make_election_params_configurable
…b.com:percona/percona-xtradb-cluster-operator into K8SPXC-1805_make_election_params_configurable
egegunes
requested changes
Apr 2, 2026
cmd/manager/main.go
Outdated
Comment on lines
+269
to
+271
| LeaseDuration time.Duration `default:"60s" envconfig:"PXCO_LEADER_ELECTION_LEASE_DURATION"` | ||
| RenewDeadline time.Duration `default:"40s" envconfig:"PXCO_LEADER_ELECTION_RENEW_DEADLINE"` | ||
| RetryPeriod time.Duration `default:"10s" envconfig:"PXCO_LEADER_ELECTION_RETRY_PERIOD"` |
Contributor
There was a problem hiding this comment.
should we change these defaults to reflect the values in manifest files?
…b.com:percona/percona-xtradb-cluster-operator into K8SPXC-1805_make_election_params_configurable
egegunes
reviewed
Apr 3, 2026
Makefile
Outdated
| # the 'latest' tag sometimes resolves to an older or incompatible version, | ||
| # leading to test or pipeline failures. | ||
| ENVTEST_K8S_VERSION = 1.34.1 | ||
| ENVTEST_VERSION ?= release-0.23 |
Contributor
There was a problem hiding this comment.
this looks like a duplicate?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CHANGE DESCRIPTION
Problem:
This PR exposes the following operator options through env vars:
PXCO_LEADER_ELECTION_LEASE_NAME - determines the name of the resource that leader election will use for holding the leader lock
PXCO_LEADER_ELECTION_LEASE_DURATION - duration that non-leader candidates will wait to force acquire leadership. This is measured against time of last observed ack
PXCO_LEADER_ELECTION_RENEW_DEADLINE - duration that the acting controlplane will retry refreshing leadership before giving up
PXCO_LEADER_ELECTION_RETRY_PERIOD - duration the LeaderElector clients should wait between tries of actions
PXCO_LEADER_ELECTION_ENABLED - disable/enable leader election
Suggested defaults:
PXCO_LEADER_ELECTION_LEASE_DURATION: 60s
PXCO_LEADER_ELECTION_RENEW_DEADLINE: 40s
PXCO_LEADER_ELECTION_RETRY_PERIOD: 10s
PXCO_LEADER_ELECTION_ENABLED: true
Additionally, all os.Getenv calls in cmd/manager/main.go are refactored to use github.com/kelseyhightower/envconfig with a single envConfig struct, consistent with the PG operator implementation (K8SPG-915).
Cause:
Short explanation of the root cause of the issue if applicable.
Solution:
Short explanation of the solution we are providing with this PR.
CHECKLIST
Jira
Needs Doc) and QA (Needs QA)?Tests
compare/*-oc.yml)?Config/Logging/Testability