Skip to content

feat: Implement in-cluster Registrar service - #44

Merged
bpalermo merged 13 commits into
mainfrom
feat/in-cluster-registrar
Mar 22, 2026
Merged

bpalermo merged 13 commits into
mainfrom
feat/in-cluster-registrar

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

Summary

  • Introduce an in-cluster Registrar Deployment that proxies all registry operations between agents and the external backend, per proposal docs/proposals/000_in-cluster-registrar.md
  • Agents connect to the Registrar via gRPC instead of reaching external registries directly, reducing external connections from N (one per node) to 1 per cluster
  • Implements Phases 1-2 of the proposal: cached reads + push stream

New components

Component Description
api/aether/registrar/v1/registrar.proto gRPC RegistrarService (RegisterEndpoint, UnregisterEndpoint, WatchEndpoints, ListAllEndpoints)
registrar/internal/server/ Versioned snapshot, broadcaster fan-out, sync loop polling external registry
registrar/cmd/registrar/ Binary with Cobra CLI, controller-runtime manager, kubernetes/dynamodb/etcd/cloudmap backends
registry/internal/registrar/ Agent-side gRPC client with local cache from watch stream, backoff+jitter reconnect, last_version resume

Agent changes

  • Agent now exclusively uses the registrar backend (--registrar-address flag)
  • Removed --registry-backend switch and direct backend dependencies from agent

Infrastructure

  • Makefile: build-registrar, load-registrar-image, push-registrar-image
  • Publish workflow: pushes registrar image alongside agent
  • E2e workflow: loads registrar image, deploys registrar Deployment+Service with kubernetes backend
  • Container image: distroless nonroot, multi-arch (amd64/arm64)

Test plan

  • 21 unit tests pass (bazel test --test_tag_filters=-integration //...)
  • All 110 build targets compile (bazel build //...)
  • E2e TestAgentDaemonSet passes (registrar + agent start correctly in KinD)
  • E2e echo pod tests fail identically on main (pre-existing image pull issue, not a regression)
  • Verify registrar connects to each backend type (kubernetes, etcd, dynamodb, cloudmap)

🤖 Generated with Claude Code

bpalermo and others added 4 commits March 22, 2026 16:11
Introduce an in-cluster Registrar Deployment that proxies all registry
operations between agents and the external backend. Agents connect to
the Registrar via gRPC instead of reaching external registries directly,
reducing external connections from N (one per node) to 1 per cluster.

Phases 1-2 implement:
- gRPC RegistrarService (RegisterEndpoint, UnregisterEndpoint,
  WatchEndpoints server-streaming, ListAllEndpoints)
- Versioned in-memory endpoint snapshot with diff computation
- Broadcaster for fan-out of endpoint events to watching agents
- Periodic sync loop polling the registry backend for changes
- Agent-side registrar client with local cache populated by watch stream,
  exponential backoff with jitter on reconnect, and last_version resume
- Registrar binary with Cobra CLI, controller-runtime manager, and
  support for kubernetes, dynamodb, etcd, and cloudmap backends

The agent now exclusively uses the registrar backend (--registrar-address
flag), removing the --registry-backend switch.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
The new e2e.yaml workflow includes registrar deployment and covers
everything e2e-agent.yaml did.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
These workflows run integration tests (testcontainers), not end-to-end
tests. The actual e2e workflow is e2e.yaml which deploys to KinD.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@bpalermo
bpalermo force-pushed the feat/in-cluster-registrar branch from a6dbc00 to 2e22c90 Compare March 22, 2026 19:12
bpalermo and others added 9 commits March 22, 2026 16:21
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
ServiceAccount, ClusterRole, ClusterRoleBinding, Deployment, Service,
and Kustomization for deploying the registrar with kubernetes backend.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Uses the csi.spiffe.io CSI driver to mount the workload SPIFFE UDS
socket, consistent with the proxy deployment pattern.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
When SPIRE is enabled:
- Registrar loads X.509 SVID cert/key and CA bundle from the SPIRE CSI
  mount directory and serves gRPC with mutual TLS
- Agent loads its own SVID from --spire-workload-cert-dir and connects
  to the registrar with mTLS

When SPIRE is disabled (--spire-enabled=false):
- Registrar serves gRPC without TLS
- Agent connects to the registrar with insecure credentials

New flags:
- registrar: --spire-enabled, --spire-workload-socket
- agent: --spire-workload-cert-dir

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Move the duplicated TLS cert loading logic from registrar and agent
into common/spire with ServerTLSConfig and ClientTLSConfig functions.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
The distroless nonroot container (uid 65532) cannot bind to privileged
port 443. The registrar listens on 8443, and the Kubernetes Service
maps external port 443 to targetPort 8443. Agents connect to the
Service on port 443 as before.

Also adds --spire-enabled=false to the e2e registrar deployment since
SPIRE is not available in the KinD test cluster.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@bpalermo
bpalermo merged commit 44d7fae into main Mar 22, 2026
7 checks passed
@bpalermo
bpalermo deleted the feat/in-cluster-registrar branch March 22, 2026 19:59
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