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

[features] Leader election + KUBERNETES_NAMESPACE environment variable #19

Merged
merged 6 commits into from
Dec 9, 2024

Conversation

domq
Copy link
Member

@domq domq commented Dec 9, 2024

Pair-programmed with @Azecko, @ponsfrilus and @obieler.

  • Elect a leader using kubernetes.leaderelection and a ConfigMap (given that we cannot yet use the proper Lease objects)
  • This effectively forces the operator into single-namespace mode, since ConfigMaps (and Leases) are namespaced objects. Ensure that the user stipulated a namespace, either through the KUBERNETES_NAMESPACE environment variable (which has priority) or through one of the --namespace=foo, -namespace foo or -n foo command-line flag combos

obieler and others added 6 commits December 9, 2024 15:22
- `onstarted_leading` ⇒ `sys.exit(kopf.cli.main()`
- `onstopped_leading` ⇒ Exit immediately
This presumably avoids a situation whence Kopf only gets to run every 5 seconds...
…econds

Subclassing is the way, since unfortunately everything the `LeaderElection` superclass logs is at `.info()` level
@ponsfrilus ponsfrilus self-requested a review December 9, 2024 15:34
Copy link
Member

@ponsfrilus ponsfrilus left a comment

Choose a reason for hiding this comment

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

LGTM

@domq domq merged commit dcf1eda into main Dec 9, 2024
@domq domq deleted the feature/leaderselector branch December 9, 2024 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants