Repository navigation
Conversation
…er wins the race To change the ClusterIP of default/kubernetes the syncer deletes the service and creates it again. The kube-apiserver recreates that service on its own as soon as it is gone, so the create can lose the race and fail with AlreadyExists; the startup wrapper only retried on Conflict and the syncer exited. The delete and create now repeat inside the sync, bounded, until the service that exists carries the cluster ips of the host service. Signed-off-by: Youssef Omar Bouden <youssef.bouden2002@gmail.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What issue type does this pull request address?
/kind bugfix
What does this pull request do? Which issues does it resolve?
resolves #4279
To change the ClusterIP of
default/kubernetesthe syncer deletes the service and creates it again. The kube-apiserver recreates that service on its own as soon as it is gone, so the create can lose the race and fail with AlreadyExists. The startup wrapper only retried on Conflict, so the syncer exited.The delete and create now repeat inside the sync, up to five times, until the service that exists carries the cluster ips of the host service. A service recreated by the apiserver with the wanted ips already is accepted as is.
Please provide a short message that should be published in the vcluster release notes
Fixed an issue where the syncer exited at startup when the kube-apiserver recreated the
default/kubernetesservice while the syncer was replacing its ClusterIP.What else do we need to know?
Unit test with a client that plays the apiserver recreating the service between delete and create: winning at once, losing once, losing twice, and never winning.
Note
Medium Risk
Changes startup-critical sync of the default/kubernetes Service; bounded retries reduce failure modes but still delete/recreate a core cluster object.
Overview
When the virtual
default/kubernetesservice needs a new ClusterIP, the syncer no longer does a single delete-then-create. It delegates torecreateService, which can repeat that cycle up to five times to cope with the kube-apiserver immediately recreating the service and causingAlreadyExistson create.If another actor recreates the service first, the syncer GETs the current object: it succeeds when the live service already has the host’s cluster IPs, or it deletes again and retries with the updated object.
ResourceVersionandUIDare cleared on each create attempt.Unit tests add an
apiserverRecreatesClientthat simulates the apiserver winning the race zero, one, two, or every time, asserting the virtual service ends up with the host IP or returns an error after max attempts.Reviewed by Cursor Bugbot for commit 0050c38. Bugbot is set up for automated code reviews on this repo. Configure here.