mcs

package
v0.0.0-...-c46dd35 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package mcs implements Kubernetes Multi-Cluster Services (MCS-API) phase 1 for aether, backed by the origin-partitioned registry (proposals 018 + 006). The REGISTRY — not cross-cluster DNS or EndpointSlice import — is aether's cross-cluster plane:

  • ExportController watches local ServiceExport objects and records the export in the registry (registry.ServiceExporter), so other clusters can import the service. It reconciles ServiceExport status (Valid/Ready).
  • ImportGenerator reads the clusterset-wide export view back out of the registry and materializes, in THIS cluster, a ServiceImport (ClusterSetIP) plus a LOCAL selectorless clusterset VIP Service (a DISTINCT <svc>-clusterset object with its own ClusterIP, so it coexists with the same-named per-cluster mesh Service) — mirroring the registrar's mesh-Service generator. The VIP's ClusterIP is stamped onto the ServiceImport's spec.IPs (the <svc>.<ns>.svc.clusterset.local address). No EndpointSlice import: endpoints stay in the registry; the proxy resolves cross-cluster endpoints via registry EDS at dial time (a later phase — out of scope here).

DNS stays STRICTLY LOCAL: each cluster materializes its own clusterset VIP from its own registry view. Both runnables are leader-elected (single writer) and require a registry backend implementing registry.ServiceExporter (etcd); they no-op cleanly for backends without a cross-cluster plane.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExportController

type ExportController struct {
	client.Client
	// Exporter is the registry's cross-cluster export capability. Required.
	Exporter registry.ServiceExporter
	Log      *slog.Logger
}

ExportController reconciles ServiceExport objects into the registry's clusterset-wide export view: it marks the referenced mesh service exported in the origin-partitioned registry (this cluster's own partition) when a ServiceExport exists with a backing Service, and unmarks it when the ServiceExport is deleted. It records the standard MCS status conditions (Valid, Ready) on each ServiceExport.

It is leader-elected via controller-runtime's manager (the manager runs reconcilers only on the leader), so writes to the registry partition have a single author per cluster.

func (*ExportController) Reconcile

Reconcile records or clears the registry export mark for one ServiceExport and stamps its status. The (namespace, name) of the ServiceExport IS the mesh service identity (MCS keys exports by the same-named Service), so the registry service key is the ServiceExport name.

func (*ExportController) SetupWithManager

func (c *ExportController) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager registers the controller for ServiceExport objects.

type ImportGenerator

type ImportGenerator struct {
	client.Client
	// Exporter is the registry's cross-cluster export capability. Required.
	Exporter registry.ServiceExporter
	// MeshPort is the clusterset VIP Service port (the mesh capture port).
	MeshPort int32
	Interval time.Duration
	Log      *slog.Logger
}

ImportGenerator reconciles the registry's clusterset-wide export view into, in THIS cluster: a ServiceImport (type ClusterSetIP) per exported service, and a LOCAL selectorless clusterset VIP Service — mirroring the registrar's mesh-Service generator. No EndpointSlice import: endpoints stay in the registry, and the proxy resolves cross-cluster endpoints via registry EDS at dial time (a later phase). Each clusterset Service is annotated with the mesh service + mesh port so the agent maps the captured ClusterIP back to the registry-backed EDS cluster, exactly like a per-cluster mesh VIP.

The clusterset VIP Service has a DISTINCT name (<svc>-clusterset) so it coexists with the same-named per-cluster mesh Service (<svc>): the mesh VIP backs <svc>.<ns>.svc.cluster.local, the clusterset VIP its own ClusterIP. The generator copies the K8s-allocated ClusterIP of the clusterset Service onto the ServiceImport's spec.IPs, which is what an MCS DNS controller publishes for <svc>.<ns>.svc.clusterset.local.

It is a leader-elected manager Runnable: only the leader writes. It reads the export view on a ticker (the etcd registry's view changes when any cluster's ExportController writes a mark).

func (*ImportGenerator) NeedLeaderElection

func (g *ImportGenerator) NeedLeaderElection() bool

NeedLeaderElection makes the generator run only on the elected leader.

func (*ImportGenerator) Start

func (g *ImportGenerator) Start(ctx context.Context) error

Start runs the reconcile loop until the context is cancelled.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL