Skip to content

feat(mcs): ServiceExport/ServiceImport + clusterset.local from the registry (phase 1) - #293

Closed
bpalermo wants to merge 1 commit into
mainfrom
feat/mcs-serviceimport-phase1
Closed

bpalermo wants to merge 1 commit into
mainfrom
feat/mcs-serviceimport-phase1

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

Multi-cluster MCS-API phase 1 (proposals 018 + 006)

Ship Kubernetes Multi-Cluster Services (MCS-API) conformance objects backed by the registry as aether's cross-cluster plane — not cross-cluster DNS, not EndpointSlice import. DNS stays strictly local: each cluster materializes its own clusterset.local VIPs from its own registry view; the proxy resolves cross-cluster endpoints via registry EDS at dial time (a later phase).

This PR is control-plane plumbing only, gated default OFF behind registrar.enableMCS (--enable-mcs).

What's here

  • registry.ServiceExporter capability + etcd backend impl. Export marks live under each instance's own origin partition (<ownPrefix>/exports/<service> = namespace, proposal 006). ListExports ranges the whole root and returns the clusterset-wide union, parsing the origin cluster from the key. kubernetes/dynamodb backends don't implement it.
  • mcs.ExportController (leader-elected): watches ServiceExport, records/clears the registry export mark for the backing Service, reconciles Valid/Ready status conditions (NoService / InvalidServiceType handled).
  • mcs.ImportGenerator (leader-elected Runnable): from the clusterset-wide export view, materializes a ServiceImport (ClusterSetIP, status.clusters) + a local selectorless clusterset.local VIP Service per exported service — mirroring the existing mesh-Service generator (prune-by-label, never clobbers user objects). No EndpointSlice import.
  • Backend requirement: hard error if --enable-mcs is set on a backend without the export plane (only etcd implements it).
  • Chart: registrar.enableMCS gates the --enable-mcs flag + RBAC (serviceexports/serviceimports + their /status, and Services). Upstream sigs.k8s.io/mcs-api CRDs install separately (documented in values.yaml). Chart version bumped to 0.35.0 (parent reconciles exact number at merge).

Clean seams left (out of scope — cross-cluster data path)

  • The registry endpoint can carry a remote pod IP (flat-network) or an east-west-gateway addr (gateway mode); the proxy's dial-time EDS resolution is unchanged here.
  • Per-app-port ServiceImport ports (registry already carries per-port endpoints, proposal 005) — phase 1 advertises the single mesh port.
  • Cross-cluster SPIRE trust; replication/failover.

Tests

  • mcs unit tests (fake client + fake exporter): export→registry + status, no-backing-Service / ExternalName invalid, deleted-export clears mark; registry→ServiceImport + clusterset VIP projection, multi-cluster merge/dedupe, prune-stale, no-clobber-user-objects.
  • etcd cross-origin export integration test against a real etcd container (mirrors the existing cross-origin endpoint test).
  • bazel build //..., bazel test //... (59/59), bazel run //:format, bazel run //:gazelle all green; chart renders MCS RBAC+flag only when enabled.

Important

Do not merge / deploy yet — a real multi-cluster e2e needs a second cluster, which the parent will scope.

🤖 Generated with Claude Code

https://claude.ai/code/session_01N7oY7W8oDXrqDzFgoZh25S

…gistry (phase 1)

Multi-cluster MCS-API phase 1 (proposals 018 + 006): make aether conformant to
the Kubernetes Multi-Cluster Services objects, backed by the origin-partitioned
registry as the cross-cluster plane (not cross-cluster DNS, not EndpointSlice
import). DNS stays strictly local: each cluster materializes its own
clusterset.local VIPs from its own registry view.

Control-plane plumbing only (default OFF behind registrar.enableMCS):

- registry.ServiceExporter capability + etcd backend impl: export marks live
  under each instance's own origin partition (<ownPrefix>/exports/<service> =
  namespace); ListExports ranges the whole root and returns the clusterset-wide
  union with the origin cluster parsed from the key.
- mcs.ExportController (leader-elected): watches ServiceExport, records/clears the
  registry export mark for the backing Service, and reconciles Valid/Ready
  status conditions (NoService/InvalidServiceType handled).
- mcs.ImportGenerator (leader-elected Runnable): materializes a ServiceImport
  (ClusterSetIP, status.clusters) + a LOCAL selectorless clusterset.local VIP
  Service per service exported anywhere in the clusterset, mirroring the existing
  mesh-Service generator (prune-by-label, never clobbers user objects). No
  EndpointSlice import — endpoints stay in the registry.
- Requires the etcd backend (cross-cluster plane); hard error on kubernetes/
  dynamodb. Chart gates RBAC (serviceexports/serviceimports + status, Services)
  and the --enable-mcs flag; the upstream MCS CRDs install separately.

Clean seams left for the cross-cluster data path (out of scope here): the proxy
resolves cross-cluster endpoints via registry EDS at dial time (the registry
endpoint can carry a remote pod IP or an east-west-gateway addr); per-app-port
ServiceImport ports; cross-cluster SPIRE trust; replication/failover.

Tests: export->registry + status, registry->import/VIP projection, multi-cluster
merge, prune, no-clobber (fake client + fake exporter); etcd cross-origin export
integration test against a real etcd container.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01N7oY7W8oDXrqDzFgoZh25S
@bpalermo

Copy link
Copy Markdown
Owner Author

Superseded by #295 (integrated with the TCP floor, resolving the 0.35.0 version collision with #292). Work preserved there.

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.

1 participant