-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Set LeaderElectionResourceLock
to leases
on (new) scaffolded main.go
#2604
Comments
HI @AlmogBaku, Thank you for your contribution and suggestion to move in this direction. // LeaderElectionResourceLock determines which resource lock to use for leader election,
// defaults to "configmapsleases". **Change this value only if you know what you are doing.**
// Otherwise, users of your controller might end up with multiple running instances that
// each acquired leadership through different resource locks during upgrades and thus
// act on the same resources concurrently. Then see:
Also, it is not the far away:
To do this change in the scaffold would also mean alerting the users about the need to properly migrate their solutions which IHMO would only fit well in a migration guide and we need to alert them about all. WHY? Many users will check the changes made in the scaffolds between the minor bumps of the Kubebuilder CLI and since we are not releasing major changes that will safely update their projects with what changed in the scaffolds. This scenario shows that could be problematic when they do not know what they are doing. Also, I think would be very helpful if we get inputs from controller runtime before we try to change the default scaffolds on Kubebuilder to use any option that is not the default value. Then I'd like to suggest you begin with a thread in the controller-runtime channel and link it here, e.g.: Thread to gather inputsNote that the goal is to understand and know all that we need to do or not and if we should move in this direction. Today the Kubebuilder scaffolds the default option for LeaderElectionResourceLock which uses However, before we do so. Would be nice to understand with you folks all the pros/cons and get the current issues, docs and etc that we can use there to provide accurate info for users. It shows for me, that the first step is we have the following info:
Note that we will need to provide the answers to all these questions for Kubebuilder users in order to move in this direction and also produces good documentation that covers it in KB. So could that fit better under a new scaffold such as go/v4-alpha and not in the stable plugin? Could it be +1 change to address in the alpha instead where authors will expect major changes and plan to act on them? Did you make that already? Have you all the above answers to supplement this RFE? |
This suggestion is only for new scaffolded projects. This way, changing it will not impact older versions that need to migrate (because it's new!) a.
Do we have users that actually do that? that sounds a bit crazy. The code is evolving and changing and getting out of sync with the original scaffolded code. b. Since you already wrote the whole "discussion thread" - I'm linking this issue on the slack instead ;-) This will also help us to document this discussion for further reference. |
For those who already scaffold the project using the old versions and want to update their project to what is new, changed in a new version we must provide guidance.
Yes, and it is not crazy. New releases of stable plugins ought to have new features and bug fixes. The Kubebuilde CLI/API as all plugins provided by it respect semver : https://semver.org/. Consumers does not expect to be affected if they decide to update their projects with what changed between MINOR releases. Additionally, note that:
PS.: Plugins/layouts provided are very mature and stable and are kept for long periods. So, if users do not keep the project updated in the MINOR releases and wait for a major bump to do that it could means usually more than a year to be done.
From v2 to v3 we introduce MAJOR changes: user follows the migration guide: https://book.kubebuilder.io/migration/v2vsv3.html and we have a policy that ensures that any stable plugin does not suffer breaking changes: https://github.com/kubernetes-sigs/kubebuilder/blob/master/docs/book/src/plugins/plugins-versioning.md. Also, if you use the tool to do the scaffolds and help you out, you probably might want to stick with the layout proposed to make it easier to keep your project upgradable with the latest changes and not do changes that might break its helpers. However, if you decide to change everything completed you are still able to check what changed from one version to another very easily by just diff the samples under the test data directory between the tags release. For example, if you want to check what were the bug fixes, changes, and additions between the release 3.0.0 to 3.1.0 you can compare the sample on both and check it. |
@AlmogBaku we might be able to begin by looking in C+R to find the PR that introduces the changes and the linked issues. It might have a lot of what we need to begin to check already. WDYT? Could you help us here by gathering all info first? |
Sure. |
It seems that @joelanford already updated this in master to be
In his commit: kubernetes-sigs/controller-runtime@6c4d947 I'm not sure why is it not part of the controller-runtime 0.11.2 though? |
Hi @AlmogBaku, Following the comments inline.
So then when we bump Kubebuilder go/v3 plugin to use the new controller-runtime version its users will be able to check that the controller-runtime latest version address breaking changes and that they need be careful as well. For Kubebuilder we will also need to make it very clear in the release notes when we bump this controller-runtime version so that, we can help its users be aware of and properly deal with the scenario. The PR kubernetes-sigs/controller-runtime#1773 contains helpful information and I think we will need to highlight that.
Because 0.11.2 is a patch release. So that, follow semver we have only bugs addressed in z stream releases. We should address a breaking change in a z release. Additionally, as shared in another RFE raised by you: Kubebuilder provides a scaffold based on the default controller runtime configuration. We have no intention of adding optional features and options that should be used to address specific needs to the default scaffold. That goes against its goals Ditto so, I do NOT agree that we should change the default scaffold to pass this option as requested here. |
I agree. Since this is going to be pushed to ctrl-runtime, we can close it |
What do you want to happen?
configmapsleases
) that was aimed to help existing controllers with the migration (and avoid a dual lock when upgrading the controllers)Given the above, it's safe to configure
LeaderElectionResourceLock: "leases"
as the default configuration for newer projects(when scaffoldingmain.go
)/hold until triage
/assign @AlmogBaku
References
kubernetes/kubernetes#80289
Extra Labels
No response
The text was updated successfully, but these errors were encountered: