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

Proposal: Naming consistency for leader election lock options #2636

Closed
ahmetb opened this issue Jan 5, 2024 · 5 comments
Closed

Proposal: Naming consistency for leader election lock options #2636

ahmetb opened this issue Jan 5, 2024 · 5 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@ahmetb
Copy link
Member

ahmetb commented Jan 5, 2024

This is probably a very minor naming suggestion but when I first started out using controller-runtime, the LeaderElectionNamespace option's identifier confused me a bit as to what it does and made me look under the covers to see how it is used.

I think clarifying this as follows would address the problem:

@@ -176,13 +176,13 @@ type Options struct {
 	// act on the same resources concurrently.
 	LeaderElectionResourceLock string
 
-	// LeaderElectionNamespace determines the namespace in which the leader
+	// LeaderElectionLockNamespace determines the namespace in which the leader
-	// election resource will be created.
+	// election lock resource will be created.
-	LeaderElectionNamespace string
+	LeaderElectionLockNamespace string
 
-	// LeaderElectionID determines the name of the resource that leader election
+	// LeaderElectionLockID determines the name of the resource that leader election
 	// will use for holding the leader lock.
-	LeaderElectionID string
+	LeaderElectionLockID string
 
 	// LeaderElectionConfig can be specified to override the default configuration
 	// that is used to build the leader election client.

If we go through with this, I think changing LeaderElectionLockIDLeaderElectionLockName would be quite useful as well (since ID is not the Kubernetes term for unique resource names).

I understand these names have been there since the inception, but since I observed this repo regularly changes Options structs (and this is particularly not a troublesome migration), I'm proposing this. Thoughts?

/kind feature

@troy0820
Copy link
Member

troy0820 commented Jan 5, 2024

Would we target this for v0.17 or v0.18?

Naming would provide clarity if that's the intent and not change any functionality. I agree that being concise may help future users around the unclear options are defined.

/kind feature

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Jan 5, 2024
@ahmetb
Copy link
Member Author

ahmetb commented Jan 5, 2024

This is a breaking change so we'd probably target the next minor version?
Since the direction sounds good, following up with a patch: #2637.

@troy0820
Copy link
Member

troy0820 commented Jan 7, 2024

Should this be closed because of the comments in the PR?

Are we closing the PR?

@ahmetb @alvaroaleman

@ahmetb
Copy link
Member Author

ahmetb commented Feb 7, 2024

Yeah let's close this. Benefits are minimal.
/close

@k8s-ci-robot
Copy link
Contributor

@ahmetb: Closing this issue.

In response to this:

Yeah let's close this. Benefits are minimal.
/close

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants