-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Add cli flag for leader-election-resource-lock
#8107
Conversation
@shafeeqes: This issue is currently awaiting triage. If Ingress contributors determines this is a relevant issue, they will accept it by applying the The 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. |
Welcome @shafeeqes! |
Hi @shafeeqes. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
/ok-to-test |
/test pull-ingress-nginx-codegen |
/assign @rikatz |
ConfigMapMeta: metav1.ObjectMeta{Namespace: k8s.IngressPodDetails.Namespace, Name: config.ElectionID}, | ||
Client: config.Client.CoreV1(), | ||
LockConfig: resourcelock.ResourceLockConfig{ | ||
//TODO: Switch configmapsleases to leases in the next version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would like to ask for a soft transition here, let me explain:
- Test if we CAN use Leases, then we use it.
- If not, test if we can use ConfigMapLeases, then we use it
- Finally, if everything goes wrong, fallback to ConfigMapLock
This way, users that already rely on ConfigMap wont need to change/break their environment. Forcefully changing to Leases
may break environments where the admins just update the image, and not the Roles, etc.
Makes sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not get completely what you are suggesting. First, leaderelection should try to acquire resourcelock using leases
, and if it fails, try configmapleases
, and then configmaps
?
Please explain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH, admins not updating the Roles does not feel like a reason enough to me. We will be mentioning that in the release notes, so admins should be noticing that and acting accordingly.
And anyways if we delay this too, after we revendor K8s, we have to get rid of the old resourcelocks.
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shafeeqes this is true in theory, but not in practice and we must be empathetic with the admins on this :)
As a previous admin, I know that sometimes in a rush we simply update the image. This is a breaking change from the users perspective. If someone just update the image on a cluster previously created with old manifests (instead of reapplying all the manifests, and well, kubectl set image
is here for that!) Ingress wont start, and this may lead into their ingresses being unavailable.
So, my suggestion is:
- Test if ingress can do a get/update/list/watch on leases. If so, let's use it
- Otherwise, fallback to the previously working scenario.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about exposing a CLI flag similar to --election-id
for configuring the lock type? This would prevent this fake call to check whether the nginx-ingress pod has required privilege and it would also decouple the leader election lock migration from nginx-ingress releases. Users of nginx-ingress can configure this as they want when they are ready (i.e., when they have provided the required RBAC privileges).
/retest Thanks! |
773fc59
to
797b190
Compare
797b190
to
8e5cec4
Compare
0190105
to
f4b149b
Compare
f4b149b
to
40327fc
Compare
@rikatz I have pushed the code changes as discussed. PTAL. |
ingress-nginx
resourcelock to configmapleases
leader-election-resource-lock
075b135
to
2fdaefe
Compare
/lgtm |
/test pull-ingress-nginx-test |
@shafeeqes: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
/tide merge-method-squash |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rikatz, shafeeqes The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@rikatz is there some issue in prow? or should I rebase? |
@shafeeqes , can you please help and clarify. Have you decided not to write any tests for this. It will not be fair to make this change and have it run on a real world user's cluster. |
I will write the tests. Just need to add to my week todo. We need this in the next release as k8s v1.25 will remove the old lease way |
@rikatz @shafeeqes |
Support for configmaps lock for leaderelection is removed in K8s 1.24 with kubernetes/kubernetes#106852. |
Sorry, I missed this PR. I created a new PR #8733 for the migration. |
/close as #8733 is merged |
@shafeeqes: PR needs rebase. 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. |
What this PR does / why we need it:
Support for configmaps lock for leaderelection is removed in K8s 1.24 with kubernetes/kubernetes#106852.
More details about the motivation to switch to leases - ref kubernetes/kubernetes#80289.
ingress-nginx is currently using configmaps . This PR proposes to add a cli flag for
leader-election-resource-lock
which is defaulted toconfigmaps
. If the operator has updated the necessary RBAC permissions, they should first useconfigmapsleases
for migration purposes and then switch toleases
in the next release.Release Notes:
Types of changes
Which issue/s this PR fixes
fixes #8091
How Has This Been Tested?
Tested by creating an image and updating on an existing deployment.
Resourcelocks were created as per set in the container spec of the
ingress-nginx-controller
deployment manifest.Checklist: