fix(uploader): sync ingress with publicDomainTemplate via server-side apply#2527
Open
fl64 wants to merge 3 commits into
Open
fix(uploader): sync ingress with publicDomainTemplate via server-side apply#2527fl64 wants to merge 3 commits into
fl64 wants to merge 3 commits into
Conversation
… apply Uploader Ingress was created once with client.Create and never updated on AlreadyExists, so changing publicDomainTemplate left existing upload Ingresses with a stale host in spec.rules[].host, spec.tls[].hosts and the AnnUploadURL annotation shown to users. Replace Create with server-side apply (client.Patch + client.Apply) so the Ingress is reconciled on every upload-flow reconcile: created when absent, patched when spec/annotations drift. Field ownership is stable across controller restarts. Signed-off-by: Pavel Tishkov <pavel.tishkov@flant.com>
Apply (SSA) was only called in UploaderService.Start, which runs when uploader supplements are missing. In the steady WaitForUserUpload state the pod/svc/ingress already exist, so Start was never called and the Ingress stayed stale when publicDomainTemplate changed. Add EnsureIngress/IngressHostDrifted/ExpectedIngressHost to UploaderService and call EnsureIngress in the isUploaderReady branch of the VI/CVI/VD upload-flows only when the cached Ingress host drifted from the configured UPLOADER_INGRESS_HOST. Steady-state cost is one string compare per reconcile; a Patch runs only on actual drift. Signed-off-by: Pavel Tishkov <pavel.tishkov@flant.com>
IsUploaderReady HTTPS-probes the Ingress host, so the Ingress must be synced before the probe runs. Moving the drift check ahead of IsUploaderReady ensures a stale host (after publicDomainTemplate change) is corrected first; otherwise readiness fails with a TLS error and the isUploaderReady branch that updates status.ImageUploadURLs is never reached. The drift check is skipped when the uploader pod is absent, so initial supplement creation still flows through Start. Signed-off-by: Pavel Tishkov <pavel.tishkov@flant.com>
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.
Description
Changing the cluster domain (
publicDomainTemplate) left existing image-upload endpoints on the old domain, so the upload URL shown for an already-createdVirtualImage/VirtualDisk/ClusterVirtualImage(withdataSource.type=Upload) kept pointing at the old host and uploads to it failed.Why do we need it, and what problem does it solve?
The upload endpoint was created once when an image or disk with
Uploadsource first appeared and was never reconciled afterwards. After an administrator changed the cluster domain, the controller restarted with the new domain, but the already-existing endpoints kept their original host. Users kept seeing the old upload URL, so uploading data to an already-created image broke until the image was deleted and recreated.The endpoint is now reconciled on every upload-flow pass, so its host, TLS host, and upload URL follow the current cluster domain automatically.
What is the expected result?
VirtualImagewithdataSource.type=Upload— the upload URL matches the current cluster domain.publicDomainTemplateand wait for the controller to pick up the new domain.Checklist
Changelog entries