service: avoid shared label-map mutation in worker gateway generation#393
Open
ShubhamMishra99 wants to merge 2 commits into
Open
service: avoid shared label-map mutation in worker gateway generation#393ShubhamMishra99 wants to merge 2 commits into
ShubhamMishra99 wants to merge 2 commits into
Conversation
Signed-off-by: Shubham Mishra <mishrashubham8932@gmail.com>
Signed-off-by: Shubham Mishra <mishrashubham8932@gmail.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
This PR fixes a reconciliation-safety issue in worker gateway topology generation caused by mutation of caller-owned label maps during gateway object construction.
buildMinimumGatewaypreviously copied the provided labels into a localgatewayLabelsmap, but also mutated the original input map by injecting controller/project/slice labels directly intolabels.Because the same label map can be reused across full-mesh gateway pair generation during SliceConfig reconciliation, this introduced hidden shared mutable state and weakened deterministic topology object synthesis.
Changes
Stop mutating the caller-provided
labelsmap inbuildMinimumGatewayApply controller/project/slice labels only to the local
gatewayLabelscopyExtend regression assertions validating that:
Why this matters
This improves:
The change also reduces hidden coupling between topology intent inputs and generated gateway objects during full-mesh reconciliation workflows.
Testing
Updated:
testBuildMinimumGatewayLabelsAreIsolatedPerGatewayAdditional assertions now verify:
Compatibility
Architectural Context
SliceConfigreconciliation computes desired topology intent and generates full-mesh worker gateway objects across clusters. Helper-level mutation of shared label state breaks clean intent-to-object boundaries and can introduce inconsistent reconciliation behavior over time.This fix restores safer object materialization semantics by ensuring gateway construction operates on isolated label copies.