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

Adjust static "helm-controller" name references to use controllerName #260

Merged
merged 5 commits into from
Jan 23, 2025

Conversation

mallardduck
Copy link
Contributor

Follow up PR to: #258

This is a more simple change that's still helpful after my confusion around the lease mechanism was clarified.

pkg/controllers/controllers.go Outdated Show resolved Hide resolved
pkg/controllers/controllers.go Outdated Show resolved Hide resolved
@@ -106,7 +108,8 @@ func Register(ctx context.Context, systemNamespace, controllerName string, cfg c
klog.Infof("Starting helm controller in namespace %s", systemNamespace)
}

leader.RunOrDie(ctx, systemNamespace, "helm-controller-lock", appCtx.K8s, func(ctx context.Context) {
controllerLockName := controllerName + "-lock"
leader.RunOrDie(ctx, systemNamespace, controllerLockName, appCtx.K8s, func(ctx context.Context) {
Copy link
Member

Choose a reason for hiding this comment

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

I suspect that if systemNamespace is blank here, the lock will actually go into the default namespace? But we should validate that, and perhaps allow configuring the lock namespace separate from the watched namespace?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that is correct - if systemNamespace is blank the underlying leader.RunOrDie will try to use kube-system (which is the default in this case).

perhaps allow configuring the lock namespace separate from the watched namespace?

I'm open to that, I can see some use-cases where that could be useful. Save that for a follow up effort in a new PR? I'd imagine that's introducing a new cli flag (and env var) to control that?

Copy link
Member

Choose a reason for hiding this comment

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

yep!

mallardduck and others added 3 commits January 21, 2025 17:01
Co-authored-by: Brad Davidson <[email protected]>
Signed-off-by: Dan P. <[email protected]>
Co-authored-by: Brad Davidson <[email protected]>
Signed-off-by: Dan P. <[email protected]>
Comment on lines 104 to 106
klog.Info("Starting helm controller with no namespace")
} else {
klog.Infof("Starting helm controller in namespace %s", systemNamespace)
klog.Infof("Starting %s in namespace %s", controllerName, systemNamespace)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should clarify these... for namespace %s and for all namespaces with lock in %s or something like that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh I like that idea a lot. Nice.

Copy link
Contributor Author

@mallardduck mallardduck Jan 21, 2025

Choose a reason for hiding this comment

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

Updated them now - until we add the feature to control lock namespace that's just a string. Once we add it we can swap that string for the variable lockNamespace (or w/e is implemented).

@mallardduck mallardduck force-pushed the adjust-lock-for-controller-name branch from 2807358 to 7e93b23 Compare January 21, 2025 22:15
pkg/controllers/controllers.go Outdated Show resolved Hide resolved
Signed-off-by: Dan Pock <[email protected]>
@mallardduck mallardduck force-pushed the adjust-lock-for-controller-name branch from 7e93b23 to 7917893 Compare January 21, 2025 22:22
@mallardduck mallardduck requested a review from brandond January 21, 2025 22:23
Copy link
Member

@brandond brandond left a comment

Choose a reason for hiding this comment

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

lgtm, lets squash when merging.

@mallardduck
Copy link
Contributor Author

lgtm, lets squash when merging.

I don't have access to merge here currently, I'm happy to join the effort and do the needful to gain access. Just not sure what that looks like, if can let me know? (feel free to start that thread in slack if that make sense) Either way, I'm happy this PR is good to go for whenever someone with merge access is ready to launch. 🥂

@brandond brandond merged commit c439ac3 into k3s-io:master Jan 23, 2025
2 checks passed
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.

2 participants