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

LeaderElection: Lease resource left behind #4638

Closed
katheris opened this issue Dec 2, 2022 · 2 comments · Fixed by #4866
Closed

LeaderElection: Lease resource left behind #4638

katheris opened this issue Dec 2, 2022 · 2 comments · Fixed by #4866
Assignees
Milestone

Comments

@katheris
Copy link

katheris commented Dec 2, 2022

Describe the bug

There is currently no way to have Lease resources automatically cleaned up. There should be a mechanism to provide an owner reference.

Fabric8 Kubernetes Client version

SNAPSHOT

Steps to reproduce

  1. Use the client.LeaderElector() function to create a Leader election process.
  2. When the application that called this function is no longer running the Lease resource is left behind

Expected behavior

There should be a mechanism to get this Lease resource cleaned up.

Runtime

minikube

Kubernetes API Server version

1.25.3@latest

Environment

macOS

Fabric8 Kubernetes Client Logs

No response

Additional context

No response

@shawkins
Copy link
Contributor

shawkins commented Feb 2, 2023

The initial thought was to allow the user to set an owner reference as part of the LeaderElectionConfig. However this functionality is not part of the go client, and given that a likely owner (a Deployment) can be deleted before their underlying pods are fully terminated this leaves open some potentially odd behavior while things are cleaning up (at best the lock would go away, then fail to recreate as the owner no longer exists). I cannot come up with a better built-in alternative though. Any other thoughts from the fabric8 community?

@manusa manusa modified the milestones: 6.5, 6.5.0 Feb 6, 2023
shawkins added a commit to shawkins/kubernetes-client that referenced this issue Feb 10, 2023
shawkins added a commit to shawkins/kubernetes-client that referenced this issue Feb 10, 2023
shawkins added a commit to shawkins/kubernetes-client that referenced this issue Feb 10, 2023
also adding a leadership integration test
@shawkins
Copy link
Contributor

@katheris the proposal in the pr is to give the user full control over the ObjectMeta used to create the lock in the Lease or ConfigMap lock constructor, does this seem like a good solution for you?

shawkins added a commit to shawkins/kubernetes-client that referenced this issue Feb 13, 2023
also adding a leadership integration test
shawkins added a commit to shawkins/kubernetes-client that referenced this issue Feb 13, 2023
also adding a leadership integration test
manusa pushed a commit to shawkins/kubernetes-client that referenced this issue Feb 28, 2023
manusa pushed a commit to shawkins/kubernetes-client that referenced this issue Feb 28, 2023
manusa pushed a commit to shawkins/kubernetes-client that referenced this issue Feb 28, 2023
manusa pushed a commit that referenced this issue Feb 28, 2023
manusa pushed a commit that referenced this issue Feb 28, 2023
also adding a leadership integration test
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 a pull request may close this issue.

3 participants