service: isolate gateway labels per object during reconciliation#388
service: isolate gateway labels per object during reconciliation#388ShubhamMishra99 wants to merge 1 commit into
Conversation
Signed-off-by: Shubham Mishra <mishrashubham8932@gmail.com>
e7e425b to
231b5f7
Compare
|
Hi @ShubhamMishra99, this looks like it covers the same fix as #326 which was opened 2 weeks ago, both clone the label map in |
|
Hii @mdryaan Instead of only cloning the incoming map, this PR introduces an explicit gateway-local label map that is assigned to the generated object, making label ownership and mutation boundaries clearer during reconciliation. In addition, it adds a regression test covering both gateway directions and verifies that the original owner labels remain unchanged. So there is functional overlap, but #388 also focuses on maintainability, explicit object isolation, and long-term regression protection. Hope you will understand! |
Description
Fixes hidden shared-state mutation during full-mesh gateway reconciliation by isolating gateway label maps per generated object.
Currently,
WorkerSliceGatewayServicecreates full-mesh gateway pairs for every cluster combination during SliceConfig reconciliation. While building gateway resources, the base labels map was being mutated in-place and reused across gateway objects.Because Go maps are reference types, this can introduce unintended label aliasing and hidden mutable shared state across generated topology objects.
Changes
buildMinimumGatewayworker-cluster,remote-cluster) on isolated copiesObjectMeta.LabelsWhy this matters
This change improves reconciliation safety and topology object correctness without changing external API behavior or full-mesh semantics.
It also reduces hidden coupling in gateway generation paths and makes future topology abstraction work safer as partial-mesh / hub-and-spoke support evolves.
Fixes #
How Has This Been Tested?
Validated using targeted gateway service test execution.
Added regression test
TestBuildMinimumGateway_LabelsAreIsolatedPerGatewayVerified behavior
Test command
Checklist
Does this PR introduce a breaking change for other components like worker-operator?
No.
This PR only hardens internal gateway reconciliation behavior by isolating per-object label state. It does not modify APIs, CRDs, topology semantics, or worker-operator contracts.