Skip to content

Fix/cross workspace names - #135

Merged
SheryarButt merged 3 commits into
platform-mesh:mainfrom
SheryarButt:fix/cross-workspace-names
Oct 15, 2026
Merged

SheryarButt merged 3 commits into
platform-mesh:mainfrom
SheryarButt:fix/cross-workspace-names

Conversation

@SheryarButt

@SheryarButt SheryarButt commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Two HttpBins with the same name and namespace in different kcp workspaces end up sharing one Deployment and Service on the service cluster.

  • Local resource names, DNS names and paths don't include the kcp workspace, and all local resources are created in default, so both workspaces got the same Deployment, Service and HTTPRoute (or Ingress host). Deleting one workspace's order deleted the other workspace's httpbin too.
  • The remote-object-name / -namespace label lookups never matched (the api-syncagent sets those as annotations), so the names always fell back to the synced object's name.
  • The httpbin_cr selector label had the same problem, so each Service selected the pods of both workspaces.

Changes

  • New getSyncedID(): <remote-object-cluster>-<sha256(namespace/name)[:10]>, built from the syncagent.kcp.io/remote-object-cluster label, which is copied to the HttpBinDeployment and exists in every api-syncagent release.
  • getResourceName (httpbin-<id>), getDNSName (<id>.<base-domain>, --domain still wins), getPath and the httpbin_cr selector value (getSelectorValue()) use it.
  • Objects without that label (not synced by the api-syncagent) keep the existing names.
  • Unit tests use the labels the api-syncagent actually sets and cover two workspaces with the same namespace/name, plus the 63-character limit. Tests that only covered the old name/namespace label lookups (or duplicated other tests) are replaced by one test showing that only the cluster label switches to the new naming.
  • test/test_utils.go: the e2e suite waited for a Deployment named example-httpbin-operator, but kustomize deploys example-httpbin-operator-controller-manager, so every e2e test failed during setup. Separate commit.

Upgrade note

Synced resources get new names, so the operator creates new Deployments, Services, HTTPRoutes and Ingresses. The old ones (httpbin-<synced name>) are not cleaned up and have to be deleted manually. Unsynced resources keep their names.

Testing

  • make test and make lint
  • make docker-build IMG=example-httpbin-operator:e2e && make test-e2e IMG=example-httpbin-operator:e2e: 3/3 pass (all 3 fail without the test_utils.go change)
  • Manual on kind with kcp v0.31.2 and api-syncagent v0.6.0 (contrib-examples msp-httpbin-operator without its naming block), two consumer workspaces ordering default/httpbin-demo:
    • default flags: one Deployment/Service per workspace, each Service only selects its own pod, both answer /get
    • --local-http-route --domain=httpbin.services.portal.localhost (as in the helm-charts local setup): v0.6.2 gives both workspaces the same HTTPRoute and URL; with this change each gets its own path and URL and answers under its prefix
    • --local-ingress and --local-ingress-update: one host per workspace
    • deleting one workspace's order leaves the other workspace's httpbin running
    • an HttpBin created directly on kind keeps the v0.6.2 names

Related to platform-mesh/contrib-examples#10

Signed-off-by: sheryarbutt <m.sheryarbutt@gmail.com>
Signed-off-by: sheryarbutt <m.sheryarbutt@gmail.com>
Signed-off-by: sheryarbutt <m.sheryarbutt@gmail.com>
@SheryarButt
SheryarButt force-pushed the fix/cross-workspace-names branch from 2853961 to 928d065 Compare October 14, 2026 09:32
@SheryarButt
SheryarButt merged commit 7ed771a into platform-mesh:main Oct 15, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants