fix: resolve race condition causing false domain-already-taken on app edit#739
Open
JamesSprow wants to merge 5 commits intokubero-dev:mainfrom
Open
fix: resolve race condition causing false domain-already-taken on app edit#739JamesSprow wants to merge 5 commits intokubero-dev:mainfrom
JamesSprow wants to merge 5 commits intokubero-dev:mainfrom
Conversation
…pp edit In mounted(), getDomains() and loadPipelineAndApp() ran concurrently. loadApp() inside loadPipelineAndApp() was not awaited, so getDomains() resolved first with this.ingress.hosts still empty — the app's own domain was never whitelisted from takenDomains. - Make loadApp() async and return the promise - Await loadApp() inside loadPipelineAndApp() before getDomains() runs - Fix whiteListDomains() splice-while-iterating bug by using Set + filter Fixes kubero-dev#738
…in save For docker-strategy pipelines, pipelineData.git.repository is undefined. updateApp() and createApp() both accessed .ssh_url on it unconditionally, throwing a TypeError that was silently swallowed by the catch block — causing Save to appear to work but make no network request. Also guarded postdata.image.run.securityContext before typeof checks for apps where securityContext is absent from the spec. Refs kubero-dev#738
…y-taken getDomains() was in the Promise.all alongside loadPipelineAndApp(), so it could resolve and call whiteListDomains() before loadApp() had populated this.ingress.hosts — meaning the app's own domain was never whitelisted. Moving getDomains() to run sequentially after the parallel block ensures this.ingress.hosts is always populated when whiteListDomains() runs. Refs kubero-dev#738
Apps without TLS have ingress.tls=undefined after loadApp() overwrites the initial empty array. setSSL() checked tls?.length==0 which doesn't catch undefined, so tls[0] crashed. Also guarded the sslIndex population loop in loadApp() with optional chaining. Refs kubero-dev#738
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.
Summary
Fixes #738
Problem: Editing any existing Kubero app shows "domain already taken" and Save is disabled, even though the domain belongs to the app being edited.
Root cause: Race condition in
mounted().getDomains()andloadPipelineAndApp()run concurrently viaPromise.all. InsideloadPipelineAndApp(),loadApp()was not awaited, sogetDomains()resolved first withthis.ingress.hostsstill empty — the app's own domain was never excluded fromtakenDomains.whiteListDomains()also had a splice-while-iterating bug that made it unreliable even when called in the right order.Changes
loadApp()— madeasync, returns the promiseloadPipelineAndApp()— nowawaitsloadApp()sothis.ingress.hostsis populated beforegetDomains()/whiteListDomains()runswhiteListDomains()— replaced mutating splice loop withSet+filter(no more index drift bug)whiteListDomains()call insideloadApp()itself (it was already handled ingetDomains())Test plan