From 781879912abb61213c37bac27205bd90d18187a7 Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Mon, 26 Oct 2026 07:57:41 -0400 Subject: [PATCH 1/4] docs: Make guides discoverable by task Give readers one entry point for components, ownership, development and operations. Keep repository instructions focused on contribution rules and link to the maintained guides instead of duplicating deployment history. Correct obsolete testing and formatting guidance. Related to #293 Related to #296 --- AGENTS.md | 200 ++++++++++--------------- README.md | 162 ++++---------------- docs/README.md | 155 ++++++------------- docs/agents/ARCHITECTURE.md | 31 +--- docs/agents/CONVENTIONS.md | 237 +----------------------------- docs/development/README.md | 91 ++++++++++++ docs/development/conventions.md | 231 +++++++++++++++++++++++++++++ docs/development/documentation.md | 65 ++++++++ docs/getting-started.md | 81 ++++++++++ docs/overview.md | 85 +++++++++++ hack/returnpath-lab/README.md | 17 +-- 11 files changed, 724 insertions(+), 631 deletions(-) create mode 100644 docs/development/README.md create mode 100644 docs/development/conventions.md create mode 100644 docs/development/documentation.md create mode 100644 docs/getting-started.md create mode 100644 docs/overview.md diff --git a/AGENTS.md b/AGENTS.md index 8d1922349..e08305105 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,121 +1,83 @@ -# Repository Guidelines - -## Architecture Reference - -The architecture reference is split into component-scoped documents — -each self-contained (layout, entry points, data flow, configuration, module -reference, external dependencies, key design decisions, testing, CI/CD, known -constraints, and a "For Claude" quick-start table). Start from whichever one -matches the binary or subsystem you're touching; each cross-links to the -others where the boundary matters: - -| Document | Covers | Start here when you're touching... | -| -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [docs/agents/ARCHITECTURE-CNI.md](docs/agents/ARCHITECTURE-CNI.md) | The CNI attach chain: `galactic-cni` (installer), `galactic-veth`, `galactic-tap`, `galactic-ipam`, `galactic-bgp`, `galactic-route` | Pod/VM attach or detach behavior, CNI config fields/conflists, IPAM, the SRv6 uSID TC-BPF datapath's CNI-side registration, or anything under `cmd/galactic-{cni,veth,tap,ipam,bgp,route}`, `internal/cni*`, `internal/installer` | -| [docs/agents/ARCHITECTURE-ROUTER.md](docs/agents/ARCHITECTURE-ROUTER.md) | The BGP/EVPN control plane: `galactic-router` (BGPRouter/BGPPeer/BGPAdvertisement/BGPPolicy/BGPVRFInstance reconcilers, embedded GoBGP, GC) | BGP CRD reconciliation, GoBGP runtime behavior, EVPN path construction, orphaned-CRD/VRF garbage collection, or anything under `cmd/galactic-router`, `internal/reconcile`, `internal/runtime`, `internal/gc`, `internal/model`, `internal/hash` | -| [docs/agents/ARCHITECTURE-GATEWAY.md](docs/agents/ARCHITECTURE-GATEWAY.md) | The edge XDP DSR load balancer: `galactic-gateway`, `NetworkGateway`/`NetworkService` reconcilers, the edge XDP datapath | Ingress L4 load balancing, `NetworkGateway`/`NetworkService` CRDs, anycast VIP advertisement, or anything under `cmd/galactic-gateway`, `internal/gateway`, `internal/plumbing/ebpf/edge{prog,map,attach}`, the `NetworkGateway`/`NetworkService`-related code in `internal/controller` | -| [docs/agents/ARCHITECTURE-FABRIC-API.md](docs/agents/ARCHITECTURE-FABRIC-API.md) | The fabric looking glass: `fabric-api` (`node` sidecar in each `fabric-router` pod, per-cell `gateway`, `janitor`, `query`), the `FabricQuery` types, FRR vty reads, ICMP probes, mTLS identities | FRR diagnostics over vty or ICMP probes, `FabricQuery` execution and its status, fabric-api mTLS identities or certificates, or anything under `cmd/fabric-api`, `internal/fabric`, `api/fabric`, `config/fabric-api` | - -The CNI, router and gateway documents supersede the former monolithic -`ARCHITECTURE.md`, which is now a short pointer to them; the fabric-api -document was written after the split and was never part of it. - -## Purpose - -Galactic is the SRv6 data plane for multi-cloud VPC networking. It consists of three binaries deployed on each Kubernetes node (the third only on dedicated gateway-role nodes): - -- **`galactic-veth`** — CNI plugin that wires containers into VPC networks (VRF, veth, SRv6 ingress route) and writes `BGPAdvertisement` CRDs. -- **`galactic-router`** — controller-runtime reconciler that watches BGP CRDs and drives an embedded GoBGP server per node to distribute EVPN paths. -- **`galactic-gateway`** — controller-runtime process that loads an edge XDP DSR (Direct Server Return) L4 load balancer on gateway-role nodes and drives it from `NetworkGateway`/`NetworkService` CRDs. Every gateway node advertises every VIP identically (anycast) over the same EVPN mesh. - -Alongside them, **`fabric-api`** is the opt-in fabric looking glass: its `node` subcommand runs as a sidecar in each `fabric-router` pod and answers bounded diagnostics about FRR state (BGP lookups and summaries, ICMP ping/traceroute) over mTLS gRPC on the node's own address; its `gateway` subcommand runs once per edge cell, executes `FabricQuery` objects by fanning them out to those sidecars, and serves an operator debug service; its `janitor` subcommand deletes expired `FabricQuery` copies; its `certsync` subcommand runs in a separate per-node pod that obtains the sidecar's certificate. AS-path and community searches run against an in-sidecar index of bgpd's selected routes fed over BMP (`internal/fabric/index`), not FRR scans; see [docs/fabric-api/load-test.md](docs/fabric-api/load-test.md). It is one binary and image (`ghcr.io/datum-cloud/fabric-api`), separate from `fabric-router`'s FRR image. - -The cloud and network APIs now live in `api/cloud/v1alpha1` and `api/network/v1alpha1`, both under `galactic.datumapis.com`. The cell role of `galactic-controller` runs the former cloud VPC, attachment, subnet, interface, and BGP status reconcilers alongside the traffic-policy controllers. Its fabric role runs the central network fabric identity allocator in a separate deployment. - -**Data flow:** CNI invoked with pre-populated VPC/VPCAttachment identifiers → CNI creates kernel SRv6 state and writes a `BGPAdvertisement` CRD → `galactic-router` reconciles the CRD → GoBGP advertises the EVPN path → BGP distributes routes between nodes. - -## Tech Stack - -- **Go 1.26** — every binary -- **controller-runtime** — BGPRouter/BGPPeer/BGPAdvertisement/BGPPolicy/BGPVRFInstance reconcilers (`galactic-router`) and NetworkGateway/NetworkService reconcilers (`galactic-gateway`); a bare `pkg/client` (no manager) in `galactic-bgp`/`galactic-cni` -- **Galactic API** (`api/network/v1alpha1`, `api/cloud/v1alpha1`, `api/v1alpha1`) — BGP, gateway, VPC, attachment, and traffic-policy CRDs in `galactic.datumapis.com` -- **GoBGP v4** — embedded BGP server (default role) -- **SRv6 + netlink** — kernel-level routing; `github.com/vishvananda/netlink` -- **eBPF** (`github.com/cilium/ebpf`) — TC-BPF SRv6 uSID decap datapath (CNI side) and XDP edge DSR load-balancer datapath (`galactic-gateway`) -- **Multus CNI** — multi-network for pods; NAD generation handled by `galactic-controller --role=cell` - -## Development Workflow - -``` -task build # produces bin/galactic-veth and bin/galactic-router -task ci # full pipeline: lint → build → test:unit → test:e2e -task test # runs test:unit then test:e2e -task test:unit # unit tests with race detection -task test:e2e # Kind cluster lifecycle test -task test:alerts # promtool unit tests for config/monitoring/ alert rules -task lint # golangci-lint; lint-fix applies safe auto-fixes +# Repository guidelines + +## Start with the maintained docs + +[docs/README.md](docs/README.md) is the human-facing documentation index. +[docs/overview.md](docs/overview.md) describes component and repository ownership. +Use the guide matching the subsystem you change: + +| Subsystem | Guide | Main source areas | +| ------------------------------------------ | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | +| CNI attach/detach, installer, IPAM | [CNI architecture](docs/cni/architecture.md) | `cmd/galactic-{cni,veth,tap,ipam,bgp,route}`, `internal/cni*`, `internal/installer` | +| Tenant BGP/EVPN, route installation, GC | [Router architecture](docs/router/architecture.md) | `cmd/galactic-router`, `internal/controller`, `internal/reconcile`, `internal/runtime`, `internal/gc` | +| Ingress VIPs, DSR, backend health | [Gateway architecture](docs/gateway/architecture.md) | `cmd/galactic-gateway`, `internal/gateway`, edge eBPF packages | +| NAT66/NAT64, shard membership | [NAT configuration](docs/nat/configuration.md), [active/active egress](docs/nat/active-active.md) | `cmd/galactic-nat`, `internal/installer/egressgroup.go`, NAT eBPF packages | +| Cluster controllers and identity | [Controller roles](docs/controller/README.md) | `cmd/galactic-controller`, `internal/cloud`, `internal/trafficpolicy` | +| Provider attachments and gates | [Edge contract](docs/edge/provider-contract.md) | `cmd/galactic-edge`, `internal/edge` | +| Private service delivery | [Private services](docs/private-services/README.md) | service-route controller and datapath packages | +| FRR configuration and typed fabric routing | [Fabric routing](docs/fabric-routing/README.md) | `cmd/fabric-config-agent`, `cmd/fabric-router-controller`, `internal/fabricconfig`, `internal/fabric/routing` | +| FRR diagnostics, probes, mTLS and queries | [Fabric API architecture](docs/fabric-api/architecture.md) | `cmd/fabric-api`, `internal/fabric`, `api/fabric` | + +For tasks in `deploy/containerlab/`, also read its local `AGENTS.md`. + +## Development and code standards + +Follow [coding conventions](docs/development/conventions.md) and the +[development guide](docs/development/README.md). The Taskfile and workflows are +the source of truth for commands and tool versions. + +```sh +task build # regenerate eBPF, format, vet, build binaries +task test:unit # race-enabled unit tests; privileged tests may skip +task test:unit-root # real-kernel tests in a privileged development environment +task test:e2e # Kind lifecycle test +task test:alerts # promtool alert tests +task lint # Go and YAML checks +task ci # required before every PR: lint, build, unit, e2e ``` -Production release images are built by `.github/workflows/publish.yaml`, not by any `task` in this file — see the CI/CD section of each component's architecture doc ([CNI](docs/agents/ARCHITECTURE-CNI.md#cicd), [router](docs/agents/ARCHITECTURE-ROUTER.md#cicd), [gateway](docs/agents/ARCHITECTURE-GATEWAY.md#cicd)) for the full pipeline (per-binary `containers/*/Dockerfile`s pushed to `ghcr.io/datum-cloud/*`, plus a `config/` Kustomize OCI bundle). This replaced an earlier single shared image (`containers/galactic/Dockerfile`, `.github/workflows/release.yaml`, both removed — see the router doc's History note) that was found to advertise `galactic-router` without ever building it. `containers/galactic-cni/Dockerfile` is also used directly by `task test:e2e` (not just by the publish pipeline). - -**Before every PR:** `task ci` (lint → build → test:unit → test:e2e). - -## Code Standards - -See [docs/agents/CONVENTIONS.md](docs/agents/CONVENTIONS.md) for the full, prescriptive coding standards covering Go naming, error handling, testing patterns, linting, commit messages, and markdown table alignment. - -Summary: -- Go: `gofmt`/`goimports` enforced; golangci-lint v2 with `errcheck`, `staticcheck`, `govet`, `revive`, `gocyclo`, `goconst`, `unused`, and more (see `.golangci.yaml` for the full list). -- Generated protobuf files (`*.pb.go`, `*_grpc.pb.go`) are committed; never hand-edit them. -- Always use `.yaml`, never `.yml`, for YAML files. - -## Deployments - -`config/` is Kustomize-composed: `kubectl apply -k config/` deploys everything (namespace, both DaemonSets' RBAC/ServiceAccounts, and all three DaemonSets) in one command — `kubectl` sorts by kind before applying, so the namespace and RBAC/ServiceAccounts always land before anything namespace-scoped needs them. Each component also has its own `kustomization.yaml` and can be applied independently: - -**Node label strategy.** Every DaemonSet's node affinity keys off one or more of these labels — a primary-role enum (`node`) plus a mode enum per binary family (`galactic`, `fabric`), rather than one giant enum or a pile of independent booleans. `node`'s two values are mutually exclusive by design (a node is never both `compute` and `edge`), and so are each family's two mode values (a node running plain `galactic-router` never also runs `galactic-router-rr`) — but `node` and `galactic`/`fabric` are independent keys, so their values freely combine (e.g. `node=edge` + `galactic=router` + `fabric=router` on one node). `galactic-gateway` and `galactic-nat` run only on `node=edge` nodes, alongside `galactic-vrf`, and each also needs its own opt-in label, so neither is ever deployed automatically: - -| Label | Deploys | -| ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `galactic.datumapis.com/node=compute` | nothing exclusively — the ordinary tenant-serving role (`galactic-cni`, `galactic-router`, `fabric-router` via the labels below). Never hosts `galactic-vrf`, `galactic-gateway` or `galactic-nat` | -| `galactic.datumapis.com/node=edge` | `galactic-vrf` (the ingress sidecar's pods, placed by whatever defines them — no manifest in this repo yet); also runs `galactic-cni`, `galactic-router`, `fabric-router` via the labels below, and `galactic-gateway`/`galactic-nat` when the node also carries their opt-in label | -| `galactic.datumapis.com/gateway=enabled` | `galactic-gateway` only; opt-in, independent of `nat`, requires `galactic.datumapis.com/node=edge` on the node | -| `galactic.datumapis.com/nat=enabled` | `galactic-nat` only; opt-in, independent of `gateway`, requires `galactic.datumapis.com/node=edge` on the node | -| `galactic.datumapis.com/galactic=router` | `galactic-cni`, `galactic-router` (plain/tenant mode) — runs on both `compute` and `edge` nodes | -| `galactic.datumapis.com/galactic=control` | `galactic-router-rr`; mutually exclusive with `galactic=router` on the same node | -| `galactic.datumapis.com/fabric=router` | `fabric-router` | -| `galactic.datumapis.com/fabric=control` | `fabric-router`, same image as `fabric=router` — reflector-vs-plain is driven entirely by the per-node `frr.conf` infra's own renderer produces, not a separate binary or overlay | - -See [docs/node-labels.md](docs/node-labels.md) for the full strategy — why `galactic`/`fabric` are each a mode enum rather than independent booleans, the naming collision between `node=edge` and `galactic-gateway`'s pre-existing "edge XDP" terminology, and the specific bugs this scheme replaced. - -- **`config/galactic-system/`** — Creates the `galactic-system` namespace both components deploy into. Apply with `kubectl apply -k config/galactic-system/`. -- **`config/galactic-cni/`** — Production manifests for the CNI installer DaemonSet, ConfigMap, RBAC, and ServiceAccount; opts in via `galactic.datumapis.com/galactic: router`. Apply with `kubectl apply -k config/galactic-cni/`. -- **`config/galactic-router/`** — Shared RBAC/ServiceAccount plus DaemonSet roles: - - **`config/galactic-router/base/`** — the role-agnostic DaemonSet spec both roles below patch; not applied directly (no affinity, no BGP listen port of its own). - - **`config/galactic-router/overlays/router/`** — the plain (non-reflector) per-node role (`galactic-router`); runs on every `compute` *and* every `edge` node except Kubernetes control-plane nodes, opt-in via `galactic.datumapis.com/galactic: router` (the same label `galactic-cni` keys off of — see `config/galactic-cni/daemonset.yaml`). This is the default role, so it carries no role-specific name/label of its own — only `control` below needs one, to coexist as a second DaemonSet. - - **`config/galactic-router/overlays/control/`** — the BGP route-reflector role (`galactic-router-rr`, `GALACTIC_ROUTER_REFLECTOR=true`); opt-in only, requires `galactic.datumapis.com/galactic: control` (stays at zero replicas otherwise). Mutually exclusive with `router`'s `galactic: router` value on the same node — one label key, single-valued, so a route-reflector node structurally can't also run plain-mode `galactic-router`. `GALACTIC_ROUTER_BGP_LOCAL_ADDRESS` is auto-detected from the host's `lo` interface by default; see the comments in `daemonset-patch.yaml` for when to override it. - - Apply both roles with `kubectl apply -k config/galactic-router/`, or a single role with e.g. `kubectl apply -k config/galactic-router/overlays/router/`. `galactic-router` no longer runs bundled inside `galactic-gateway`'s pod — see `config/galactic-gateway/` below. -- **`config/galactic-gateway/`** — the edge XDP DSR load-balancer control plane, a single-container `galactic-gateway` DaemonSet — `galactic-router` used to run as a second container in this same pod; it's now a fully independent DaemonSet (via `galactic.datumapis.com/galactic: router`, which a gateway node may carry like any other), so a crash on either side no longer takes the other's *pod* down with it, not just the other's binary. `config/galactic-gateway/{serviceaccount.yaml,rbac.yaml}` (safe/idempotent to apply cluster-wide) are what `kubectl apply -k config/galactic-gateway/` applies; `config/galactic-gateway/base/` (requiring nodes labeled both `galactic.datumapis.com/node: edge` and `galactic.datumapis.com/gateway: enabled`, so it runs on edge nodes alongside `galactic-vrf`) is **not** included in that kustomization and is **not** applied as-is — the same exemption as `config/fabric-router/` below, for the same reason: `GALACTIC_GATEWAY_PUBLIC_INTERFACE` differs per gateway node and has no generic default. `GALACTIC_GATEWAY_SRV6_ADDRESS` needs no per-node value: left unset, the gateway derives it at startup from its node's `BGPRouter` locator and node ID, and a set value overrides that (see `internal/config/gateway.go`'s `EnvGatewaySRv6Address` doc comment). It's designed to be instantiated once per gateway node by a further overlay that pins it to one node (`kubernetes.io/hostname`) and sets that node's own public interface; see `deploy/containerlab/resources/galactic-gateway/` for a worked example (one overlay per lab edge node). Also **not** part of the root `config/kustomization.yaml`'s default resource list, matching `config/fabric-router/`'s exemption. -- **`config/galactic-nat/`** — the sharded egress translation (NAT66/NAT64) control plane, one `galactic-nat` DaemonSet per cluster on every node labeled both `galactic.datumapis.com/node: edge` and `galactic.datumapis.com/nat: enabled`, alongside `galactic-vrf`. It is independent of `galactic-gateway`. A shard's identity (SID, masquerade addresses, NAT64 prefix) comes from the `EgressShard` targeting its node, not from the DaemonSet. The base leaves `GALACTIC_NAT_XDP_ATTACH` at its default, `direct`. On a node that also runs the gateway, set it to `dispatch`: an interface takes one native XDP program, so the shard and the gateway (which defaults to `GALACTIC_GATEWAY_XDP_ATTACH=dispatch`) each run from their own slot of the node's shared, pinned XDP dispatcher (`internal/plumbing/ebpf/xdpdispatch`), and either can restart or be turned off (`GALACTIC_*_DATAPATH_ENABLED=false`) without touching the other's traffic. `hack/xdp-dispatch-release.sh` detaches the dispatcher from a node. Compute nodes reach their own site's shards over SRv6: by default each VRF uses the first reachable shard in `GALACTIC_CNI_EGRESS_SHARD_SIDS`; with `GALACTIC_CNI_EGRESS_MODE=hashed` on `galactic-cni`, `usid_egress` spreads tenant addresses across the cluster's `EgressShard`s through one immutable Maglev snapshot per translation class (NAT66, and each NAT64 prefix, holding only the shards that can translate it) and per-address pins, and `spec.drain` takes a shard out of rotation without breaking its pinned sessions; delete a shard only after draining it (see [docs/nat/configuration.md](docs/nat/configuration.md#active-active-egress) and the rollout checklist [docs/nat/active-active-rollout.md](docs/nat/active-active-rollout.md)). `kubectl apply -k config/galactic-nat/` applies only the ServiceAccount/RBAC; `base/` is excluded because uplink auto-detection is deployment-specific (see `config/galactic-nat/kustomization.yaml`). Not part of the root `config/kustomization.yaml`. -- **`config/fabric-router/`** — the FRR underlay eBGP DaemonSet (`fabric-router`; `galactic-router` needs a working underlay before it can start). Unlike `config/galactic-router/`, this is a single flat DaemonSet with no `default`/`rr`-style role split — its affinity matches any node labeled `galactic.datumapis.com/fabric: router` (a dedicated mode-enum label, independent of whatever `galactic.datumapis.com/node` role value or `galactic.datumapis.com/galactic` mode that node also carries) directly, since there's no env/config difference between running on a regular node vs. those roles — fabric-router itself is identical everywhere; only the per-node BGP underlay config it reads from the ConfigMap differs. That affinity can legitimately match more than one node per cluster, and BGP underlay config (hostname, router-id, interface addresses, remote-AS) inherently differs per physical node — so each node's config lives in its own `fabric-router.` ConfigMap (a `frr.conf` key, plus optional `daemons`/`vtysh.conf` overrides of the image defaults) rather than one shared ConfigMap for the whole DaemonSet. `fabric-config-agent` (`cmd/fabric-config-agent`, `internal/fabricconfig`, built into the `fabric-router` image) reads it from the API: as the `frr-init` init container it validates (`vtysh -C`) and installs it, holding the pod in `Init` until a valid one exists; as the `config-agent` sidecar it applies later changes live with `frr-reload.py`, so an edit to one node's ConfigMap neither restarts the pod nor touches other nodes, and reports `Applied`/`Rejected`/`ReloadFailed`/`RestartRequired` events on the ConfigMap. The sidecar also hard-resets any IPv6 session announcing an IPv4-mapped next hop (`internal/fabricconfig/nexthop.go`) and serves that check's metrics, with the activation path's (`internal/fabricconfig/metrics.go`), on the node's port `9343`. A third container, `frr-exporter` (upstream `tynany/frr_exporter`, pinned by digest), reads the daemons' vty sockets in the same pod-scoped `/run/frr` and serves BGP peer state, message counters and prefix counts for both underlay families on the node's port `9342` (`hostNetwork`); `task verify:fabric-metrics` in `deploy/containerlab/` checks it on every lab node. The image's default `daemons` loads bgpd's BMP module (`-M bmp`), so a node's `frr.conf` can stream to a BMP collector (`config/bmp-collector/`) with a `bmp targets` block; loading it alone streams nothing, and a change to the modules needs a pod restart rather than a reload. Every lab node's `frr.conf` streams its pre-policy Adj-RIB-In and Loc-RIB for both families, sourced from `lo` (`source-interface lo`), since the underlay carries loopbacks but not link subnets. Production `frr.conf`s come from infra's renderer, which has to emit the same block for production nodes to stream. A node with no ConfigMap of its own falls back, with a `DeprecatedConfigSource` warning, to key `frr.conf.` of the legacy shared `fabric-config` ConfigMap. **Not** part of the root `config/kustomization.yaml` and not covered by `kubectl apply -k config/` — unlike every other component here, it has no generic default: the deployer must hand-author one `fabric-router.` ConfigMap per matching node before applying `kubectl apply -k config/fabric-router/` (which also applies the agent's ServiceAccount and its namespaced Roles: `fabric-router` for events, `fabric-router-configmaps` for the ConfigMap reads). Once every node runs from the API (`config/fabric-router/components/activation`, see `config/fabric-router-controller/` below), the opt-in Component `config/fabric-router/components/configmap-retired`, listed after `components/activation` (the build fails otherwise), retires the ConfigMap path: it sets `FABRIC_CONFIGMAPS=false` on both agent containers and deletes the `fabric-router-configmaps` Role and RoleBinding, so the agent never reads, watches or raises events on a ConfigMap, `frr-init` starts a node only from its checkpoint or its deployment's active revision and never falls back to a ConfigMap, and a deployment asking to leave CRD is reported as `ConfigMapRetired` rather than handed off; applying or removing it restarts FRR like the activation Component (see [docs/fabric-routing/operations.md](docs/fabric-routing/operations.md#retiring-the-configmap-path)). The opt-in Component `config/fabric-router/components/fabric-api` adds the fabric-api sidecar to this DaemonSet's pod (see `config/fabric-api/` below); applying it, and every later fabric-api image change, recreates the pod and restarts FRR with it, so roll it out as a routing change. -- **`config/bmp-collector/`** — a single-replica GoBMP Deployment and its `bmp-collector` Service (TCP `5000`), the BMP (RFC 7854) collector `galactic-router` and `fabric-router` stream to; `galactic-router` does so when `GALACTIC_ROUTER_BMP_STATIONS` names it (`bmp-collector.galactic-system.svc:5000`; see [docs/router/configuration.md](docs/router/configuration.md)). It parses every Peer Up/Down, route-monitoring and statistics message to JSON on stdout, so the cluster's log pipeline is its store; an overlay swapping `--dump=console` for `--kafka-server` publishes to Kafka instead. Opt-in, like `config/fabric-router/`: not part of the root `config/kustomization.yaml`, since nothing streams to it until a router is configured to. The containerlab lab runs one on `iad-worker3`'s host network (`deploy/containerlab/resources/bmp-collector/iad/`), because its three clusters cannot reach each other's Services, and points every node's `fabric-router` and the EVPN route reflector at it. Of the `galactic-router`s, only the reflector streams: its pre-policy Adj-RIB-In already holds every node's advertisements. -- **`config/fabric-api/`** — the fabric looking glass's cell-wide prerequisites and per-cell gateway. `kubectl apply -k config/fabric-api/` applies only the `fabric-api-gateway` and `fabric-api-janitor` ServiceAccounts and RBAC (the janitor's delete access is deliberately a separate identity from the gateway's, which can only read `FabricQuery` and write its status); safe and idempotent in any cell. `config/fabric-api/base/` (the 2-replica leader-elected gateway Deployment, its ClusterIP debug Service, a PodDisruptionBudget and the `*/15` janitor CronJob) is **not** included in that kustomization and is **not** applied as-is, for the same reason as `config/galactic-gateway/base/`: it needs per-cell values — a `fabric-api` ConfigMap (`site`, `cell`, `cluster-name`) and the cell name in its certificate's URI SAN — supplied by a per-cell overlay; see `deploy/containerlab/resources/fabric-api/gateway/` for a worked example. `config/fabric-api/crd/` is a generated `FabricQuery` CRD for the lab and tests only; infra owns the CRD (and the per-cell `fabric-api` cert-manager `Issuer`) in every cell. The node sidecar is the `config/fabric-router/components/fabric-api` Component, which also adds a `fabric-api-certs` DaemonSet (`fabric-api certsync`) that owns the cert-manager csi-driver volume and copies the certificate to the node's `/run/fabric-api/tls` for the sidecar: a csi volume blocks its pod until the certificate is issued, so keeping it out of the `fabric-router` pod means a broken Issuer stalls only the certs pod, never FRR. The overlay's `CELL_NAME` replacement applies to that DaemonSet's `fabric-api-csi` volume. Not part of the root `config/kustomization.yaml`: fabric-api is opt-in. See [docs/fabric-api/configuration.md](docs/fabric-api/configuration.md) and [docs/fabric-api/api.md](docs/fabric-api/api.md). -- **`config/fabric-router-controller/`** — `fabric-router-controller`, the fabric routing control plane. `kubectl apply -k config/fabric-router-controller/` applies only its ServiceAccount and RBAC; `base/` is its leader-elected Deployment, which compiles every fabric-class `BGPRouter` into immutable `FabricRouterRevision`s, and the `components/rollout` Component adds `--rollout` (one `FabricRouterDeployment` per router and the release-authorization controller). Its only Secret access is `get` in `galactic-system`, used to read the UID of each credential a released revision names, so a release refuses a revoked or missing one. The `components/topology` Component adds `--topology` and the only grant that lets it write `BGPPeer`s, a Role in `galactic-system` (the one namespace `--topology-namespace` serves): it generates each cell's fabric peers from `FabricTopology` relationships (mesh, route reflection, external) over `FabricEndpoint` records, one per router per transport network, which every cell of a routing domain holds for every cell's routers. Each cell generates only its own side from its copy of the records, so both ends agree only while every cell holds the same records and relationships (compare each topology's `status.recordsDigest` and `status.relationshipsDigest`). Generated peers carry labels and the topology's UID, never an owner reference, and a session is its router and address, so renames update a peer in place. It never touches a peer it did not create, and keeps a session it no longer generates until an end is retired, deleted (confirmed with the API server, after a settle period, and held when most of a topology's peers would go at once) or drained. Nothing writes the records but their authors today: there is no authoritative endpoint source (see [docs/fabric-routing/topology.md](docs/fabric-routing/topology.md)). The node side is the `config/fabric-router/components/activation` Component, which turns on `fabric-config-agent`'s activation path and mounts its host state directory. Opt-in, not part of the root `config/kustomization.yaml`. See [docs/fabric-routing/operations.md](docs/fabric-routing/operations.md). -- **`config/crd/`** and **`config/galactic-controller/`** — the consolidated `galactic.datumapis.com` CRDs and controller deployments. `galactic-controller --role=cell` serves the traffic-policy and pod-injection webhooks and reconciles the cloud resources; `--role=fabric` runs the central identity allocator with its own hub credentials. Apply the CRDs before either controller and follow [the API group migration guide](docs/migration/galactic-api-consolidation.md) for existing clusters. The node side of traffic policy remains in `galactic-router` with `GALACTIC_ROUTER_TRAFFIC_POLICY=true`. -- **`config/galactic-edge/`** — the Galactic Edge attachment lifecycle (see [the provider contract](docs/enhancements/networking/galactic-edge/contract.md)). Core is `galactic-controller --role=cell --edge` (`internal/edge/attachment`): it admits each `EdgeAttachment` from uncached reads of its `EdgeService`, `EdgeInstance`, Pod, VPC and `EdgeProvider`, allocates its address from the service's `clientPool` into the service's `status.allocations` with a resourceVersion precondition, drains it (`Draining`, deleted after `drainSeconds`) when its authority ends, and holds it with a finalizer until its node reports `Released`; missing tenant state refuses, never defaults. The node half is the `galactic-edge` DaemonSet (`cmd/galactic-edge`, `internal/edge/agent`) on nodes labeled `galactic.datumapis.com/node=edge` and `galactic.datumapis.com/edge=enabled`: it finds each provider pod's network namespace through the CRI socket, programs the attachment with `hostattach`, registering the host link under its VPC's existing uSID entry, with its traffic policy row, before the link comes up, reads it back, then reports `Programmed`; on deletion it releases only links stamped with that attachment's ID. It also keeps a local pass-through `egress_route_table` entry, owned by `egressroutemap.PassThroughEdge`, for each link's address, each prefix whose gate is open on it and each prefix of a route accepted on the node for its attachment and not released, so the VPC's workloads on the same node reach them, or are dropped at the VRF's unreachable default while the gate is closed, instead of matching the VPC's `::/0` shard route, and `galactic-router`'s withdrawals leave those entries; the address itself is never published. Every VPC on the node is one write-fence scope (`internal/edge/ownership`, host directory `/var/lib/galactic-edge/ownership`), taken over with Fence and Adopt on restart. An edge attachment joins its VPC's canonical host VRF, so `galactic-router`'s GC keeps that VRF and its `BGPVRFInstance` while an `EdgeAttachment` on the node is not `Released` or a stamped link remains, and deletes them only under the VPC's fence after checking again (`internal/edge/maintenance`); `galactic-router` mounts the same directory, and without it GC reclaims no VRF or `BGPVRFInstance`. `galactic-cni`'s `vrf_table` sweep keeps every entry a stamped edge link resolves to. No lab or end-to-end environment deploys the agent yet; the real-kernel unit tests run it. Forwarding beyond an attachment's own address is claimed per prefix: a provider renews its instance's lease, a `coordination.k8s.io/v1` Lease the `EdgeInstance` owns, and claims an `EdgeRoute` (`internal/edge/provider`), core accepts one holder per prefix through the VPC's `EdgeRouteIndex` (`internal/edge/route`), and the agent keeps that prefix's forwarding gate in the uSID datapath open only until the lease's deadline, so forwarding stops on time with the provider, agent or API server stalled; see the contract's Forwarding claim, Acceptance and Timing sections. A route is refused, or revoked, when it overlaps a workload subnet of the VPC, another service's client pool or another attachment's address, or when an earlier service's granted prefixes overlap its own service's: grants are exclusive in a VPC. Core publishes each accepted route as a `BGPAdvertisement` in `galactic-system` naming the holder's host link, and `galactic-router` advertises it only while that link's gate for the prefix is open on its node, polled every 250 ms from the pinned map (contract's Prefix conflicts and Publication sections). `galactic-router`'s traffic policy reconciler binds to each link the policies the attachment's `EdgeService` names in `spec.trafficPolicy`, resolved in the service's namespace (see [Edge attachments](docs/traffic-policy/node.md#edge-attachments)). Core also reports `Admitted` and `TrafficPolicyResolved` on each `EdgeService` and, per approved `EdgeProvider`, keeps a binding of the `galactic-edge-provider` ValidatingAdmissionPolicy (the provider as its parameter) and RoleBindings of the `galactic-edge-provider` ClusterRole for its listed ServiceAccounts, removed when approval is withdrawn. `kubectl apply -k config/galactic-edge/`, which must precede `--edge`, applies the agent's ServiceAccount and RBAC, the controller's edge role (with a Role in `galactic-system` for the route advertisements), that ClusterRole and the policies, which hold a provider ServiceAccount to its own `providerRef`, namespace and pod (a route to its claiming pod, which another pod may only replace at a higher epoch, and an instance's Lease to its pod), hold every writer of an instance Lease to the claim's ordering (`galactic-edge-lease`), and hold each `galactic-edge` status write to its own node (a route's only `closedEpoch`); `base/` needs a per-cell `--mtu` overlay. Opt-in, not part of the root `config/kustomization.yaml`. Diagnostics (`internal/edge/diag`): core and the agent record one Warning Event per transition into a failed stage (admission, allocation, programming, policy, route, and each open gate the agent closes, with its cause), whose note ends in fixed `key=value` correlation fields (provider, service, attachment and pod UIDs, node, route, prefix, epoch), and export `galactic_edge_foundation_*` state and failure metrics labeled only by approved provider, state, stage, cause and reason; [docs/edge/troubleshooting.md](docs/edge/troubleshooting.md) walks them. -- **`config/monitoring/`** — Prometheus Operator resources for BGP and NAT: a `fabric-router` PodMonitor (frr-exporter, port `frr-metrics`/`9342`, as `job=fabric-router`; fabric-config-agent, port `agent-metrics`/`9343`, as `job=fabric-config-agent`), a `galactic-router` PodMonitor covering both roles (port `metrics`/`9179`), a `galactic-nat` PodMonitor for the egress shards (port `metrics`/`9182`), each adding a `node` label, and the `galactic-bgp` PrometheusRule: underlay session down, administratively down for an hour, flapping, received prefixes halved, exporter collector or scrape failing, a session announcing an IPv4-mapped next hop, BGP routes not installed, the agent's metrics scrape down, a `galactic-router` BMP station or metrics scrape down, `galactic-router` routes failing to install, an egress shard's session table evicting live sessions, an egress shard out of masquerade ports, a stalled or persistently lossy NIC receive queue on a `galactic-nat` uplink (#673), and a `galactic-nat` metrics scrape down. For fabric routing through the API it adds a `fabric-router-controller` PodMonitor (port `metrics`/`9185`, `honorLabels` so the fleet series keep their objects' `namespace`), whose leader exports `galactic_fabric_routing_*` (each `FabricRouterDeployment`'s source, epochs, heartbeat, conditions and staged candidate, each outstanding release, each fabric router's compile result) beside the agent's activation, staging, writer-lock and boot-source metrics on `9343`, and a `fabric-routing` rule group (no eligible recovery, otherwise degraded, recovery conflict, agent heartbeat stale on Shadow/CRD, failed release blocking its domain, release Unknown, handoff pending, promotion refused by the agent, candidate rejected, revision refused, the leader unable to read a kind from its cache, controller scrape down — each reads the fleet series over 2 minutes and aggregates away only `pod` and `instance`, so a leader change does not reset it and an alert keeps its `cluster` and other external labels, and none fires on a cluster that keeps its nodes on ConfigMaps). For Galactic Edge it adds `galactic-controller` (port `metrics`/`9184`) and `galactic-edge` (port `metrics`/`9186`) PodMonitors and a `galactic-edge` rule group (attachments not programmed, service policy unresolved, ownership scope lost, cleanup failing, scrape down). For the opt-in fabric-api it adds the `fabric-router` PodMonitor's `api-metrics` endpoint (the sidecar, port `api-metrics`/`9345`, as `job=fabric-api-node`), a `fabric-api-gateway` PodMonitor (port `metrics`/`9347`) and a `fabric-api` rule group (stalled execution, node diagnostics unavailable, nodes unreachable, oversized results, cleanup backlog, certificate renewal failing, credentials missing, search index unsynced, scrape down — none fires merely because nobody ran a query). Requires the `monitoring.coreos.com` CRDs, which this repo does not install, so it is not part of the root `config/kustomization.yaml`. `task test:alerts` unit-tests the rules with `promtool` (`config/monitoring/tests/`). Every alert carries what infra's alerting standard checks for (`service: galactic`, `team: connect`, `runbook_url` into infra's `docs/runbooks/galactic/README.md`). The PrometheusRule here is the tested source, not where the rules run on Datum's infra: there the PodMonitors are converted and scraped on each edge cluster, but edge vmalert never notifies, so infra evaluates a copy of the rules centrally. Change the rules here first, with their tests, then update infra's copy. -- **`deploy/containerlab/`** — ContainerLab topology (`gvpc.clab.yaml`) for three Kind clusters (dfw, iad, sjc) wired over an SRv6 transit mesh whose underlay is dual-stack — every transit link and loopback carries an IPv4 and an IPv6 address, with one BGP session per address family (the SRv6 data plane itself stays IPv6-only; tenant IPv4 rides inside the encapsulation). Each site has one `compute` worker and at least one `edge` worker (dfw has two); every worker has its own eBGP uplink to its site's transit router, with FRR running as a hostNetwork DaemonSet. `galactic-router` (plain mode) distributes EVPN paths over iBGP to one route reflector for the whole lab (`iad-worker3`, `config/galactic-router/overlays/control/`) — compute and edge nodes never peer directly. Every `edge` node runs an egress shard (`galactic-nat`) and a `galactic-gateway`, which share the node's uplinks through its XDP dispatcher (`GALACTIC_NAT_XDP_ATTACH=dispatch`). Each site's compute node egresses only through its own site's edge shards, and each site has its own VIP `/64`, served only through its own edge nodes to one `ns60` backend in that site. A standalone off-cluster host on the fourth transit router gives tenant egress a real destination and is the client for the VIP checks (`verify:gateway-ingress`, and `verify:gateway-ingress-ipv4` for each site's IPv4 VIP, which the IPv6-only backends serve through translation). The lab enforces interface traffic policy (production defaults to off): every tenant binds each attachment to a grant set in `resources/tenants/policies/`, and `verify:traffic-policy` proves each path's grant and denial. See `deploy/containerlab/README.md` and `deploy/containerlab/Taskfile.yaml` for bring-up commands. - -## New Developer Entry Points - -1. Run `task build` to verify toolchain; run `task test` to confirm unit tests pass. -2. Read `internal/cni/cni.go` (cmdAdd/cmdDel) to understand the container attach path and how `BGPAdvertisement` CRDs are created. See [ARCHITECTURE-CNI.md](docs/agents/ARCHITECTURE-CNI.md). -3. Read `internal/controller/` for the controller-runtime reconcilers (BGPRouter, BGPPeer, BGPAdvertisement, BGPPolicy, BGPVRFInstance, Node, Secret) plus garbage collection (`gc_controller.go`, backed by `internal/gc/`). Read `internal/reconcile/reconcile.go` to understand how the BGPRouter CRD is translated into a `DesiredRouter` applied to the runtime. See [ARCHITECTURE-ROUTER.md](docs/agents/ARCHITECTURE-ROUTER.md). -4. Read `internal/runtime/gobgp/runtime.go` to understand how `DesiredRouter` is applied to GoBGP. -5. Read `internal/plumbing/intf/intf.go` to understand SRv6 endpoint encoding, interface naming, and base62↔hex conversion. -6. Explore `internal/plumbing/` for shared kernel and network primitives (VRF, sysctl, interface naming, SRv6). -7. Read `internal/gateway/engine.go` and `internal/controller/networkgateway_controller.go` to understand the edge XDP DSR load balancer's convergence loop and anycast VIP advertisement. See [ARCHITECTURE-GATEWAY.md](docs/agents/ARCHITECTURE-GATEWAY.md). -8. See `docs/cni/README.md` for the CNI docs entry point — configuration reference (env vars, conflist fields, worked examples) and Mermaid sequence diagrams for the attach path and garbage collection. `docs/agent-startup.md` covers router startup, and `docs/router/configuration.md` documents router environment variables. -9. Read [docs/node-labels.md](docs/node-labels.md) to understand which `galactic.datumapis.com/*` labels put which DaemonSets on which nodes, and how gateway and NAT opt in on edge nodes — this cuts across all five binaries and isn't owned by any single component's architecture doc. -10. See [docs/reference.md](docs/reference.md) for a quick-reference table of every deployable asset in `config/` and every TCP port its containers configure — useful when checking for a port collision or confirming what `kubectl apply -k config//` actually applies before diving into any single component's doc. -11. Read [docs/agents/ARCHITECTURE-FABRIC-API.md](docs/agents/ARCHITECTURE-FABRIC-API.md), then `internal/fabric/gateway/reconciler.go` (the `FabricQuery` lifecycle) and `internal/fabric/node/server.go` (the sidecar's request pipeline) to understand the fabric looking glass; `internal/fabric/query` defines what a query means. [docs/fabric-api/configuration.md](docs/fabric-api/configuration.md) is the operator reference (flags, identities, limits, rollout) and [docs/fabric-api/api.md](docs/fabric-api/api.md) the `FabricQuery` contract. +Run the additional checks appropriate to the changed subsystem. Report skipped +or unavailable checks explicitly. The unprivileged suite does not establish +kernel datapath correctness, and a lab result does not establish production +qualification. + +- Keep Go formatting and imports consistent with `.golangci.yaml`. +- Never hand-edit committed protobuf bindings (`*.pb.go`, `*_grpc.pb.go`). +- Regenerate CRDs, deepcopy methods and API references when their sources change. +- Use `.yaml`, never `.yml`. +- Align Markdown tables as required by the coding conventions. +- Use Conventional Commits. Keep the subject at most 72 characters. + +## Ownership and deployment constraints + +Galactic reads and writes the consolidated `galactic.datumapis.com` resources. +The NSO cell manager owns VPC/attachment/subnet reconciliation and NAD generation +when Galactic integration is enabled. Galactic's cell controller owns BGP status +projection, admission and traffic-policy resolution, with opt-in Edge controllers. +Its fabric role runs the central identity allocator separately with hub and IPAM +credentials. Check command registration before inferring ownership from package +names or historical documentation. + +`config/kustomization.yaml` includes only the namespace, CNI and router resources. +Install CRDs first. Underlay, controllers, gateway, NAT, fabric diagnostics, +monitoring and Edge have separate prerequisites. Read their deployment guides +before changing composition; several top-level component Kustomizations apply +only RBAC and deliberately exclude bases requiring deployment-specific values. + +[Node labels](docs/operations/node-labels.md) are the canonical placement rules. +`node=compute` and `node=edge` are roles; `galactic=router|control` and +`fabric=router|control` are independent mode enums. Gateway, NAT and Edge require +their own opt-ins on edge nodes. Sharing an uplink's XDP hook also requires the +correct dispatcher configuration; consult [XDP mode](docs/operations/xdp-attach-mode.md). + +Production images and the configuration bundle are published by +`.github/workflows/publish.yaml` using per-component Dockerfiles. `task build` +does not publish a release. The CNI Dockerfile is also used by the e2e test. + +## Documentation changes + +Follow [documentation maintenance](docs/development/documentation.md). Update a +canonical guide instead of appending another copy of configuration tables or +incident history here. Keep current behavior, proposed work and dated evidence +distinct. Preserve useful compatibility links when moving pages, and regenerate +rendered diagrams with their sources. diff --git a/README.md b/README.md index 7777fd1ce..bedd00329 100644 --- a/README.md +++ b/README.md @@ -1,147 +1,45 @@ # Galactic -**Multi-cloud networking for Kubernetes, simplified.** +Galactic supplies SRv6 networking for multi-cloud VPC workloads on Kubernetes. +Its CNI plugins attach containers and VMs, its routing controllers distribute +EVPN paths, and optional edge components provide ingress load balancing, +NAT66/NAT64 egress and provider attachments. -Galactic connects Kubernetes workloads across multiple clouds and regions as if they were on a single, unified network. It provides secure, isolated Virtual Private Clouds (VPCs) that span cloud boundaries—without vendor lock-in or complex configuration. +## Start here -## The Problem +- [Documentation](docs/README.md): guides organized by task and component. +- [System overview](docs/overview.md): components, packet paths and ownership. +- [Local lab](docs/getting-started.md): build and exercise the multi-cluster topology. +- [Development](docs/development/README.md): build, test and contribution workflow. +- [API reference](docs/api/README.md): generated resource documentation. -Modern organizations run workloads everywhere: AWS, Azure, GCP, on-premises, and edge locations. Each environment brings its own networking model, APIs, and constraints. The result is fragmented networks, operational complexity, and cloud provider lock-in. +## Build and test -## Our Approach +Use a Linux development environment with the Go version in `go.mod`, Task, +clang/LLVM and the required kernel headers. The +[development container](.devcontainer/galactic/) provides a starting environment. -Galactic provides the SRv6 data plane that makes multi-cloud VPC connectivity work at the kernel level. It runs as a DaemonSet agent on every node, managing SRv6 routes and VRF isolation, and as a CNI plugin that attaches pods to the correct virtual network. On nodes dedicated to the gateway role, a third component loads an edge XDP DSR (Direct Server Return) load balancer to handle L4 ingress at the VPC boundary. VPC and VPCAttachment definitions are managed by a companion operator; Galactic acts on the identifiers that operator assigns. - -Under the hood, Galactic uses Segment Routing over IPv6 (SRv6) for efficient, deterministic routing and Virtual Routing and Forwarding (VRF) for true network isolation at the kernel level. BGP is used to distribute SRv6 routes between agents across nodes and clusters. - -## Why Galactic - -**For Developers** — Attach to a VPC with a single annotation. No networking code, no cloud-specific APIs. - -**For Platform Teams** — Manage multi-cloud networking from Kubernetes using GitOps workflows and standard tooling. - -**For Organizations** — Move workloads between providers without network redesign. One networking model instead of N cloud-specific implementations. - -## Getting Started - -A ContainerLab environment is available under [`deploy/containerlab/`](./deploy/containerlab/): - -- **[`deploy/containerlab/`](./deploy/containerlab/)** — Three Kind clusters wired over an SRv6 transit mesh. The full GVPC multi-cluster environment with FRR underlay and GoBGP L3VPN overlay. - -See the [galactic DevContainer](./.devcontainer/galactic/) for development environment setup. On ARM64 / OrbStack, use the [containerlab DevContainer](./.devcontainer/containerlab-dood/) to run ContainerLab via Docker-out-of-Docker. - -### Production Deployment - -Manifests for a real cluster live under [`config/`](./config/), composed with [Kustomize](https://kustomize.io). One command deploys the `galactic-system` namespace (labeled `pod-security.kubernetes.io/enforce: privileged` — every DaemonSet here needs it, for hostPath volumes, hostNetwork, and elevated capabilities), the `galactic-cni` DaemonSet, and both `galactic-router` roles — the plain per-node role (`galactic-router`, runs on every `compute`/`edge` node except control-plane nodes, opt-in via `galactic.datumapis.com/galactic: router`) and `rr` (`galactic-router-rr`, the BGP route reflector, opt-in — stays at zero replicas until nodes are labeled `galactic.datumapis.com/galactic: control`): - -```bash -kubectl apply -k config/ -``` - -Each component can also be applied on its own, e.g. `kubectl apply -k config/galactic-router` for just the router (both roles) or `kubectl apply -k config/galactic-router/overlays/router` for just the default per-node role. - -Two components are **not** part of `kubectl apply -k config/` and must be applied separately, each with its own per-node prerequisite: - -- **`config/fabric-router/`** — the FRR underlay eBGP DaemonSet `galactic-router` depends on. -- **`config/galactic-gateway/`** — the edge XDP DSR load-balancer control plane, a single-container `galactic-gateway` DaemonSet on nodes labeled both `galactic.datumapis.com/node: edge` and `galactic.datumapis.com/gateway: enabled` (`galactic-router` runs there too, but as its own independent DaemonSet via `galactic.datumapis.com/galactic: router` — see `config/galactic-router/` above, not bundled into this pod). `kubectl apply -k config/galactic-gateway/` only installs the shared, cluster-safe ServiceAccount/RBAC; `config/galactic-gateway/base/` itself is a template meant to be instantiated once per gateway node by a further overlay (see `deploy/containerlab/resources/galactic-gateway/` for a worked example) — apply that overlay per node instead of `base/` directly. - -```bash -kubectl apply -k config/fabric-router/ -kubectl apply -k config/galactic-gateway/ -``` - -#### Prerequisites - -- **Container images.** `.github/workflows/publish.yaml` builds `ghcr.io/datum-cloud/galactic-cni`, `ghcr.io/datum-cloud/galactic-router`, `ghcr.io/datum-cloud/galactic-gateway`, and `ghcr.io/datum-cloud/fabric-router` (from `containers/galactic-cni/Dockerfile`, `containers/galactic-router/Dockerfile`, `containers/galactic-gateway/Dockerfile`, and `containers/fabric-router/Dockerfile` respectively) on every push and release — but it never publishes a `:latest` tag, only date-stamped tags per push/release (e.g. `v0.0.0-main-20260713-170924`) and, for tagged releases, semver tags. The `image:` references committed in `config/galactic-cni/daemonset.yaml`, `config/galactic-router/base/daemonset.yaml`, `config/galactic-gateway/base/daemonset.yaml`, and `config/fabric-router/daemonset.yaml` say `:latest` only as a placeholder that CI substitutes with a real published tag when it builds the `ghcr.io/datum-cloud/galactic-kustomize` OCI Kustomize bundle — that substitution never happens in the git checkout itself. Applying `config/` directly from a clone will therefore fail to pull `:latest`. Before applying, resolve the current tag (check the [package pages](https://github.com/orgs/datum-cloud/packages?repo_name=galactic) or the latest successful run of `publish.yaml` on `main`) and pin it, e.g.: - - ```bash - cd config/galactic-cni && kustomize edit set image ghcr.io/datum-cloud/galactic-cni=ghcr.io/datum-cloud/galactic-cni: - cd config/galactic-router/base && kustomize edit set image ghcr.io/datum-cloud/galactic-router=ghcr.io/datum-cloud/galactic-router: - cd config/galactic-gateway/base && kustomize edit set image ghcr.io/datum-cloud/galactic-gateway=ghcr.io/datum-cloud/galactic-gateway: - cd config/fabric-router && kustomize edit set image ghcr.io/datum-cloud/fabric-router=ghcr.io/datum-cloud/fabric-router: - ``` - -- **`config/fabric-router/`: one ConfigMap per node.** Unlike every other component under `config/`, `config/fabric-router/` has no generic default config — the underlay eBGP session (interface addresses, remote-AS, etc.) is different for every physical node, and this DaemonSet's `nodeAffinity` (`galactic.datumapis.com/fabric: router`) can legitimately match more than one node per cluster. Before applying `config/fabric-router/`, create one ConfigMap per matching node in the `galactic-system` namespace, named `fabric-router.` (`` is the Kubernetes node name, e.g. `fabric-router.worker-1`), with a `frr.conf` key holding that node's config. It may also carry `daemons` and/or `vtysh.conf` keys to override the defaults baked into the `fabric-router` image (see `containers/fabric-router/Dockerfile`); any other key is rejected. `fabric-config-agent` (in the same image) reads the node's ConfigMap from the API: its `frr-init` init container validates it with `vtysh -C` and installs it, holding the pod in `Init` with a `ConfigMissing` or `Rejected` event until a valid one exists; its `config-agent` sidecar then applies each later change with `frr-reload.py`, without restarting FRR or touching any other node. `deploy/containerlab/resources/fabric-router/{dfw,iad,sjc}/` are worked examples from the lab, not something you can apply as-is. - - ```bash - kubectl -n galactic-system create configmap fabric-router.worker-1 --from-file=frr.conf=./frr.conf.worker-1 - ``` - - **Migrating from the shared `fabric-config` ConfigMap.** A node with no `fabric-router.` ConfigMap still falls back to key `frr.conf.` of the old shared `fabric-config` ConfigMap (and its `daemons`/`vtysh.conf` keys), with a `DeprecatedConfigSource` warning event on the pod. The node's own ConfigMap always wins once it exists. Move every node to its own ConfigMap, then delete `fabric-config`; the fallback will be removed in a later release. - -- **`config/fabric-router/` and `config/galactic-router/`: rollouts are now automatic (`RollingUpdate`).** Both `config/fabric-router/daemonset.yaml` and `config/galactic-router/base/daemonset.yaml` use the DaemonSet default `updateStrategy` (`RollingUpdate`) rather than `OnDelete`, so a `kubectl apply` (new image tag, or a spec change) will restart pods on its own, one node at a time, gated only by each pod's liveness/health probe — which reflects "the process is up," not "the BGP session has reconverged." Watch session state after any rollout rather than assuming the controller's pacing was safe: for `fabric-router`, `vtysh -c "show bgp summary"` on the new pod; for `galactic-router`, the `BGPPeer` CRD's `STATE` column (`kubectl get bgppeer`) — there's no `vtysh` in that binary, it reports session state itself. For `galactic-router-rr`, every compute node's iBGP session pivots through that one pod, so its rollout is a fleet-wide route flap, not a single-node one; confirm every client has re-peered before considering it done. - - A ConfigMap edit doesn't trigger a rollout, and doesn't need one: the `config-agent` sidecar applies a change to a node's `fabric-router.` ConfigMap to that node's running FRR in place. Check the result with `kubectl -n galactic-system get events --field-selector involvedObject.name=fabric-router.`: `Applied` carries the hash of the `frr.conf` the node now runs, `Rejected` means the change failed `vtysh -C` and the node kept its previous config, and `ReloadFailed` means `frr-reload.py` failed and the agent is retrying. A change to `daemons` can't be applied live; it raises `RestartRequired`, and takes effect when that node's pod is deleted. The sidecar also resets any IPv6 session announcing an IPv4-mapped next hop and raises `MappedNextHopReset` on the pod. - -- **`config/galactic-gateway/`: per-node public interface and SRv6 address.** `config/galactic-gateway/base/daemonset.yaml`'s `galactic-gateway` container requires `GALACTIC_GATEWAY_PUBLIC_INTERFACE` and `GALACTIC_GATEWAY_SRV6_ADDRESS` — the latter must be unique per gateway node and has no generic default (there's no in-cluster mechanism yet that derives it automatically; see `internal/config/gateway.go`'s `EnvGatewaySRv6Address` doc comment). Applying `base/` as shipped, without pinning both per node, produces a crash-looping container. Instantiate `base/` via a further overlay that pins it to one node (`kubernetes.io/hostname`) and sets that node's values — see `deploy/containerlab/resources/galactic-gateway/` for a worked example. - -- **Talos: gRPC health port.** `galactic-router` runs `hostNetwork: true` and defaults to gRPC health checks on port `5000`, which collides with Talos's built-in dashboard (`/sbin/dashboard` permanently binds `127.0.0.1:5000` on every Talos node). `config/galactic-router/base/daemonset.yaml` already ships with `GALACTIC_ROUTER_GRPC_HEALTH_PORT=5179` (and matching probe/containerPort) to avoid this; if you run `galactic-router` outside these manifests on Talos, set `GALACTIC_ROUTER_GRPC_HEALTH_PORT` to something other than `5000` yourself. - -- **`galactic-router`: BGP local address.** The node needs a global-unicast IPv6 address assigned to `lo` (typically by `config/fabric-router/`'s underlay eBGP daemon, which must start and converge before `galactic-router`), or you must set `GALACTIC_ROUTER_BGP_LOCAL_ADDRESS` explicitly — this is required even when `GALACTIC_ROUTER_BGP_LISTEN_PORT=-1` (no inbound listener), since `galactic-router` still needs a source address for outbound BGP connections. Without one of these, startup fails with `GALACTIC_ROUTER_BGP_LOCAL_ADDRESS not set and no address could be detected on lo: no global-unicast IPv6 address found on lo`. See [`docs/router/configuration.md`](./docs/router/configuration.md) for details. - -See [`docs/router/configuration.md`](./docs/router/configuration.md) for the full `galactic-router` CLI flag / environment variable reference — env var names follow `GALACTIC_ROUTER_` (hyphens become underscores, uppercased); the reference table has the exact name for every flag. - -## Development - -This project uses [Task](https://taskfile.dev) as its build tool. Build, test, and lint operations are defined in the root `Taskfile.yaml`. - -### Install Task - -```bash -# macOS -brew install go-task - -# Linux (official installer) -sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin - -# Go toolchain -go install github.com/go-task/task/v3/cmd/task@latest +```sh +task build +task test:unit ``` -See [taskfile.dev/installation](https://taskfile.dev/installation/) for the full list of options. +Before opening a PR, run `task ci`. It includes a Kind lifecycle test and needs +Docker and the host networking prerequisites. Root-gated tests and feature +acceptance checks are additional tiers; see the [development guide](docs/development/README.md). -### Usage +## Deployment -```bash -task # list available tasks -``` +Reusable Kubernetes manifests live in [config/](config/). The root Kustomization +includes the namespace, CNI and both tenant-router roles. It does not install +CRDs or assemble the underlay, controllers, optional edge services and +observability into a complete production deployment. -#### Building - -```bash -task build # produces bin/{galactic-cni,galactic-veth,galactic-tap,galactic-ipam, - # galactic-bgp,galactic-route,galactic-router,galactic-gateway} -task lint # golangci-lint + yamlfmt; lint-fix applies safe auto-fixes -task ci # full pipeline: lint → build → test:unit → test:e2e -``` - -There is no `task docker-build` — the shared production Dockerfile and release -workflow were removed (see Production Deployment above). `containers/galactic-cni/Dockerfile` -exists only to support `task test:e2e` below. - -#### Testing - -```bash -task test # run unit tests then e2e tests (requires Docker + Kind) -task test:unit # unit tests only — race detector, coverage output -task test:e2e # full e2e lifecycle — spins up a Kind cluster, builds and - # loads the image, then tears the cluster down on exit -``` - -`task test:unit` is the fast path for development; it runs the same command as the CI `test-unit` job. `task test:e2e` requires Docker and Kind and mirrors the CI `test-e2e` job exactly, including automatic cluster cleanup via a `trap` on exit. - -Run `task ci` before opening a pull request. - -The lab environment has its own `Taskfile.yaml`; run `task` from `deploy/containerlab/` to see available tasks. - -## Contributing - -See [AGENTS.md](./AGENTS.md) for the contributor guide (development workflow, code standards, architecture pointers) and its [Architecture Reference](./AGENTS.md#architecture-reference) section for links to the full per-component architecture docs (CNI, router, gateway). +Follow the [component guides](docs/README.md#component-guides) and +[shared operations](docs/operations/README.md) for prerequisites, node opt-ins +and per-site overlays. Existing installations changing API groups must follow +the [migration guide](docs/operations/migrations/galactic-api-consolidation.md). ## License -See [LICENSE](./LICENSE) for details. - ---- - -*Galactic is developed by [Datum](https://datum.net).* +See [LICENSE](LICENSE). diff --git a/docs/README.md b/docs/README.md index 9dd0dc375..c7fb935a2 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,110 +1,45 @@ -# Galactic Docs - -Index of everything under `docs/`. `AGENTS.md`/`CLAUDE.md` at the repo root -is the primary entry point for working in this codebase (architecture -reference table, dev workflow, deployment overview) — start there first. -This page exists to help you find a specific document once you already know -roughly what you're looking for. - -## Architecture — the "why" and internal design - -One self-contained reference per binary/subsystem (layout, entry points, -data flow, module reference, known constraints): - -- [agents/ARCHITECTURE-CNI.md](agents/ARCHITECTURE-CNI.md) — the CNI attach - chain (`galactic-cni`, `-veth`, `-tap`, `-ipam`, `-bgp`, `-route`). -- [agents/ARCHITECTURE-ROUTER.md](agents/ARCHITECTURE-ROUTER.md) — the - BGP/EVPN control plane (`galactic-router`, embedded GoBGP, GC). -- [agents/ARCHITECTURE-GATEWAY.md](agents/ARCHITECTURE-GATEWAY.md) — the edge - XDP DSR load balancer (`galactic-gateway`, `NetworkGateway`/`NetworkService`). -- [agents/ARCHITECTURE-FABRIC-API.md](agents/ARCHITECTURE-FABRIC-API.md) — the - fabric looking glass (`fabric-api`: the `fabric-router` sidecar, the cell - gateway, `FabricQuery` execution, mTLS identities). -- [agents/ARCHITECTURE.md](agents/ARCHITECTURE.md) — superseded by the first - three documents above; kept only as a redirect for old links. -- [agents/CONVENTIONS.md](agents/CONVENTIONS.md) — Go naming, error - handling, testing patterns, linting, and commit-message conventions - enforced across every binary. -- [node-labels.md](node-labels.md) — the `galactic.datumapis.com/*` - node-labeling scheme shared across `galactic-cni`, `-router`, `-gateway`, - `-nat66`, and `fabric-router`; cross-cutting, owned by no single component. -- [architecture/README.md](architecture/README.md) — C4-model diagrams (system - context, container) rendered from PlantUML sources. - -## Configuration — the "how" of deploying and operating each binary - -- [router/configuration.md](router/configuration.md) — `galactic-router` - env vars/CLI flags and DaemonSet examples. -- [router/private-service-routes.md](router/private-service-routes.md) — the - direct-endpoint contract for `ServiceEndpoint`, producer selection, and why - consumers receive no guest-visible service route. -- [gateway/configuration.md](gateway/configuration.md) — `galactic-gateway` - deployment (node labeling, RBAC, per-node overlay), its config reference, - and the `NetworkGateway`/`NetworkService`/`ServiceVIPBinding` CRD fields. -- [gateway/backend-health.md](gateway/backend-health.md) — how a - `NetworkService`'s backends are health-checked and an unhealthy one is - taken out of every gateway node's Maglev table. -- [nat/configuration.md](nat/configuration.md) — `galactic-nat` placement - (edge nodes, sharing the uplinks' XDP hook with the gateway), config - reference, the `EgressShard` CRD, and the `galactic-cni`-side shard - membership settings that point tenant nodes at it. -- [fabric-api/configuration.md](fabric-api/configuration.md) — `fabric-api` - deployment: prerequisites (cert-manager csi-driver, the per-cell `Issuer`), - flags and env vars for `node`/`gateway`/`janitor`/`query`, ports, mTLS - identities and rotation, limits, probe source and destination rules, cleanup, - alerts, and sidecar rollout. -- [fabric-api/api.md](fabric-api/api.md) — the internal `FabricQuery` contract - (`galactic.datumapis.com/v1alpha1`): spec, target rules, lookup and - observation semantics, conditions, and typed error codes. -- [fabric-api/load-test.md](fabric-api/load-test.md) — the full-table load test - that gates AS-path and community searches: method, how to run it - (`task test:fabric-api-load`), and the results for direct FRR scans versus the - BMP-fed search index. -- [traffic-policy/controller.md](traffic-policy/controller.md) — - `galactic-controller --role=cell`: the TrafficPolicy webhook, the reserved - default policy, binding resolution status, flags and install order. -- [traffic-policy/rollout.md](traffic-policy/rollout.md) — turning traffic - policy on in a cell: install order, writing grants, auditing with the - counters before enforcing, and backing out. -- [traffic-policy/node.md](traffic-policy/node.md) — galactic-router's node - side: enabling it, what each binding applies, per-node status, the - `galactic_cni_traffic_policy_*` metrics and the `policy explain` and - `policy show` diagnostics. -- [api/galactic.md](api/galactic.md) — the generated `galactic.datumapis.com` - API reference (TrafficPolicy, TrafficPolicyBinding). -- [cni/README.md](cni/README.md) — entry point for the `galactic-cni` docs - subtree; from there: - - [cni/environment-variables.md](cni/environment-variables.md) — every - `GALACTIC_CNI_*`/`GALACTIC_IPAM_*` env var and conflist `HostConf` field. - - [cni/conflist-reference.md](cni/conflist-reference.md) / - [cni/conflist-examples.md](cni/conflist-examples.md) — the conflist field - reference and worked, copy-pasteable examples. - - [cni/cni-cmd-sequence.md](cni/cni-cmd-sequence.md) / - [cni/gc-cmd-sequence.md](cni/gc-cmd-sequence.md) — Mermaid sequence - diagrams for the attach/detach path and orphan garbage collection. - -## Observability - -- [metrics.md](metrics.md) — every Prometheus metric for the VPC dataplane, - VPC ingress, routing and NAT: labels, label values and the shipped alerts, - with PromQL for dashboards and monitors. -- [edge/troubleshooting.md](edge/troubleshooting.md) — finding the lifecycle - stage a Galactic Edge attachment or route stopped at, the objects involved - and a prefix's current owner, from conditions, Events and metrics. - -## Proposals and exploratory design - -Not descriptions of what's implemented today — read the architecture docs -above for that. - -- [enhancements/proposals/masque-gateway-design.md](enhancements/proposals/masque-gateway-design.md) - — an alternative MASQUE/QUIC/Iroh-based ingress gateway design, distinct - from the implemented `galactic-gateway` (XDP DSR over a Maglev ring). -- [enhancements/networking/latency-aware-routing/README.md](enhancements/networking/latency-aware-routing/README.md) - — latency-aware SRv6 path selection as a tenant-facing routing policy. - `status: provisional`, `stage: alpha`. -- [enhancements/networking/interface-traffic-policy/README.md](enhancements/networking/interface-traffic-policy/README.md) - — per-interface ingress and egress traffic policy, deny by default and - enforced in the CNI datapath. `status: provisional`, `stage: alpha`. -- [enhancements/networking/galactic-edge/README.md](enhancements/networking/galactic-edge/README.md) — proposed shared foundation for authorized provider attachments, tenant isolation, and exclusive forwarding ownership. -- [enhancements/networking/galactic-edge/contract.md](enhancements/networking/galactic-edge/contract.md) — proposed provider contract: resources, writers, lifecycle, timing bounds and the failure-test matrix. +# Galactic documentation + +Galactic connects VPC workloads through SRv6, BGP and Linux networking. Start +with the [system overview](overview.md) for components and ownership, or +[run the local lab](getting-started.md) to exercise the packet paths. + +## Find a task + +| I want to… | Start here | +| ---------------------------------------------------- | -------------------------------------------------------------------------------------- | +| Understand components and packet paths | [Overview](overview.md), [system diagrams](architecture/README.md) | +| Build, test or contribute | [Development](development/README.md), [coding conventions](development/conventions.md) | +| Run a complete development environment | [Local lab walkthrough](getting-started.md) | +| Deploy or operate a component | The component guides below and [shared operations](operations/README.md) | +| Inspect metrics and alerts | [Observability](observability/README.md) | +| Look up API resources | [API reference index](api/README.md) | +| Evaluate a proposal or remaining implementation work | [Designs](designs/README.md) | +| Find a dated review or test result | [Archive](archive/README.md) | +| Change this documentation | [Documentation maintenance](development/documentation.md) | + +## Component guides + +| Area | Architecture and behavior | Configuration and operation | +| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Workload attachment | [CNI overview](cni/README.md), [architecture](cni/architecture.md), [ADD/DEL](cni/cni-cmd-sequence.md), [garbage collection](cni/gc-cmd-sequence.md) | [Chain configuration](cni/configuration.md), [environment](cni/environment-variables.md), [conflist fields](cni/conflist-reference.md), [examples](cni/conflist-examples.md) | +| Tenant routing | [Router architecture](router/architecture.md) | [Router configuration](router/configuration.md) | +| Public ingress | [Gateway architecture](gateway/architecture.md), [backend health](gateway/backend-health.md) | [Deployment](gateway/deployment.md), [configuration](gateway/configuration.md) | +| Public egress | [Active/active egress](nat/active-active.md) | [Deployment](nat/deployment.md), [configuration](nat/configuration.md), [rollout and rollback](nat/active-active-rollout.md) | +| Cluster controllers | [Cell and fabric roles](controller/README.md) | [API migration](operations/migrations/galactic-api-consolidation.md) | +| Interface traffic policy | [Node behavior](traffic-policy/node.md), [cell behavior](traffic-policy/controller.md) | [Rollout and rollback](traffic-policy/rollout.md) | +| Underlay and fabric routing | [Fabric routing index](fabric-routing/README.md), [topology](fabric-routing/topology.md) | [Operations](fabric-routing/operations.md) | +| Fabric diagnostics | [Fabric API index](fabric-api/README.md), [architecture](fabric-api/architecture.md), [query API](fabric-api/api.md) | [Deployment](fabric-api/deployment.md), [configuration](fabric-api/configuration.md), [operations](fabric-api/operations.md), [load test](fabric-api/load-test.md) | +| Provider attachments | [Edge index](edge/README.md), [provider contract](edge/provider-contract.md) | [Troubleshooting](edge/troubleshooting.md) | +| Private services | [Private-service routing](private-services/README.md) | Configuration and qualification limits are recorded in the same guide. | + +## Reading status correctly + +Component guides describe the current repository. A feature may still be +disabled by default or require deployment-specific qualification. Designs state +their implementation status; historical reviews and measurements retain their +original scope and date. None of those is a substitute for a release's rollout +and acceptance checks. + +The legacy `agents/`, `enhancements/` and other moved paths contain compatibility +pointers for existing links. Use the canonical pages indexed here for new links. diff --git a/docs/agents/ARCHITECTURE.md b/docs/agents/ARCHITECTURE.md index 30d8e9f86..c8733e403 100644 --- a/docs/agents/ARCHITECTURE.md +++ b/docs/agents/ARCHITECTURE.md @@ -1,30 +1,5 @@ # Architecture -> **Superseded.** This document has been split into three component-scoped -> architecture references. This file is kept only as a redirect for old -> links; it carries no content of its own and will not be updated further. - -_Last updated: 2026-09-09_ - -Galactic now ships four binaries per node (the third and fourth only on -dedicated gateway-role `edge` nodes); three of them have -their own architecture document: - -| Document | Covers | -| -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | -| [ARCHITECTURE-CNI.md](ARCHITECTURE-CNI.md) | The CNI attach chain — `galactic-cni` (installer), `galactic-veth`, `galactic-tap`, `galactic-ipam`, `galactic-bgp`, `galactic-route` | -| [ARCHITECTURE-ROUTER.md](ARCHITECTURE-ROUTER.md) | The BGP/EVPN control plane — `galactic-router` | -| [ARCHITECTURE-GATEWAY.md](ARCHITECTURE-GATEWAY.md) | The edge XDP DSR load balancer — `galactic-gateway`, `NetworkGateway`/`NetworkService` | -| [ARCHITECTURE-FABRIC-API.md](ARCHITECTURE-FABRIC-API.md) | The fabric looking glass — `fabric-api` (`node` sidecar, cell `gateway`, `janitor`), `FabricQuery` | - -The fourth, `galactic-nat` (sharded stateful egress translation, `EgressShard`), -has no architecture document of its own yet — see -[docs/nat/configuration.md](../nat/configuration.md) for its -configuration reference in the meantime. - -Separately, `fabric-api` (the fabric looking glass: a sidecar in each -`fabric-router` pod plus a per-cell gateway) was added after this split and has -its own document, [ARCHITECTURE-FABRIC-API.md](ARCHITECTURE-FABRIC-API.md). - -See [AGENTS.md](../../AGENTS.md#architecture-reference) for guidance on -which document to start from for a given task. +Start with the [system overview](../overview.md), then the component guide linked +from the [documentation index](../README.md). The [system diagrams](../architecture/README.md) +show the relationships between components. This path remains for old links. diff --git a/docs/agents/CONVENTIONS.md b/docs/agents/CONVENTIONS.md index e79b7e033..b82c96e27 100644 --- a/docs/agents/CONVENTIONS.md +++ b/docs/agents/CONVENTIONS.md @@ -1,234 +1,5 @@ -# Coding Conventions +# Coding conventions -This document defines the coding standards, naming rules, error handling patterns, testing conventions, and idioms enforced across this codebase. All contributors must follow these rules. Automated checks (golangci-lint) enforce many of them; the rest are enforced in code review. - ---- - -## Go - -### Module and package layout - -- Module: `go.datum.net/galactic` -- `cmd/galactic-cni/main.go` — CNI installer entry point; a cobra command (no viper) with `init`/`run` subcommands wrapping `internal/installer.Bootstrap`/`Run` for the DaemonSet. Never itself a CNI plugin. -- `cmd/galactic-veth/main.go` — CNI plugin entry point; a cobra command (no viper) with the plugin invocation on the root command (calls `cni.RunPlugin()`), no other subcommands -- `cmd/galactic-router/main.go` / `root.go` — router entry point; `main.go` is a thin wrapper, startup logic (reads `GALACTIC_ROUTER_NODE_NAME`, starts the controller-runtime manager) lives in `root.go` -- `internal/plumbing/` — low-level kernel and network primitives shared between router and CNI (`intf`, `srv6`, `sysctl`, `vrf`) -- `internal/controller/` — controller-runtime reconcilers (BGPRouter, BGPPeer, BGPAdvertisement, BGPVRFInstance, BGPPolicy, Secret, Node, GC); also contains field index registration (`indexer.go`) and CRD status helpers (`status.go`) -- `internal/reconcile/` — CRD → DesiredRouter translation -- `internal/runtime/` — RouterRuntime interface; `gobgp/` (the only backend) -- `internal/gc/` — orphaned `BGPAdvertisement`/`BGPVRFInstance` CRD and stale kernel VRF cleanup, invoked by the GC controller's ticker -- `internal/cni/` — CNI plugin (`cmdAdd`/`cmdDel`/`cmdCheck`, split across `ops_add.go`/`ops_del.go`/`ops_check.go`/`bgp.go`); `ipam/`, `route/`, `tap/`, `veth/` subpackages -- `internal/installer/` — support for `galactic-cni`'s `init`/`run` subcommands (binary staging, conflist/kubeconfig templating, credential refresh, gRPC health server); not a subpackage of `internal/cni` -- `internal/model/` — internal BGP model types -- `internal/hash/` — SHA-256 change detection over DesiredRouter -- `internal/metadata/` — build-time version vars (`Version`, `GitCommit`, etc.) stamped via `-ldflags` - -There is no dedicated metrics package — `cmd/galactic-router/root.go` wires -controller-runtime's built-in `metricsserver.Options` to expose Prometheus metrics; -`prometheus/client_golang` is only an indirect dependency pulled in transitively. - -Place new code in `internal/` unless it must be imported by an external caller. Prefer creating a focused sub-package over adding to an existing large one. - -### Import grouping - -Use three groups, separated by blank lines: - -1. Standard library -2. Third-party and Kubernetes packages -3. Internal packages (`go.datum.net/galactic/...`) - -`goimports` enforces this automatically, with `gci` grouping standard library, -then `go.datum.net`-prefixed packages, then everything else (see `.golangci.yaml`). -Alias imports use a short, descriptive name — typically the API group + version -for generated clients (`metav1`, `corev1`, `bgpv1alpha1` for -`go.datum.net/galactic/api/network/v1alpha1`, `apierrors`, `clientgoscheme`, -`utilruntime`) or a package-role name to disambiguate collisions -(`vrfpkg`, `galacticruntime`). - -```go -import ( - "context" - "fmt" - - "google.golang.org/grpc" - - "go.datum.net/galactic/internal/plumbing/intf" -) -``` - -### Naming - -| Element | Convention | Example | -|---------|-----------|---------| -| Package | lowercase, single word, matches directory | `package srv6` | -| Exported type | `CapWords` | `PoolAllocator` (`internal/cni/ipam`) | -| Exported function / method | `CamelCase` | `RouteIngressAdd` | -| Unexported function / method | `camelCase` | `parseSID`, `addIngressRoute` (`internal/plumbing/srv6`) | -| Exported constant | `CamelCase`, descriptive | `BGPPolicyDirectionImport` (`internal/model`, re-exports the BGP API enum) | -| Test package | same package as norm; `_test` for the rare external-test case | `package cni` (internal, the norm); `package intf_test` (external, `internal/plumbing/intf`) | -| K8s API import aliases | domain-prefixed group-version | `bgpv1alpha1`, `metav1`, `corev1` | - -Do not use `_` in Go identifiers except in test package names. - -### Docstrings - -A function or method docstring describes the function itself: what it does, -what its parameters mean, and what it returns — including the error -conditions it can produce. Nothing else belongs in it. - -- Do not describe historical context: no "used to do X", "replaced an - earlier Y design", "added after an incident", or any other narration of - how the function changed over time. That belongs in the commit message - that made the change, not in text every future reader has to read. -- Do not link out to other documents for context: no URLs, no "see - docs/...", no "see ARCHITECTURE-*.md". A docstring must stand on its own — - a reader should never have to leave the function to understand its - contract. Design rationale that genuinely needs a home belongs in the - relevant `docs/agents/ARCHITECTURE-*.md`'s own sections, not folded into - the docstring. -- Do not name specific deployment environments, infra vendors, or site names, - and do not claim something was "found live in production" — describe the - general mechanism and failure mode a function guards against, not the - specific incident or platform that surfaced it. -- Keep it short: state the contract in as few sentences as the behavior - actually requires. - -```go -// Good — the function, its inputs, and its output, nothing else -// resolveBGPLocalAddress returns explicit when non-empty, and otherwise calls -// detect to read the BGP local address from the host's loopback. A detection -// failure is an error; there is no silent fallback to an unset address. -func resolveBGPLocalAddress(explicit string, detect func() (string, error)) (string, error) { ... } - -// Bad — historical narrative and an external link instead of the contract -// resolveBGPLocalAddress was added when the router moved off a hardcoded -// address; see docs/router/configuration.md for the full migration history. -// It used to just read GALACTIC_ROUTER_BGP_LOCAL_ADDRESS directly... -func resolveBGPLocalAddress(explicit string, detect func() (string, error)) (string, error) { ... } -``` - -This applies to exported and unexported function/method docstrings alike. - -### Error handling - -- Wrap errors with context using `fmt.Errorf("what failed: %w", err)`. The context string must complete the sentence "could not ``". -- Collect multiple independent errors with `errors.Join(errs...)` and return the joined error. -- Never swallow errors silently. If an error truly cannot be actionable, log it before discarding. -- Do not add error handling for scenarios that the code guarantees cannot happen. - -```go -// from internal/cni/ops_check.go:cmdCheck — multiple independent checks -var errs []error -if err := checkGuestInterface(args.Netns, guestName); err != nil { - errs = append(errs, fmt.Errorf("guest interface %q: %w", guestName, err)) -} -if err := checkTerminationRoutes(pluginConf.VPC, pluginConf.VPCAttachment, pluginConf.Terminations); err != nil { - errs = append(errs, fmt.Errorf("termination routes: %w", err)) -} -if len(errs) > 0 { - return fmt.Errorf("CHECK failed: %w", errors.Join(errs...)) -} -``` - -### Constants - -Define sentinel / limit values as typed or untyped constants at package level, grouped in a `const (...)` block when there are several related ones. Re-exported BGP API enums live in `internal/model` (e.g. `BGPPolicyDirectionImport = bgpv1alpha1.BGPPolicyDirectionImport`). - -### Linting - -Run `task lint` before every PR. All linters listed in `.golangci.yaml` must pass. Suppressions require a comment explaining why. Active linters (golangci-lint v2): `copyloopvar`, `errcheck`, `errname`, `errorlint`, `goconst`, `gocyclo`, `govet`, `ineffassign`, `intrange`, `lll`, `misspell`, `nakedret`, `noctx`, `perfsprint`, `prealloc`, `revive`, `staticcheck`, `unconvert`, `unparam`, `unused`. Formatters: `gci`, `gofmt`, `goimports`. - -There are no path-based lint exclusions — `.golangci.yaml` has no `issues.exclude-rules` block, so every linter applies uniformly across the module (there is no `lab/` directory to exclude; the ContainerLab tree lives at `deploy/containerlab/`). - ---- - -## Testing - -### Go — unit tests - -Use the standard `testing` package. Follow table-driven test style: - -```go -// from internal/plumbing/intf/intf_test.go (package intf_test) -tests := []struct { - name string - input string - want string - wantError bool -}{ - {"VPCValue", testVPCHex, testVPCBase62, false}, - {"VPCAttachmentValue", testVPCAttachmentHex, testVPCAttachmentB62, false}, - {"Zero", "0", "0", false}, - {"UppercaseInput", "4D2", testVPCBase62, false}, // input normalised to lowercase -} -for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got, err := intf.HexToBase62(tt.input) - if (err != nil) != tt.wantError { - t.Errorf("HexToBase62(%s) error = %v, wantError = %v", tt.input, err, tt.wantError) - } - if !tt.wantError && got != tt.want { - t.Errorf("HexToBase62(%s) = %s, want %s", tt.input, got, tt.want) - } - }) -} -``` - -- Test package name: same package as the code under test is the norm (e.g. `package cni`, `package srv6`) — used by 11 of the 12 `_test.go` files under `internal/`. The external `_test` package (e.g. `package intf_test` for `internal/plumbing/intf`) is the exception, used when a package's public API alone is enough to exercise the tests. -- Name test cases using `UpperCamelCase` (e.g., `"VPCValue"`, `"UppercaseInput"`). -- Use `wantError bool` to test error presence; do not test error message strings unless the message is part of the contract. - -### What not to test - -- `internal/plumbing/vrf` has no unit tests — it requires `CAP_NET_ADMIN` and a real kernel; new code there should prefer e2e tests (`task test:e2e`). -- `internal/cni` and `internal/plumbing/srv6` now have unit coverage for their pure-logic paths (config parsing, route-target math, SID validation) — kernel-mutating calls within them are still better covered by e2e than mocks. - ---- - -## YAML files - -Always use the `.yaml` extension, never `.yml`. This applies to all YAML files in the repository: Taskfiles, ContainerLab topologies, Kubernetes manifests, CI workflows, and configuration files. - ---- - -## Markdown - -Align all table columns so that the `|` delimiters are vertically flush. Pad cells with spaces to match the widest value in each column. Apply this to every table in `.md` files, including CLAUDE.md, CONVENTIONS.md, every `ARCHITECTURE*.md` file, and inline doc comments. - -```markdown -// unaligned — not allowed -| Element | Convention | Example | -|---------|-----------|---------| -| Package | lowercase | `package srv6` | - -// aligned — required -| Element | Convention | Example | -|---------|------------|----------------| -| Package | lowercase | `package srv6` | -``` - ---- - -## Commit messages - -Use Conventional Commits format: `(): `. First line ≤ 72 characters. Reference issues where applicable. - -Common types: `feat`, `fix`, `chore`, `docs`, `refactor`, `test`. - -``` -feat(agent): embed GoBGP and manage lifecycle via bootstrap -fix(lint): resolve CI lint and yamllint failures -chore(deps): update github actions -``` - ---- - -## Pre-PR checklist - -Before opening a pull request, run: - -```sh -task ci # lint → build → test:unit → test:e2e -``` - -This matches the "Before every PR" guidance in `AGENTS.md`/`CLAUDE.md`. `internal/plumbing/vrf` is not covered by unit tests (requires `CAP_NET_ADMIN`); new code there should prefer e2e tests over mock-heavy unit tests. +The maintained [coding conventions](../development/conventions.md) now live with +the [development guide](../development/README.md). Update that document when a +repository rule changes. This path remains for existing links. diff --git a/docs/development/README.md b/docs/development/README.md new file mode 100644 index 000000000..3490e63f9 --- /dev/null +++ b/docs/development/README.md @@ -0,0 +1,91 @@ +# Develop Galactic + +Start with the [system overview](../overview.md) and the component guide for the +code you will change. [Coding conventions](conventions.md) define the repository's +rules; [documentation maintenance](documentation.md) explains where docs belong. + +## Tools and environment + +The runtime and networking tests require Linux. Use Go at the version declared +in [go.mod](../../go.mod), Task, a C compiler, clang and LLVM with the BPF target, +and the Linux headers needed by code generation. The +[development container](../../.devcontainer/galactic/) supplies a starting +environment. Tool pins in [Taskfile.yaml](../../Taskfile.yaml) and the +[CI workflow](../../.github/workflows/ci.yaml) take precedence over copied +version lists. + +End-to-end tests also need a Docker daemon, kubectl, Kind and permission to +load the VRF kernel module. Real-kernel unit tests require root and the kernel +features they exercise. Run them on an isolated development host. + +## Build and test + +Run commands from the repository root: + +```sh +task build +task test:unit +``` + +The build regenerates eBPF objects before Go formatting, vetting and compilation, +then writes binaries to `bin/`. The unit task runs race detection and coverage +and checks the separate reference-provider module. An unprivileged unit run +skips root-gated networking tests; it does not validate the kernel datapath. + +For a focused Go test, first generate the objects the module embeds: + +```sh +task build:ebpf +go test ./internal/plumbing/intf/... +``` + +Use `task test:unit-root` in an appropriately privileged environment for the +root-gated packages. Preserve the selected Go/Task/clang tools and any envtest +assets when elevating privileges; the CI root-test job shows the supported +environment setup. Tests that need an API server use `KUBEBUILDER_ASSETS` from +controller-runtime's setup-envtest tool. Read test skip messages as missing +coverage, not passed assertions. + +Before every PR: + +```sh +task ci +``` + +This runs lint, build, unit tests and the Kind lifecycle e2e test. It does not +include every feature's lab acceptance test, root unit tests, alert tests or +full-table fabric diagnostics load test. Run the additional checks appropriate +to the change, and report skipped or unavailable checks explicitly. + +`task test:e2e` creates and deletes its Kind cluster and builds/loads the CNI +image. It is separate from the multi-cluster [ContainerLab walkthrough](../getting-started.md). + +## Generated artifacts + +| Artifact | Command | Policy | +| --------------------------------- | ------------------------ | ----------------------------------------------------------------------------------- | +| eBPF Go bindings and object files | `task build:ebpf` | Generated before builds; ignored artifacts must not be committed. | +| CRDs and deepcopy methods | `task generate:crd` | Commit the generated output with API changes. Requires controller-gen. | +| Protobuf bindings | `task generate:proto` | Commit generated Go files; never hand-edit them. Requires the buf/plugin toolchain. | +| API documentation | `task generate:api-docs` | Commit the output with source changes; see the [API index](../api/README.md). | + +The Taskfile defines the actual generation commands. Avoid independently +maintaining copies of those commands or dependency versions in component docs. + +## CI and release artifacts + +The [CI workflow](../../.github/workflows/ci.yaml) separates lint, ordinary unit +tests, privileged unit tests, builds and e2e checks. The privileged job loads +kernel support and runs root-gated tests that the ordinary unit job cannot +exercise. The eBPF compiler is pinned in CI because verifier behavior depends +on the generated program as well as its C source. + +The [publish workflow](../../.github/workflows/publish.yaml) builds per-component +images from [containers/](../../containers/) and publishes the configuration +bundle. A local `task build` is not an image release. Component docs describe +their runtime requirements; the workflow and Dockerfiles define release +artifacts and build dependencies. + +When a failure occurs, record the failing command, commit, toolchain, relevant +kernel capabilities and any skipped checks. Do not infer production readiness +from an unprivileged test run or a documentation-only CI result. diff --git a/docs/development/conventions.md b/docs/development/conventions.md new file mode 100644 index 000000000..c723a1729 --- /dev/null +++ b/docs/development/conventions.md @@ -0,0 +1,231 @@ +# Coding Conventions + +This document defines the coding standards, naming rules, error handling patterns, testing conventions, and idioms enforced across this codebase. All contributors must follow these rules. Automated checks (golangci-lint) enforce many of them; the rest are enforced in code review. + +--- + +## Go + +### Package boundaries + +Use `internal/` for implementation packages unless another repository must +import the API. Keep kernel primitives, reconciliation and API types separate. +The [system overview](../overview.md) and component architecture guides describe +ownership and the useful entry points; do not duplicate their source inventories +here. + +### Import grouping + +Use three groups, separated by blank lines: + +1. Standard library +2. `go.datum.net` packages +3. Other third-party and Kubernetes packages + +The configured `gci` order is standard library, `go.datum.net`-prefixed +packages, then other dependencies. Follow [.golangci.yaml](../../.golangci.yaml) +when formatting; `goimports` also adds and removes imports. +Alias imports use a short, descriptive name — typically the API group + version +for generated clients (`metav1`, `corev1`, `bgpv1alpha1` for +`go.datum.net/galactic/api/network/v1alpha1`, `apierrors`, `clientgoscheme`, +`utilruntime`) or a package-role name to disambiguate collisions +(`vrfpkg`, `galacticruntime`). + +```go +import ( + "context" + "fmt" + + "go.datum.net/galactic/internal/plumbing/intf" + + "google.golang.org/grpc" +) +``` + +### Naming + +| Element | Convention | Example | +| ---------------------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| Package | lowercase, single word, matches directory | `package srv6` | +| Exported type | `CapWords` | `PoolAllocator` (`internal/cni/ipam`) | +| Exported function / method | `CamelCase` | `RouteIngressAdd` | +| Unexported function / method | `camelCase` | `parseSID`, `addIngressRoute` (`internal/plumbing/srv6`) | +| Exported constant | `CamelCase`, descriptive | `BGPPolicyDirectionImport` (`internal/model`, re-exports the BGP API enum) | +| Test package | same package as norm; `_test` for the rare external-test case | `package cni` (internal, the norm); `package intf_test` (external, `internal/plumbing/intf`) | +| K8s API import aliases | domain-prefixed group-version | `bgpv1alpha1`, `metav1`, `corev1` | + +Do not use `_` in Go identifiers except in test package names. + +### Docstrings + +A function or method docstring describes the function itself: what it does, +what its parameters mean, and what it returns — including the error +conditions it can produce. Nothing else belongs in it. + +- Do not describe historical context: no "used to do X", "replaced an + earlier Y design", "added after an incident", or any other narration of + how the function changed over time. That belongs in the commit message + that made the change, not in text every future reader has to read. +- Do not link out to other documents for context: no URLs, no "see + docs/...", no "see ARCHITECTURE-*.md". A docstring must stand on its own — + a reader should never have to leave the function to understand its + contract. Design rationale that genuinely needs a home belongs in the + relevant component architecture guide, not folded into + the docstring. +- Do not name specific deployment environments, infra vendors, or site names, + and do not claim something was "found live in production" — describe the + general mechanism and failure mode a function guards against, not the + specific incident or platform that surfaced it. +- Keep it short: state the contract in as few sentences as the behavior + actually requires. + +```go +// Good — the function, its inputs, and its output, nothing else +// resolveBGPLocalAddress returns explicit when non-empty, and otherwise calls +// detect to read the BGP local address from the host's loopback. A detection +// failure is an error; there is no silent fallback to an unset address. +func resolveBGPLocalAddress(explicit string, detect func() (string, error)) (string, error) { ... } + +// Bad — historical narrative and an external link instead of the contract +// resolveBGPLocalAddress was added when the router moved off a hardcoded +// address; see docs/router/configuration.md for the full migration history. +// It used to just read GALACTIC_ROUTER_BGP_LOCAL_ADDRESS directly... +func resolveBGPLocalAddress(explicit string, detect func() (string, error)) (string, error) { ... } +``` + +This applies to exported and unexported function/method docstrings alike. + +### Error handling + +- Wrap errors with context using `fmt.Errorf("what failed: %w", err)`. The context string must complete the sentence "could not ``". +- Collect multiple independent errors with `errors.Join(errs...)` and return the joined error. +- Never swallow errors silently. If an error truly cannot be actionable, log it before discarding. +- Do not add error handling for scenarios that the code guarantees cannot happen. + +```go +// from internal/cni/ops_check.go:cmdCheck — multiple independent checks +var errs []error +if err := checkGuestInterface(args.Netns, guestName); err != nil { + errs = append(errs, fmt.Errorf("guest interface %q: %w", guestName, err)) +} +if err := checkTerminationRoutes(pluginConf.VPC, pluginConf.VPCAttachment, pluginConf.Terminations); err != nil { + errs = append(errs, fmt.Errorf("termination routes: %w", err)) +} +if len(errs) > 0 { + return fmt.Errorf("CHECK failed: %w", errors.Join(errs...)) +} +``` + +### Constants + +Define sentinel / limit values as typed or untyped constants at package level, grouped in a `const (...)` block when there are several related ones. Re-exported BGP API enums live in `internal/model` (e.g. `BGPPolicyDirectionImport = bgpv1alpha1.BGPPolicyDirectionImport`). + +### Linting + +Run `task lint` before every PR. The enabled linters, formatters and narrow +source/path exclusions are defined in [.golangci.yaml](../../.golangci.yaml). +Suppressions require an explanation. Do not maintain a second list of enabled +linters or exclusions in this guide. + +--- + +## Testing + +### Go — unit tests + +Use the standard `testing` package. Follow table-driven test style: + +```go +// from internal/plumbing/intf/intf_test.go (package intf_test) +tests := []struct { + name string + input string + want string + wantError bool +}{ + {"VPCValue", testVPCHex, testVPCBase62, false}, + {"VPCAttachmentValue", testVPCAttachmentHex, testVPCAttachmentB62, false}, + {"Zero", "0", "0", false}, + {"UppercaseInput", "4D2", testVPCBase62, false}, // input normalised to lowercase +} +for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := intf.HexToBase62(tt.input) + if (err != nil) != tt.wantError { + t.Errorf("HexToBase62(%s) error = %v, wantError = %v", tt.input, err, tt.wantError) + } + if !tt.wantError && got != tt.want { + t.Errorf("HexToBase62(%s) = %s, want %s", tt.input, got, tt.want) + } + }) +} +``` + +- Use the same package as the code under test when tests need internal state. + Use an external `_test` package when the public API is sufficient. +- Name test cases using `UpperCamelCase` (e.g., `"VPCValue"`, `"UppercaseInput"`). +- Use `wantError bool` to test error presence; do not test error message strings unless the message is part of the contract. + +### Kernel and API tests + +Use focused unit tests for pure logic. Test kernel behavior with real-kernel +tests rather than mocks that only restate netlink calls. `internal/plumbing/vrf` +includes privileged tests for VRF sharing, allocation, unreachable defaults and +cleanup. Root-gated tests run through `task test:unit-root`; they skip in an +unprivileged run. API admission tests also require envtest assets. + +The [development guide](README.md) explains the test tiers and prerequisites. +Use lab/e2e checks for behavior that spans components, and report any skipped +coverage explicitly. + +--- + +## YAML files + +Always use the `.yaml` extension, never `.yml`. This applies to all YAML files in the repository: Taskfiles, ContainerLab topologies, Kubernetes manifests, CI workflows, and configuration files. + +--- + +## Markdown + +Align all table columns so that the `|` delimiters are vertically flush. Pad cells with spaces to match the widest value in each column. Apply this to every table in `.md` files, including CLAUDE.md, CONVENTIONS.md, every `ARCHITECTURE*.md` file, and inline doc comments. + +```markdown +// unaligned — not allowed +| Element | Convention | Example | +|---------|-----------|---------| +| Package | lowercase | `package srv6` | + +// aligned — required +| Element | Convention | Example | +|---------|------------|----------------| +| Package | lowercase | `package srv6` | +``` + +--- + +## Commit messages + +Use Conventional Commits format: `(): `. First line ≤ 72 characters. Reference issues where applicable. + +Common types: `feat`, `fix`, `chore`, `docs`, `refactor`, `test`. + +``` +feat(agent): embed GoBGP and manage lifecycle via bootstrap +fix(lint): resolve CI lint and yamllint failures +chore(deps): update github actions +``` + +--- + +## Pre-PR checklist + +Before opening a pull request, run: + +```sh +task ci # lint → build → test:unit → test:e2e +``` + +This matches the repository instructions. Run the additional privileged, +API-server, alert or lab checks appropriate to the changed behavior, as described +in the [development guide](README.md). diff --git a/docs/development/documentation.md b/docs/development/documentation.md new file mode 100644 index 000000000..95a75f8ee --- /dev/null +++ b/docs/development/documentation.md @@ -0,0 +1,65 @@ +# Maintain the documentation + +Documentation describes the code at the checked-out revision. A deployment's +enabled features and qualification results are separate facts. Keep those +distinctions visible when writing a guide or reporting a test result. + +## Choose one home + +| Content | Home | +| ---------------------------------------------- | --------------------------------------------------------------------------- | +| What Galactic does and who owns each boundary | [Overview](../overview.md) | +| First local run | [Getting started](../getting-started.md) | +| Build, test, release workflow and coding rules | [Development](README.md) | +| Component behavior and invariants | The component's architecture or feature guide | +| Supported settings and defaults | The component's configuration reference | +| Deployment, recovery and rollback | The component's deployment/operations guide | +| Cross-component host procedures and migrations | [Operations](../operations/README.md) | +| Metric semantics and scrape setup | [Observability](../observability/README.md) | +| API fields | Generated [API references](../api/README.md), with source comments as input | +| Future behavior or a retained design decision | [Designs](../designs/README.md) | +| Dated review or measurement | [Archive](../archive/README.md) | + +Link to the canonical explanation instead of copying tables, defaults or build +steps into every architecture page. Document source entry points that help a +reader change the feature; avoid exhaustive function and repository inventories. + +## Make status explicit + +Designs state whether behavior is proposed, partially implemented, implemented +or superseded, and identify remaining work. Implementation does not imply a +production rollout. Preserve exact revision, environment and limitations with +historical measurements. A release guide must name current prerequisites rather +than treating an old review's open-findings table as a permanent release gate. + +Retain migrations while supported deployments need them. Before archiving a +document, move any current instructions or unresolved requirements into an +indexed maintained page, and link to that page from the historical record. + +## Keep links and examples usable + +Add new maintained pages to a reachable index. When moving a widely referenced +page, update repository links and keep a short compatibility pointer at its old +path. Preserve important old fragments with explicit HTML anchors when headings +change. Compatibility pages contain navigation, not a second maintained copy. + +Examples use illustrative addresses and clearly named placeholders. State the +working directory, prerequisites, expected outcome and rollback for operational +commands. Prefer links to tested lab fixtures over large copied manifests. + +## Validate a change + +Install the pinned Markdown parser in a virtual environment using the +[API reference instructions](../api/README.md#checking-documentation), then run +`task docs:check` for local links, anchors and generated API coverage. Run +`task docs:check-generated` when changing API comments or generator configuration. Regenerate rendered diagrams whenever their source +changes, following the [diagram instructions](../architecture/README.md). + +These checks cannot establish that prose correctly describes runtime behavior. +Review changed defaults against configuration code, placement against manifests, +and lifecycle claims against implementation and tests. When a check is not run, +say so; do not add a fresh verification date as a substitute. + +Follow the repository's pre-PR checks as well. A docs-only change should not +claim it executed a deployment, incident procedure or load test merely because +the commands parse and their links resolve. diff --git a/docs/getting-started.md b/docs/getting-started.md new file mode 100644 index 000000000..cf6964210 --- /dev/null +++ b/docs/getting-started.md @@ -0,0 +1,81 @@ +# Run the local networking lab + +The ContainerLab environment builds Galactic from this checkout and runs three +Kind clusters connected through an SRv6 transit network. It is the repository's +worked example for workload attachment, tenant routing, ingress and egress. +Use a dedicated development host: deployment changes host sysctls and creates +privileged containers and network links. + +For a smaller build/test loop, start with [development](development/README.md). +This walkthrough follows the lab's checked-in tasks; it does not certify a +production release or replace feature-specific acceptance tests. + +## Prerequisites + +- A Linux kernel supporting the lab's VRF, SRv6 and eBPF operations. +- Docker with a reachable daemon and permission to run privileged containers. +- ContainerLab, Kind, kubectl, jq and Task. See the + [lab prerequisites](../deploy/containerlab/README.md#prerequisites). +- Go and clang for building the checkout, or the repository's + [development container](../.devcontainer/galactic/). + +The [ContainerLab development container](../.devcontainer/containerlab-dood/) +provides a Docker-out-of-Docker setup. Container networking still depends on +the Docker host's kernel and privileges. + +## Build and deploy + +From the repository root: + +```sh +cd deploy/containerlab +task deploy +``` + +The task builds the images, creates the clusters, installs the networking +components and applies the lab scenarios. Allow it to finish before running +verification. If it fails, use the named failing task and the lab's +[layout](../deploy/containerlab/README.md#lab-layout) to locate the affected +component; repeating a destructive cleanup is not a diagnostic step. + +## Verify connectivity + +From the same directory: + +```sh +task verify:underlay +task verify:scenarios +task verify:gateway +task verify:gateway-ingress +task verify:nat-datapath +``` + +Each task must exit successfully. Together these check underlay reachability, +VPC workload connectivity, gateway API readiness, real ingress traffic and a +translated egress round trip. API readiness alone does not prove a working +packet path. + +Use the lab's [verification reference](../deploy/containerlab/README.md#verification) +for additional checks. Fault-injection and rollout tests can interrupt lab +traffic; run the checks required by the feature you changed rather than treating +every task as a harmless health probe. + +## Inspect or remove the lab + +```sh +task inspect +``` + +The task reports the lab containers. The generated `dfw.kubeconfig`, +`iad.kubeconfig` and `sjc.kubeconfig` files in the lab directory select its +clusters explicitly when using kubectl. + +When finished, from the lab directory: + +```sh +task destroy +``` + +This removes the lab containers and Kind clusters. `task clean` also removes +built images and lab artifacts. Use the [lab task reference](../deploy/containerlab/README.md#tasks) +for rebuild and feature-specific workflows. diff --git a/docs/overview.md b/docs/overview.md new file mode 100644 index 000000000..f4abc084c --- /dev/null +++ b/docs/overview.md @@ -0,0 +1,85 @@ +# Galactic overview + +Galactic supplies the SRv6 data plane and routing control plane for VPC +networking. Kubernetes resources describe intent, node processes reconcile +that intent, and Linux VRFs and eBPF programs forward packets. Tenant traffic +can cross nodes and sites without exposing one VPC's routes to another. + +This page describes the repository's implemented components. Feature presence +does not establish that a deployment has enabled or qualified it. Each feature's +deployment guide records its prerequisites and rollout gates. + +## Components and ownership + +| Component | Responsibility | Start here | +| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | +| CNI chain | `galactic-cni` installs the plugins and maintains node credentials and shared datapath state. `galactic-veth` or `galactic-tap`, delegated IPAM, optional `galactic-route`, and `galactic-bgp` attach a workload. | [CNI](cni/README.md) | +| Tenant routing | `galactic-router` reconciles BGP resources through embedded GoBGP, installs learned routes, programs node policy and service bindings, and collects orphaned state. The reflector role distributes EVPN routes. | [Router architecture](router/architecture.md) | +| Ingress gateway | `galactic-gateway` selects an ingress backend using XDP and advertises VIPs through BGP resources. The backend's reply uses direct server return. | [Gateway deployment](gateway/deployment.md) | +| Egress translation | `galactic-nat` implements stateful NAT66/NAT64 for an `EgressShard`. Compute nodes reach eligible shards over SRv6. | [NAT deployment](nat/deployment.md) | +| VPC ingress sidecar | `galactic-vrf` reconciles workload ingress and host return paths for its VPC. Its placement is defined by the workload deployment, not a generic DaemonSet in this repository. | [VPC ingress metrics](observability/vpc-ingress.md) | +| Cell controller | `galactic-controller --role=cell` serves admission, resolves traffic policy and projects BGP programming status. `--edge` adds Edge attachment and route reconciliation. | [Controller](controller/README.md) | +| Central identity allocator | `galactic-controller --role=fabric` allocates shared fabric identities using hub and IPAM credentials in a separate deployment. | [Controller](controller/README.md) | +| Underlay routing | `fabric-router` runs FRR. `fabric-config-agent` validates and activates per-node configuration. `fabric-router-controller` compiles typed routing intent and optionally manages releases and topology. | [Fabric routing](fabric-routing/README.md) | +| Fabric diagnostics | `fabric-api` runs node sidecars, a cell gateway, certificate synchronization and query cleanup. | [Fabric API](fabric-api/README.md) | +| Provider attachments | `galactic-edge` programs authorized provider attachments and forwarding gates on edge nodes. | [Galactic Edge](edge/README.md) | + +The served cloud, network and policy resources use +`galactic.datumapis.com/v1alpha1`; their Go packages are separate. Consult the +[API index](api/README.md) to find the owning package and reference. + +## Boundaries outside this repository + +The Network Services Operator (NSO) cell manager owns VPC, attachment and subnet +reconciliation and writes NetworkAttachmentDefinitions when Galactic integration +is enabled. Galactic's cell controller retains BGP status projection and +admission/policy work. A CNI invocation consumes the resulting attachment +identifiers; it does not allocate the platform's network identity. + +The distinction matters during upgrades: run one writer for each attachment and +NAD. The [API consolidation migration](operations/migrations/galactic-api-consolidation.md) +describes the handoff and legacy-resource audit. Code packaged in this repository +is not by itself evidence that this binary runs a particular controller; the +registration in each command is the execution boundary. + +Infra owns deployment-specific overlays, node addresses, underlay reachability, +certificates and release rollout. This repository supplies reusable manifests, +controllers and a local lab. Provider implementations own their protocols and +client sessions; the [Edge contract](edge/provider-contract.md) defines their +authority at the VPC boundary. + +## Packet paths + +1. **Workload attachment.** Multus invokes the CNI chain with VPC and attachment + identifiers. The chain creates the host link and VRF state, registers the + datapath and writes BGP resources. The router publishes the EVPN path. +2. **VPC traffic.** A node resolves a tenant destination within that VPC's + routing context. Remote delivery crosses the underlay in SRv6; the receiving + node decapsulates into the destination VPC. Interface traffic policy applies + according to the configured mode and bindings. +3. **Public ingress.** A gateway accepts a configured VIP and selects a backend. + It encapsulates toward the backend node. Backend translation and return-path + handling implement the VIP contract; the reply does not require gateway + connection tracking. +4. **Public egress.** The tenant node forwards to an eligible egress shard. The + shard translates the flow and retains session state for the reverse path. + Shards do not replicate sessions; losing the selected shard can break flows. +5. **Private services and providers.** [Private-service routing](private-services/README.md) + authorizes particular service tuples. [Edge providers](edge/provider-contract.md) + use explicit attachments and forwarding ownership. These are separate from + public gateway VIPs. + +See the [system diagrams](architecture/README.md) for the component relationships, +and component architecture pages for algorithms and failure behavior. + +## Deployment shape + +`config/kustomization.yaml` includes the namespace, CNI and tenant-router +resources. It is not a complete production installation: CRDs, underlay, +controllers, optional gateways, translation, diagnostics and monitoring have +their own prerequisites and composition. + +Use the [operations index](operations/README.md) for placement and shared host +settings. Node labels are opt-ins, and an edge node does not automatically run +every edge feature. Begin with the [local lab](getting-started.md) to exercise +the complete topology without assembling production overlays. diff --git a/hack/returnpath-lab/README.md b/hack/returnpath-lab/README.md index b075d3d0b..07b6b9884 100644 --- a/hack/returnpath-lab/README.md +++ b/hack/returnpath-lab/README.md @@ -1,14 +1,13 @@ # returnpath-lab -Phase 0 proof harness for -[docs/plans/855-return-path-ingress-decap.md](../../docs/plans/855-return-path-ingress-decap.md). - -A lab tool, not a shipped binary. It performs by hand — and reverses — exactly -what that plan's Pieces 1–3 would automate, so the plan's derived-but-unproven -kernel assumptions can be tested before production code is written against -them. It calls the same packages the real implementation will -(`internal/plumbing/ebpf/usidmap`, `intf`, `uformat`, `egressroutemap`), so -what it proves is proven about the real code paths. +Historical proof harness for the host return path, now described in the +[VPC ingress reference](../../docs/observability/vpc-ingress.md). + +This is a lab tool, not a shipped binary. It programs and reverses host return +path state by hand using `internal/plumbing/ebpf/usidmap`, `intf`, `uformat` +and `egressroutemap`. The original implementation plan is no longer maintained; +use this harness to investigate kernel behavior, not as a deployment procedure +or evidence that the current release passed acceptance. ## Running it From 1d8bcd939a7557995472feae8b25d519e8bf36f0 Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Mon, 26 Oct 2026 07:55:29 -0400 Subject: [PATCH 2/4] docs: Check links and generated API references --- .crd-ref-docs-cloud.yaml | 5 +- .crd-ref-docs-network-bgp.yaml | 31 +- .crd-ref-docs-network-gateway.yaml | 26 +- .crd-ref-docs.yaml | 10 +- .github/workflows/docs.yaml | 45 ++ Taskfile.yaml | 17 +- docs/api/README.md | 67 +++ docs/api/cloud.md | 6 +- docs/api/galactic.md | 6 +- docs/api/network-bgp.md | 685 +++-------------------------- docs/api/network-gateway.md | 11 +- hack/docs/.gitignore | 1 + hack/docs/check.py | 232 ++++++++++ hack/docs/generate_api.py | 84 ++++ hack/docs/requirements.txt | 3 + hack/docs/test_check.py | 112 +++++ hack/docs/test_generate_api.py | 41 ++ 17 files changed, 748 insertions(+), 634 deletions(-) create mode 100644 .github/workflows/docs.yaml create mode 100644 docs/api/README.md create mode 100644 hack/docs/.gitignore create mode 100644 hack/docs/check.py create mode 100644 hack/docs/generate_api.py create mode 100644 hack/docs/requirements.txt create mode 100644 hack/docs/test_check.py create mode 100644 hack/docs/test_generate_api.py diff --git a/.crd-ref-docs-cloud.yaml b/.crd-ref-docs-cloud.yaml index 3361ffbb6..a91991d54 100644 --- a/.crd-ref-docs-cloud.yaml +++ b/.crd-ref-docs-cloud.yaml @@ -1,7 +1,10 @@ processor: docPaths: [] ignoreTypes: - - ".*List$" + # Exclude collection wrappers by name: BGPPrefixList is a resource. + - "[.]NetworkFabricIdentityList$" + - "[.]VPCAttachmentList$" + - "[.]VPCList$" ignoreFields: [] render: diff --git a/.crd-ref-docs-network-bgp.yaml b/.crd-ref-docs-network-bgp.yaml index 88c982852..94bbbf87a 100644 --- a/.crd-ref-docs-network-bgp.yaml +++ b/.crd-ref-docs-network-bgp.yaml @@ -1,10 +1,39 @@ processor: docPaths: [] ignoreTypes: - - ".*List$" + # Exclude collection wrappers by name: BGPPrefixList is a resource. + - "[.]BGPAdvertisementList$" + - "[.]BGPCommunitySetList$" + - "[.]BGPPeerList$" + - "[.]BGPPeerProfileList$" + - "[.]BGPPolicyList$" + - "[.]BGPPrefixListList$" + - "[.]BGPRouterClassList$" + - "[.]BGPRouterList$" + - "[.]BGPStaticRouteList$" + - "[.]BGPVRFInstanceList$" + - "[.]EgressShardList$" + - "[.]FRRRouterParametersList$" + - "[.]FabricEndpointList$" + - "[.]FabricReleaseAuthorizationList$" + - "[.]FabricRolloutPolicyList$" + - "[.]FabricRouterDeploymentList$" + - "[.]FabricRouterRevisionList$" + - "[.]FabricTopologyList$" + - "[.]NetworkEgressPolicyList$" + - "[.]NetworkGatewayList$" + - "[.]NetworkServiceList$" + - "[.]ServiceEndpointList$" + - "[.]ServiceRoutePolicyList$" + - "[.]ServiceVIPBindingList$" # The revision's configuration lists every BGP spec by name; walking # those wrappers first would hide the policy types from their sections. - "FabricNamed.*" + # Egress and service resources have their own reference. + - "[.]EgressShard.*" + - "[.]ServiceEndpoint.*" + - "[.]ServiceRoutePolicy.*" + - "[.]ServiceVIPBinding.*" - "NetworkGateway" - "NetworkGatewaySpec" - "NetworkGatewayStatus" diff --git a/.crd-ref-docs-network-gateway.yaml b/.crd-ref-docs-network-gateway.yaml index 2adadb0f3..e985c4753 100644 --- a/.crd-ref-docs-network-gateway.yaml +++ b/.crd-ref-docs-network-gateway.yaml @@ -1,7 +1,31 @@ processor: docPaths: [] ignoreTypes: - - ".*List$" + # Exclude collection wrappers by name: BGPPrefixList is a resource. + - "[.]BGPAdvertisementList$" + - "[.]BGPCommunitySetList$" + - "[.]BGPPeerList$" + - "[.]BGPPeerProfileList$" + - "[.]BGPPolicyList$" + - "[.]BGPPrefixListList$" + - "[.]BGPRouterClassList$" + - "[.]BGPRouterList$" + - "[.]BGPStaticRouteList$" + - "[.]BGPVRFInstanceList$" + - "[.]EgressShardList$" + - "[.]FRRRouterParametersList$" + - "[.]FabricEndpointList$" + - "[.]FabricReleaseAuthorizationList$" + - "[.]FabricRolloutPolicyList$" + - "[.]FabricRouterDeploymentList$" + - "[.]FabricRouterRevisionList$" + - "[.]FabricTopologyList$" + - "[.]NetworkEgressPolicyList$" + - "[.]NetworkGatewayList$" + - "[.]NetworkServiceList$" + - "[.]ServiceEndpointList$" + - "[.]ServiceRoutePolicyList$" + - "[.]ServiceVIPBindingList$" - "AFI" - "SAFI" - "AddressFamily" diff --git a/.crd-ref-docs.yaml b/.crd-ref-docs.yaml index be57736e7..f2edc1054 100644 --- a/.crd-ref-docs.yaml +++ b/.crd-ref-docs.yaml @@ -1,6 +1,14 @@ processor: ignoreTypes: - - ".*List$" + # Exclude collection wrappers by name: BGPPrefixList is a resource. + - "[.]EdgeAttachmentList$" + - "[.]EdgeInstanceList$" + - "[.]EdgeProviderList$" + - "[.]EdgeRouteIndexList$" + - "[.]EdgeRouteList$" + - "[.]EdgeServiceList$" + - "[.]TrafficPolicyBindingList$" + - "[.]TrafficPolicyList$" render: kubernetes: {} diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml new file mode 100644 index 000000000..2e479ec05 --- /dev/null +++ b/.github/workflows/docs.yaml @@ -0,0 +1,45 @@ +# --- +# Workflow: Documentation +# Checks local Markdown navigation, API resource coverage and generated references. +# Runs for all PR bases, including stacked PRs, and pushes to main. +# No cluster, container runtime, eBPF build or secrets are required. +# Produces no deployment artifacts. +# --- +name: Documentation + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: docs-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + # -- documentation + # Parse Markdown with CommonMark rules before checking links and anchors. + # Regenerate APIs into a temporary directory so drift fails without editing Git. + documentation: + name: Documentation + runs-on: ubuntu-24.04 + timeout-minutes: 15 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7 + with: + go-version-file: go.mod + - name: Install Markdown parser + run: | + python3 -m venv "$RUNNER_TEMP/docs-venv" + "$RUNNER_TEMP/docs-venv/bin/python" -m pip install -r hack/docs/requirements.txt + - name: Check links, anchors and resource coverage + run: | + "$RUNNER_TEMP/docs-venv/bin/python" -m unittest discover -s hack/docs -p 'test_*.py' + "$RUNNER_TEMP/docs-venv/bin/python" hack/docs/check.py + - name: Check generated API references + run: python3 hack/docs/generate_api.py --check diff --git a/Taskfile.yaml b/Taskfile.yaml index d6b4e2047..aa0ab2ebb 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -119,11 +119,18 @@ tasks: generate:api-docs: desc: Regenerate Galactic, cloud, BGP and gateway API references cmds: - - go run github.com/elastic/crd-ref-docs@v0.2.0 --renderer=markdown --source-path=api/v1alpha1 --output-path=docs/api/galactic.md --config=.crd-ref-docs.yaml - - go run github.com/elastic/crd-ref-docs@v0.2.0 --renderer=markdown --source-path=api/cloud/v1alpha1 --output-path=docs/api/cloud.md --config=.crd-ref-docs-cloud.yaml - - go run github.com/elastic/crd-ref-docs@v0.2.0 --renderer=markdown --source-path=api/network/v1alpha1 --output-path=docs/api/network-bgp.md --config=.crd-ref-docs-network-bgp.yaml - - go run github.com/elastic/crd-ref-docs@v0.2.0 --renderer=markdown --source-path=api/network/v1alpha1 --output-path=docs/api/network-gateway.md --config=.crd-ref-docs-network-gateway.yaml - - python3 -c 'from pathlib import Path; files = ["docs/api/galactic.md", "docs/api/cloud.md", "docs/api/network-bgp.md", "docs/api/network-gateway.md"]; [p.write_text(p.read_text().rstrip() + "\n") for p in map(Path, files)]' + - python3 hack/docs/generate_api.py + + docs:check: + desc: Check documentation links, anchors and API resource coverage (install hack/docs/requirements.txt first) + cmds: + - python3 -m unittest discover -s hack/docs -p 'test_*.py' + - python3 hack/docs/check.py + + docs:check-generated: + desc: Check generated API references without changing tracked files + cmds: + - python3 hack/docs/generate_api.py --check build:ebpf: desc: Regenerate the eBPF uSID, edge gateway DSR, NAT egress, and XDP dispatcher datapaths (requires clang) diff --git a/docs/api/README.md b/docs/api/README.md new file mode 100644 index 000000000..53f130363 --- /dev/null +++ b/docs/api/README.md @@ -0,0 +1,67 @@ +# API references + +These references describe the Kubernetes resources served as +`galactic.datumapis.com/v1alpha1`. The source packages separate ownership and +implementation; they do not create separate API groups. + +| Reference | Resources | Source package | +| ------------------------------------------ | ---------------------------------------------------------------------------------------------- | ----------------------- | +| [Cloud](cloud.md) | VPC, VPCAttachment, NetworkFabricIdentity | `api/cloud/v1alpha1` | +| [Routing](network-bgp.md) | BGP configuration, prefix lists, fabric topology, revisions, deployments and release controls | `api/network/v1alpha1` | +| [Gateway and services](network-gateway.md) | NetworkGateway, NetworkService, NetworkEgressPolicy, EgressShard and private-service resources | `api/network/v1alpha1` | +| [Policy and Edge](galactic.md) | TrafficPolicy, TrafficPolicyBinding and Galactic Edge resources | `api/v1alpha1` | + +The [FabricQuery reference](../fabric-api/api.md) is a maintained explanation +of diagnostic requests and results. Its source is `internal/fabric/api/v1alpha1`; +it is separate from these generated references. + +For operating procedures, begin at the [documentation index](../README.md). +An API field's presence does not imply that its controller is deployed or that +its feature is enabled. Follow the corresponding component's deployment and +rollout guide. + +## Updating the generated references + +Edit the Go API comments and validation markers. When assigning a new resource +to a reference, update the corresponding `.crd-ref-docs*.yaml` filter. The BGP +and gateway references partition the network resources; shared field types may +appear in both, but each resource must appear in exactly one resource index. +Filters match qualified Go type names. Exclude collection wrappers explicitly: +`BGPPrefixList` is a resource, while `BGPPrefixListList` is its collection. + +From the repository root, with Go and Task installed: + +```sh +task generate:api-docs +task docs:check-generated +``` + +The generator version is pinned in `hack/docs/generate_api.py`. It adds the +source banner and quotes array-pattern validations so regular expressions do +not render as Markdown links. Do not edit generated Markdown by hand. The +check regenerates into a temporary directory and fails on a difference without +modifying tracked files. + +## Checking documentation + +The link checker uses a pinned CommonMark parser. Install its dependencies in +a virtual environment, then run the local gate: + +```sh +python3 -m venv /tmp/galactic-docs-venv +. /tmp/galactic-docs-venv/bin/activate +python3 -m pip install -r hack/docs/requirements.txt +task docs:check +``` + +The gate checks local files, images, reference links, heading fragments and +explicit HTML anchors in `docs/`, the root README and agent instructions. It +also checks links into `docs/` from other tracked Markdown files. Code blocks, +code spans and HTML comments are parsed as examples, not links. It checks each +resource struct against the generated resource indexes, including resources +whose names end in `List`. + +External URLs and executable deployment examples are outside this gate. The +separate Documentation workflow runs this gate and the generated-reference +check on every pull request, including pull requests targeting another branch +in a stack. diff --git a/docs/api/cloud.md b/docs/api/cloud.md index e6262484d..717c3ac03 100644 --- a/docs/api/cloud.md +++ b/docs/api/cloud.md @@ -1,3 +1,7 @@ + + +Generated from `api/cloud/v1alpha1`. Edit the API comments or `.crd-ref-docs-cloud.yaml`, then run `task generate:api-docs`. See the [API index](README.md) for resource ownership. + # API Reference ## Packages @@ -306,4 +310,4 @@ _Appears in:_ | --- | --- | --- | --- | | `observedGeneration` _integer_ | | | | | `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#condition-v1-meta) array_ | | | | -| `vpc` _string_ | Base62-encoded VPC identifier. | | MaxLength: 16
MinLength: 1
| +| `vpc` _string_ | Base62-encoded VPC identifier.
Empty until the fabric identity reaches this cell. | | MaxLength: 16
MinLength: 1
| diff --git a/docs/api/galactic.md b/docs/api/galactic.md index a596a68ae..1ae38fac2 100644 --- a/docs/api/galactic.md +++ b/docs/api/galactic.md @@ -1,3 +1,7 @@ + + +Generated from `api/v1alpha1`. Edit the API comments or `.crd-ref-docs.yaml`, then run `task generate:api-docs`. See the [API index](README.md) for resource ownership. + # API Reference ## Packages @@ -354,7 +358,7 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | -| `contractVersions` _string array_ | ContractVersions are the provider contract versions it speaks. | | MaxItems: 4
MinItems: 1
items:Pattern: ^v[0-9]+((alpha\|beta)[0-9]+)?$
| +| `contractVersions` _string array_ | ContractVersions are the provider contract versions it speaks. | | MaxItems: 4
MinItems: 1
items:Pattern: `^v[0-9]+((alpha\|beta)[0-9]+)?$`
| | `capabilities` _[EdgeCapability](#edgecapability) array_ | Capabilities are the capability versions it implements. | | MaxItems: 16
MinItems: 1
| | `serviceAccounts` _[ServiceAccountReference](#serviceaccountreference) array_ | ServiceAccounts are the only identities whose bound tokens act for the
provider. A request from any other identity is refused. The
foundation's own identities cannot be listed. | | MaxItems: 16
MinItems: 1
| | `configuration` _[ConfigurationKind](#configurationkind)_ | Configuration is the kind of the provider's own per-service
configuration. | | | diff --git a/docs/api/network-bgp.md b/docs/api/network-bgp.md index 41bb19604..a153cafde 100644 --- a/docs/api/network-bgp.md +++ b/docs/api/network-bgp.md @@ -1,3 +1,7 @@ + + +Generated from `api/network/v1alpha1`. Edit the API comments or `.crd-ref-docs-network-bgp.yaml`, then run `task generate:api-docs`. See the [API index](README.md) for resource ownership. + # API Reference ## Packages @@ -14,11 +18,11 @@ Package v1alpha1 contains API Schema definitions for the galactic.datumapis.com/ - [BGPPeer](#bgppeer) - [BGPPeerProfile](#bgppeerprofile) - [BGPPolicy](#bgppolicy) +- [BGPPrefixList](#bgpprefixlist) - [BGPRouter](#bgprouter) - [BGPRouterClass](#bgprouterclass) - [BGPStaticRoute](#bgpstaticroute) - [BGPVRFInstance](#bgpvrfinstance) -- [EgressShard](#egressshard) - [FRRRouterParameters](#frrrouterparameters) - [FabricEndpoint](#fabricendpoint) - [FabricReleaseAuthorization](#fabricreleaseauthorization) @@ -26,9 +30,6 @@ Package v1alpha1 contains API Schema definitions for the galactic.datumapis.com/ - [FabricRouterDeployment](#fabricrouterdeployment) - [FabricRouterRevision](#fabricrouterrevision) - [FabricTopology](#fabrictopology) -- [ServiceEndpoint](#serviceendpoint) -- [ServiceRoutePolicy](#serviceroutepolicy) -- [ServiceVIPBinding](#servicevipbinding) @@ -124,7 +125,6 @@ address has this field or nothing. _Appears in:_ -- [EgressShardSpec](#egressshardspec) - [FabricEndpointSource](#fabricendpointsource) | Field | Description | Default | Validation | @@ -976,6 +976,33 @@ _Appears in:_ | `Shutdown` | BGPPrefixLimitShutdown shuts the session down until it is cleared.
| +#### BGPPrefixList + + + +BGPPrefixList defines a named list of prefix-match entries used by BGPPolicy +terms to filter routes by destination prefix. It is referenced by name from +BGPPolicyMatch.prefixListRef. + +A single BGPPrefixList holds entries for either IPv4 or IPv6 — the address +family is inferred from the CIDR family of the first entry and validated +consistent across all entries via CEL. + + + + + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `galactic.datumapis.com/v1alpha1` | | | +| `kind` _string_ | `BGPPrefixList` | | | +| `kind` _string_ | Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds | | | +| `apiVersion` _string_ | APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources | | | +| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | | +| `spec` _[BGPPrefixListSpec](#bgpprefixlistspec)_ | | | | +| `status` _[BGPPrefixListStatus](#bgpprefixliststatus)_ | | | | + + #### BGPPrefixListEntry @@ -1003,10 +1030,40 @@ _Appears in:_ | `le` _integer_ | LE is the maximum prefix-length to match (less-than-or-equal).
For example, "10.0.0.0/8 le 24" matches 10.0.0.0/8 through 10.0.0.0/24.
When unset, the prefix-length of Prefix is the upper bound, unless GE
is set, in which case the family's maximum length is. | | Maximum: 128
Minimum: 0
| +#### BGPPrefixListSpec + + +BGPPrefixListSpec defines the desired state of BGPPrefixList. +_Appears in:_ +- [BGPPrefixList](#bgpprefixlist) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `frr` _[FRRNameOverride](#frrnameoverride)_ | FRR holds FRR rendering settings. | | | +| `entries` _[BGPPrefixListEntry](#bgpprefixlistentry) array_ | Entries is the ordered list of prefix-match entries, keyed by sequence. | | MaxItems: 1024
MinItems: 1
| + + +#### BGPPrefixListStatus + + + +BGPPrefixListStatus defines the observed state of BGPPrefixList. + + + +_Appears in:_ +- [BGPPrefixList](#bgpprefixlist) + +| Field | Description | Default | Validation | +| --- | --- | --- | --- | +| `observedGeneration` _integer_ | ObservedGeneration is the .metadata.generation this status was computed from. | | | +| `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#condition-v1-meta) array_ | Conditions contains the standard conditions for this resource. | | | + + #### BGPRouter @@ -1474,24 +1531,6 @@ _Appears in:_ | `monitors` _[BMPMonitor](#bmpmonitor) array_ | Monitors lists the RIBs streamed. | | MaxItems: 6
MinItems: 1
| -#### BackendHealthState - -_Underlying type:_ _string_ - -BackendHealthState is a backend's health decision. - -_Validation:_ -- Enum: [Healthy Unhealthy Unknown] - -_Appears in:_ -- [ServiceEndpointProducerStatus](#serviceendpointproducerstatus) -- [ServiceVIPBindingHealth](#servicevipbindinghealth) - -| Field | Description | -| --- | --- | -| `Healthy` | BackendHealthHealthy: the last HealthyThreshold probes succeeded.
| -| `Unhealthy` | BackendHealthUnhealthy: the last UnhealthyThreshold probes failed. Only
this state takes a backend out of the gateways' Maglev tables.
| -| `Unknown` | BackendHealthUnknown: too few probes have completed to decide, or the
probe cannot run on the backend's node.
| #### Community @@ -1566,139 +1605,6 @@ _Appears in:_ | `iPv6PrefixAdvertisement` | EVPNRouteTypeIPv6PrefixAdvertisement is Type-5: IPv6 Prefix Advertisement route.
| -#### EgressShard - - - -EgressShard marks a single node as a member of the sharded, stateful egress -translation tier (galactic-nat) — a component deliberately kept off the -ingress load-balancer's own consistent-hash ring (see NetworkGateway): -tenant egress traffic (backend -> arbitrary internet destination) is a -different traffic pattern from ingress (fixed VIP, fixed backend pool) -and needs its own placement ring, own per-flow state, and its own -self-routing return path, entirely independent of any NetworkGateway node. - -A shard serves one or both address families. NAT66 (IPv6 -> IPv6) and NAT64 -(IPv6 -> IPv4, RFC 6146) are the same function — stateful egress PAT with a -VRF-scoped session table — over different families, so one shard object -describes both rather than there being a second, near-duplicate kind. -Spec.ShardAddressIPv6 and Spec.ShardAddressIPv4 are each assigned only for -the family this shard translates; a shard with no IPv4 address performs no -NAT64. - -Every shard owns a dedicated, publicly-routable address per family it -serves, and a flow's allocated masquerade port lives within it — so a reply -is delivered to the correct shard by ordinary unicast routing alone, with -no hashing or cross-shard lookup on the return path at all (the "any node -can determine the owning shard from the tuple alone" property, satisfied by -construction rather than by a replicated hash table). - -A shard is told which addresses to translate to; it does not choose them. -The controller that owns a cell claims one address per family from the -addressing service and writes it into this spec, which keeps the -addressing-service credential off every translating node and keeps the -allocation request out of the path that attaches a workload. Status reports -what the node's datapath is actually programmed with, so an unclaimed -address, a stale datapath, and a divergence between the two are each -distinguishable. - -A shard names nothing that selects it. Which shards serve which consumer -intent is decided entirely by label selectors evaluated on the selecting -side (see the LabelEgressShard* keys), so no consumer-facing API appears in -this group and no reference points from a datapath resource back at the -resource that placed traffic on it. - - - - - -| Field | Description | Default | Validation | -| --- | --- | --- | --- | -| `apiVersion` _string_ | `galactic.datumapis.com/v1alpha1` | | | -| `kind` _string_ | `EgressShard` | | | -| `kind` _string_ | Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds | | | -| `apiVersion` _string_ | APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources | | | -| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | | -| `spec` _[EgressShardSpec](#egressshardspec)_ | | | | -| `status` _[EgressShardStatus](#egressshardstatus)_ | | | | - - -#### EgressShardSpec - - - -EgressShardSpec defines the desired state of an EgressShard. - -The address fields are written by the controller that owns the cell, not by -the shard and not by a consumer. Each is optional: an address the addressing -service has not yet handed out is absent rather than blank-but-required, so -a shard object exists from the moment its node is labelled and gains its -identity afterwards. - -Each is also write-once, and cannot be unassigned once assigned. The -datapath claims a reply by exact match against the address it translates to, -so reassigning one strands the return traffic of every flow already -established through it, with no drain and no dual-address grace period -available to cover the change. A shard holding the wrong address is deleted -and recreated instead, which breaks those flows at a moment someone chose. - -A claim reference alongside an address records where that address came from, -and is write-once on the same terms. It is deliberately not required with an -address, in either direction. Requiring an address before a claim reference -would forbid recording a claim whose allocation has not resolved yet, which -is the window a restarting controller most needs to see so that it finds the -claim it already made instead of making a second one. Requiring a claim -reference before an address would forbid an address allocated by hand, and -whether such an address may be recorded here at all is an open migration -question this validation would answer by fiat. An address with no reference -is therefore accepted and is unattributable, which is a fact about the -allocation rather than something a schema can repair. - - - -_Appears in:_ -- [EgressShard](#egressshard) - -| Field | Description | Default | Validation | -| --- | --- | --- | --- | -| `targetRef` _[TargetRef](#targetref)_ | TargetRef identifies the Node this shard executes on. | | Required: \{\}
| -| `shardSID` _string_ | ShardSID is this shard's own SRv6 uSID, the outer destination a tenant
VRF's egress route encapsulates toward. The shard claims a packet by its
Block and Node-ID alone, the Argument carrying the tenant, so those 64
bits must be reserved for this shard and disjoint from every BGPRouter
locator: a value another node already uses silently diverts that node's
traffic.
Write-once for the same reason the addresses are: every established
flow's reply is re-encapsulated from this SID, so changing it strands
them. Operator-chosen until the addressing service hands out identifiers
of this kind.
Empty means no SID is assigned yet, and the shard claims no packet. | | | -| `shardAddressIPv6` _string_ | ShardAddressIPv6 is the dedicated, publicly-routable IPv6 address this
shard translates to — every NAT66 masquerade port it allocates lives
within this address, so any node can route a reply to the owning shard
using ordinary unicast routing on it alone, with no per-flow state
lookup anywhere but that shard.
Empty means no IPv6 address is assigned to this shard. | | | -| `shardAddressIPv6ClaimRef` _[AddressClaimRef](#addressclaimref)_ | ShardAddressIPv6ClaimRef records the addressing-service claim
ShardAddressIPv6 came from — see AddressClaimRef. Set it in the same
write as the address whenever that address came from a claim.
Nothing here resolves it and no component reads it to program anything;
it is the only trail from a translating address back to the allocation
accountable for it. | | | -| `shardAddressIPv4` _string_ | ShardAddressIPv4 is the dedicated, publicly-routable IPv4 address this
shard translates to, and the source an IPv4-only destination sees.
Unlike ShardAddressIPv6, reachability for it is not established by a
BGPAdvertisement into the EVPN fabric: an IPv4 reply arrives from the
internet, so the underlay or an upstream announcement must attract this
address to this node.
Empty means no IPv4 address is assigned to this shard. | | | -| `shardAddressIPv4ClaimRef` _[AddressClaimRef](#addressclaimref)_ | ShardAddressIPv4ClaimRef records the addressing-service claim
ShardAddressIPv4 came from — see AddressClaimRef. Set it in the same
write as the address whenever that address came from a claim.
Nothing here resolves it and no component reads it to program anything;
it is the only trail from a translating address back to the allocation
accountable for it. | | | -| `nat64Prefix` _string_ | NAT64Prefix is the IPv6 prefix whose synthesized addresses this shard
translates to IPv4 — a Datum-operated Network-Specific Prefix, shared
fabric-wide, never per-tenant. TranslateWellKnownPrefix adds the RFC 6052
Well-Known Prefix alongside it. It must be the prefix the resolver
synthesizes into; a shard translating for a different one is a
blackhole with no symptom on either side.
Set together with ShardAddressIPv4 or not at all: an address with no
prefix has nothing to translate for, and a prefix with no address has
nothing to translate into. Write-once for the same reason the addresses
are: a shard that starts translating a different prefix blackholes every
destination the resolver already synthesized into the old one. | | | -| `translateWellKnownPrefix` _boolean_ | TranslateWellKnownPrefix additionally translates destinations inside the
RFC 6052 Well-Known Prefix 64:ff9b::/96 to IPv4 from ShardAddressIPv4, so
clients using a public DNS64 resolver reach IPv4 destinations. Requires
NAT64Prefix.
RFC 6052 §3.1 forbids the Well-Known Prefix from representing non-global
IPv4 addresses; the implementation must refuse such destinations.
Mutable, unlike NAT64Prefix. Disabling it blackholes every destination
clients already resolved into the Well-Known Prefix until their DNS TTLs
expire. | | | -| `drain` _boolean_ | Drain stops this shard from taking new tenants while it keeps serving
the ones it has. Compute nodes that spread egress across a cluster's
shards give a draining shard no share of new tenant addresses, but keep
sending it every flow already pinned to it until that flow goes idle, so
established sessions finish where their translation state lives.
It changes nothing on the shard itself: the shard keeps translating,
advertising its SID and receiving replies. A shard is safe to remove
once its session count has fallen to zero. Clearing it puts the shard
back into rotation.
Compute nodes that send each tenant to a single configured shard ignore
it. | | | - - -#### EgressShardStatus - - - -EgressShardStatus defines the observed state of an EgressShard. - -The address and prefix fields report what this node's datapath is programmed -with, not what it was asked for. A value here that disagrees with the spec is -a shard that has not converged; a value here with no counterpart in the spec -is a shard still translating to an address nothing assigns any more. - - - -_Appears in:_ -- [EgressShard](#egressshard) - -| Field | Description | Default | Validation | -| --- | --- | --- | --- | -| `observedGeneration` _integer_ | ObservedGeneration is the .metadata.generation this status was computed from. | | | -| `shardSID` _string_ | ShardSID is this shard's own uSID locator — a real SRv6 uSID (unlike
the ShardAddress fields, which are plain routable addresses),
advertised into BGP the same way any other node-reachability route is
(a /128 BGPAdvertisement, no VRFID/Function) so every other node learns
a kernel SEG6 route toward it before installing a tenant VRF's egress
route against it. One SID serves both families: which translation a
packet gets is decided from the inner destination, not from a second
SID.
Reports the SID this node's datapath is programmed with, from
Spec.ShardSID. | | | -| `shardAddressIPv6` _string_ | ShardAddressIPv6 is the IPv6 masquerade source this shard's datapath is
programmed with. Empty means it translates no IPv6 flow. | | | -| `shardAddressIPv4` _string_ | ShardAddressIPv4 is the IPv4 masquerade source this shard's datapath is
programmed with. Empty means it performs no NAT64. Publishing it is also
what makes the underlay reachability prerequisite in
Spec.ShardAddressIPv4 checkable. | | | -| `nat64Prefix` _string_ | NAT64Prefix is the prefix this shard's datapath is programmed to
translate. Empty whenever ShardAddressIPv4 is empty. | | | -| `translatesWellKnownPrefix` _boolean_ | TranslatesWellKnownPrefix reports whether this shard's datapath is
programmed to translate the RFC 6052 Well-Known Prefix 64:ff9b::/96, from
Spec.TranslateWellKnownPrefix. False whenever ShardAddressIPv4 is empty. | | | -| `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#condition-v1-meta) array_ | Conditions contains the standard conditions for this resource,
including Programmed (see ConditionTypeProgrammed). | | | - - #### ExtendedCommunitySet @@ -2201,7 +2107,7 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | | `name` _string_ | Name identifies the relationship on its generated peers. | | MaxLength: 63
MinLength: 1
Pattern: `^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`
| -| `transports` _string array_ | Transports are the transports the mesh runs over. Two endpoints peer
over each transport both are on. | | MaxItems: 16
MinItems: 1
items:MaxLength: 63
items:Pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
| +| `transports` _string array_ | Transports are the transports the mesh runs over. Two endpoints peer
over each transport both are on. | | MaxItems: 16
MinItems: 1
items:MaxLength: 63
items:Pattern: `^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`
| | `families` _[FabricSessionFamily](#fabricsessionfamily) array_ | Families are the IP families sessions run over: one session per
family both endpoints have an address in. | | Enum: [ipv4 ipv6]
MaxItems: 2
MinItems: 1
| | `updateSource` _[FabricUpdateSource](#fabricupdatesource)_ | UpdateSource is where sessions are sourced from. | EndpointAddress | Enum: [EndpointAddress None]
| | `endpointSelector` _[LabelSelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#labelselector-v1-meta)_ | EndpointSelector selects the mesh's endpoints by label. An empty
selector selects every endpoint of the routing domain. | | | @@ -2298,7 +2204,7 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | | `name` _string_ | Name identifies the relationship on its generated peers. | | MaxLength: 63
MinLength: 1
Pattern: `^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`
| -| `transports` _string array_ | Transports are the transports reflection runs over. | | MaxItems: 16
MinItems: 1
items:MaxLength: 63
items:Pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
| +| `transports` _string array_ | Transports are the transports reflection runs over. | | MaxItems: 16
MinItems: 1
items:MaxLength: 63
items:Pattern: `^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`
| | `families` _[FabricSessionFamily](#fabricsessionfamily) array_ | Families are the IP families sessions run over. | | Enum: [ipv4 ipv6]
MaxItems: 2
MinItems: 1
| | `updateSource` _[FabricUpdateSource](#fabricupdatesource)_ | UpdateSource is where sessions are sourced from. | EndpointAddress | Enum: [EndpointAddress None]
| | `reflectorSelector` _[LabelSelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#labelselector-v1-meta)_ | ReflectorSelector selects the reflectors' endpoints by label. | | | @@ -3314,476 +3220,15 @@ _Appears in:_ | `both` | SendCommunityTypeBoth sends standard and extended communities, not
large ones.
| -#### ServiceEndpoint - - - -ServiceEndpoint publishes a platform service that can be reached through a -VPC attachment. The object describes the service contract; the controller -that owns the service is responsible for its health and implementation. - - - - - -| Field | Description | Default | Validation | -| --- | --- | --- | --- | -| `apiVersion` _string_ | `galactic.datumapis.com/v1alpha1` | | | -| `kind` _string_ | `ServiceEndpoint` | | | -| `kind` _string_ | Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds | | | -| `apiVersion` _string_ | APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources | | | -| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | | -| `spec` _[ServiceEndpointSpec](#serviceendpointspec)_ | | | | -| `status` _[ServiceEndpointStatus](#serviceendpointstatus)_ | | | | - - -#### ServiceEndpointAttachmentReference - - - -ServiceEndpointAttachmentReference identifies the private attachment that -backs a platform service endpoint. - - - -_Appears in:_ -- [ServiceEndpointSpec](#serviceendpointspec) - -| Field | Description | Default | Validation | -| --- | --- | --- | --- | -| `namespace` _string_ | Namespace is the namespace containing the Cloud API VPCAttachment. | | MinLength: 1
| -| `name` _string_ | Name is the Cloud API VPCAttachment name. | | MinLength: 1
| - - -#### ServiceEndpointDeliveryMode - -_Underlying type:_ _string_ - -ServiceEndpointDeliveryMode defines the placement contract for a service. - -_Validation:_ -- Enum: [NodeLocal PreferNodeLocal] - -_Appears in:_ -- [ServiceEndpointSpec](#serviceendpointspec) - -| Field | Description | -| --- | --- | -| `NodeLocal` | ServiceEndpointDeliveryModeNodeLocal requires the endpoint's backing
attachment to be present on each node where selected consumers run.
| -| `PreferNodeLocal` | ServiceEndpointDeliveryModePreferNodeLocal selects a backing attachment on
the consumer's node when possible and otherwise tunnels to a ready remote
attachment while preserving the consumer source address.
| - -#### ServiceEndpointDistribution - -_Underlying type:_ _string_ - -ServiceEndpointDistribution selects how traffic spreads across the -producers on one node. - - - -_Appears in:_ -- [ServiceEndpointSpec](#serviceendpointspec) - -| Field | Description | -| --- | --- | -| `Single` | ServiceEndpointDistributionSingle sends every consumer on a node to the
one ready producer there.
| -| `Spread` | ServiceEndpointDistributionSpread spreads flows across the healthy
producers on the consumer's node.
| - - -#### ServiceEndpointHealthCheck - - - -ServiceEndpointHealthCheck configures the TCP health check of an endpoint's -producers. A probe opens a TCP connection to the producer attachment's first -IPv6 address, not the endpoint's address, on Port, through the producer's -host-side interface and from that interface's link-local address. A producer -with no IPv6 address is never probed and stays Unknown. A probe succeeds when the handshake completes within -TimeoutSeconds, and fails when the connection is refused, reset or times -out. A producer's decision changes after UnhealthyThreshold consecutive -failures or HealthyThreshold consecutive successes. A crashed producer -therefore stops receiving new flows within IntervalSeconds × -UnhealthyThreshold, plus TimeoutSeconds. - - - -_Appears in:_ -- [ServiceEndpointSpec](#serviceendpointspec) - -| Field | Description | Default | Validation | -| --- | --- | --- | --- | -| `port` _integer_ | Port is the TCP port probed on every producer, 1-65535. Unset, it is
the endpoint's port, which must then be a tcp port. A udp endpoint must
set it to a TCP port its producers listen on. | | Maximum: 65535
Minimum: 1
| -| `intervalSeconds` _integer_ | IntervalSeconds is the time between two probes of one producer. | 5 | Maximum: 300
Minimum: 1
| -| `timeoutSeconds` _integer_ | TimeoutSeconds is how long a probe waits for the handshake. It must not
exceed IntervalSeconds. | 2 | Maximum: 60
Minimum: 1
| -| `unhealthyThreshold` _integer_ | UnhealthyThreshold is the number of consecutive failed probes that
make a producer Unhealthy. | 3 | Maximum: 10
Minimum: 1
| -| `healthyThreshold` _integer_ | HealthyThreshold is the number of consecutive successful probes that
make a producer Healthy. | 3 | Maximum: 10
Minimum: 1
| - - -#### ServiceEndpointProducerStatus - - - -ServiceEndpointProducerStatus is one producer's health decision. - - - -_Appears in:_ -- [ServiceEndpointStatus](#serviceendpointstatus) - -| Field | Description | Default | Validation | -| --- | --- | --- | --- | -| `namespace` _string_ | Namespace is the producer VPCAttachment's namespace. | | MinLength: 1
| -| `name` _string_ | Name is the producer VPCAttachment's name. | | MinLength: 1
| -| `attachmentUID` _[UID](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#uid-types-pkg)_ | AttachmentUID is the UID of the VPCAttachment that was probed. | | Required: \{\}
| -| `node` _string_ | Node is the node that hosts the producer and probes it. | | MinLength: 1
| -| `port` _integer_ | Port is the TCP port that was probed. | | Maximum: 65535
Minimum: 1
| -| `state` _[BackendHealthState](#backendhealthstate)_ | State is the decision. Healthy and Unknown producers receive new
flows; Unhealthy ones do not, unless every producer on the node is
Unhealthy. | | Enum: [Healthy Unhealthy Unknown]
Required: \{\}
| -| `reason` _string_ | Reason is ProbeSucceeded, ProbeFailed, Pending or ProbeUnavailable. | | MaxLength: 64
Required: \{\}
| -| `message` _string_ | Message is the last probe error, when there is one. | | MaxLength: 1024
| -| `lastTransitionTime` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#time-v1-meta)_ | LastTransitionTime is when State last changed. | | Required: \{\}
| - - -#### ServiceEndpointReference - - - -ServiceEndpointReference identifies a ServiceEndpoint in the policy's -namespace. - - - -_Appears in:_ -- [ServiceRoutePolicySpec](#serviceroutepolicyspec) - -| Field | Description | Default | Validation | -| --- | --- | --- | --- | -| `name` _string_ | Name is the ServiceEndpoint name. | | MinLength: 1
| -#### ServiceEndpointSpec -ServiceEndpointSpec defines a platform service address and its scope. -_Appears in:_ -- [ServiceEndpoint](#serviceendpoint) - -| Field | Description | Default | Validation | -| --- | --- | --- | --- | -| `serviceClass` _string_ | ServiceClass identifies the platform capability implemented by this
endpoint, for example "ipv6-egress-dns". | | MinLength: 1
Required: \{\}
| -| `address` _string_ | Address is the stable address that consumers use to reach the service. | | Required: \{\}
| -| `port` _integer_ | Port is the service port. | | Maximum: 65535
Minimum: 1
Required: \{\}
| -| `deliveryMode` _[ServiceEndpointDeliveryMode](#serviceendpointdeliverymode)_ | DeliveryMode defines how a backing attachment is selected relative to a
consumer. PreferNodeLocal uses a ready attachment on the consumer's node
when one exists and otherwise falls back to a ready remote attachment.
The dataplane preserves the consumer source address. If consumers with
overlapping address space present an identical TCP or UDP five-tuple to the
same replica, it rejects the later ambiguous flow fail-closed rather than
translate the source or risk returning traffic to the wrong VPC. | | Enum: [NodeLocal PreferNodeLocal]
Required: \{\}
| -| `attachmentRef` _[ServiceEndpointAttachmentReference](#serviceendpointattachmentreference)_ | AttachmentRef identifies the Cloud API VPCAttachment that hosts this
endpoint when the service is delivered through a private VPC path.
The network API keeps this reference opaque; the consuming controller
resolves it against the Cloud API. | | | -| `attachmentSelector` _[LabelSelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#labelselector-v1-meta)_ | AttachmentSelector selects the Cloud API VPCAttachments that host replicas
of this endpoint. Labels used here must be assigned by the platform service
controller, not by tenants. The dataplane selects ready replicas for each
consumer according to DeliveryMode and Distribution. | | | -| `region` _string_ | Region limits endpoint selection to a region. An empty value means the
endpoint is not region-scoped. | | | -| `distribution` _[ServiceEndpointDistribution](#serviceendpointdistribution)_ | Distribution says how a consumer's traffic reaches the producers on
its own node. Single, the default, allows one ready producer per node
and VPC and sends every consumer on that node to it; an endpoint that
selects more is refused. Spread sends new flows to any producer on the
consumer's node that its health check has not found Unhealthy: each
TCP connection stays with the producer that received its first packet,
and each UDP datagram picks a producer of its own, which suits
request/response protocols such as DNS but not ones that need a UDP
flow to stay on one producer. An Unhealthy producer keeps its existing
TCP connections and replies, and gets new flows again once it is
Healthy. When every producer on a node is Unhealthy, all of them stay
eligible. A node may hold at most 16 producers of a Spread endpoint. | | Enum: [Single Spread]
| -| `healthCheck` _[ServiceEndpointHealthCheck](#serviceendpointhealthcheck)_ | HealthCheck configures the TCP health check of a Spread endpoint's
producers. Each producer's own node probes it and publishes the
decision in status.producers. Required when Distribution is Spread and
refused otherwise.
Where interface traffic policy is enforced, the producer's policy must
allow TCP from fe80::/10 to the health check port on the Private path,
and the replies back. | | | - - -#### ServiceEndpointStatus - - - -ServiceEndpointStatus reports what the nodes observe of an endpoint. - - - -_Appears in:_ -- [ServiceEndpoint](#serviceendpoint) - -| Field | Description | Default | Validation | -| --- | --- | --- | --- | -| `producers` _[ServiceEndpointProducerStatus](#serviceendpointproducerstatus) array_ | Producers holds the health decision of every producer of a Spread
endpoint. Each node writes the entries of the producers on that node,
under its own field manager, and removes them when the producer stops
being selected. An entry whose attachmentUID no longer matches the
attachment of that name describes an earlier attachment and is ignored. | | MaxItems: 4096
| - - -#### ServiceRouteAuthorization - - - -ServiceRouteAuthorization defines persistent or time-bounded access. - - - -_Appears in:_ -- [ServiceRoutePolicySpec](#serviceroutepolicyspec) - -| Field | Description | Default | Validation | -| --- | --- | --- | --- | -| `persistent` _boolean_ | Persistent retains access until policy withdrawal or VPC lifetime replacement. | | | -| `validUntil` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#time-v1-meta)_ | ValidUntil is the absolute UTC deadline for requests and existing replies.
Node controllers reject deadlines more than two minutes in the future. | | | - - -#### ServiceRouteFrontend - - - -ServiceRouteFrontend declares the consumer-facing service address. - - - -_Appears in:_ -- [ServiceRoutePolicySpec](#serviceroutepolicyspec) - -| Field | Description | Default | Validation | -| --- | --- | --- | --- | -| `address` _string_ | Address is translated to the ServiceEndpoint address for requests and is
restored as the source address for replies. | | | - - -#### ServiceRouteNodeStatus - - - -ServiceRouteNodeStatus acknowledges one node's current programmed path. - - - -_Appears in:_ -- [ServiceRoutePolicyStatus](#serviceroutepolicystatus) - -| Field | Description | Default | Validation | -| --- | --- | --- | --- | -| `nodeName` _string_ | | | | -| `policyUID` _string_ | | | | -| `observedGeneration` _integer_ | | | | -| `inputDigest` _string_ | | | | -| `ready` _boolean_ | | | | -| `validUntil` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#time-v1-meta)_ | | | | - - -#### ServiceRoutePolicy - - - -ServiceRoutePolicy selects VPC attachments that should receive a route to a -platform ServiceEndpoint. The selector is evaluated by the network control -plane; Galactic compiles the selected attachments into dataplane state. - - - - - -| Field | Description | Default | Validation | -| --- | --- | --- | --- | -| `apiVersion` _string_ | `galactic.datumapis.com/v1alpha1` | | | -| `kind` _string_ | `ServiceRoutePolicy` | | | -| `kind` _string_ | Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds | | | -| `apiVersion` _string_ | APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources | | | -| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | | -| `spec` _[ServiceRoutePolicySpec](#serviceroutepolicyspec)_ | | | | -| `status` _[ServiceRoutePolicyStatus](#serviceroutepolicystatus)_ | | | | - - -#### ServiceRoutePolicySpec - - - -ServiceRoutePolicySpec defines service selection and attachment eligibility. - - - -_Appears in:_ -- [ServiceRoutePolicy](#serviceroutepolicy) - -| Field | Description | Default | Validation | -| --- | --- | --- | --- | -| `serviceRef` _[ServiceEndpointReference](#serviceendpointreference)_ | ServiceRef identifies the ServiceEndpoint in this namespace. | | Required: \{\}
| -| `consumerVPCRef` _[ServiceRouteVPCReference](#serviceroutevpcreference)_ | ConsumerVPCRef pins authorization to the immutable lifetime of the VPC
selected by AttachmentSelector. Galactic resolves the name through the
Cloud API and requires both the live name and UID to match. | | | -| `frontend` _[ServiceRouteFrontend](#serviceroutefrontend)_ | Frontend is the address presented inside the consumer VPC. When set,
Galactic translates it to the ServiceEndpoint address and restores it on
replies. | | | -| `authorization` _[ServiceRouteAuthorization](#servicerouteauthorization)_ | Authorization defines the lifetime of translated service access. | | | -| `attachmentSelector` _[LabelSelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#labelselector-v1-meta)_ | AttachmentSelector selects eligible VPC attachments by authoritative
labels. Labels that grant access to platform services must be assigned by
the network control plane, not by tenants. | | Required: \{\}
| -| `protocolPorts` _[ServiceRouteProtocolPort](#servicerouteprotocolport) array_ | ProtocolPorts limits the traffic that the route is intended to carry.
An empty list means the endpoint's declared port and protocol are used. | | | -| `region` _string_ | Region limits selected attachments to a region. An empty value means the
policy applies in every region where the endpoint is available. | | | - - -#### ServiceRoutePolicyStatus - - - -ServiceRoutePolicyStatus contains policy conditions and fenced node reports. - - - -_Appears in:_ -- [ServiceRoutePolicy](#serviceroutepolicy) - -| Field | Description | Default | Validation | -| --- | --- | --- | --- | -| `observedGeneration` _integer_ | ObservedGeneration is the .metadata.generation this status was computed from. | | | -| `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#condition-v1-meta) array_ | Conditions contains durable acceptance and service-availability state. | | | -| `nodes` _[ServiceRouteNodeStatus](#serviceroutenodestatus) array_ | Nodes contains short-lived acknowledgments written by trusted node controllers.
Consumers require current UID, generation, input digest, and unexpired reports. | | | - - -#### ServiceRouteProtocolPort - - - -ServiceRouteProtocolPort identifies an allowed transport protocol and port. - - - -_Appears in:_ -- [ServiceRoutePolicySpec](#serviceroutepolicyspec) - -| Field | Description | Default | Validation | -| --- | --- | --- | --- | -| `port` _integer_ | Port is the transport port. | | Maximum: 65535
Minimum: 1
Required: \{\}
| - - -#### ServiceRouteVPCReference - - - -ServiceRouteVPCReference identifies one immutable Cloud API VPC lifetime. - - - -_Appears in:_ -- [ServiceRoutePolicySpec](#serviceroutepolicyspec) - -| Field | Description | Default | Validation | -| --- | --- | --- | --- | -| `name` _string_ | Name is the VPC name in the policy namespace. | | MinLength: 1
| -| `uid` _string_ | UID is the Kubernetes UID of that VPC lifetime. | | MinLength: 1
| - - -#### ServiceVIPBinding - - - -ServiceVIPBinding drives one worker node's backend-side half of the -DSR/Maglev load-balancer datapath: it tells the node which service VIP a -specific local backend must be reachable on, so the backend can reply to -clients directly (the "Direct Server Return" this design depends on — -see NetworkGateway's doc comment). Generated, never written by users: -galactic-router on each worker node writes one object per (service, VIP, -backend) for every backend a NetworkService's BackendSelector places on that -node, owned by the service, and the same process's per-node reconciler -consumes it. - -EgressKind decides which of two backend mechanisms this object drives, -mirroring the same veth/tap fork the SRv6 uSID decap datapath already -has (internal/plumbing/ebpf/usidmap's egress_kind field). Both mechanisms -now converge on the same VIP-boundary substitution -(BackendAddress:BackendPort for VIPAddress:Port at the SRv6 uSID TC-BPF -boundary, usid_ingress's inbound half / usid_egress's outbound half) — -required for both, not just tap, since a decapsulated ingress packet is -delivered into the owning tenant's own VRF routing table, which has no -route to an address bound outside that VRF (found live: see galactic's -ServiceVIPBindingReconciler doc comment): - - - veth (container backend): the node ALSO binds VIPAddress on its own - galactic-vip0 dummy interface (internal/plumbing/vip's - Bind/Unbind/Verify in galactic) — this alone does not deliver - anything to the backend pod (galactic-vip0 lives in the node's root - namespace, not the tenant's VRF), but still lets the node itself - verifiably answer on the VIP. - - tap (VM backend): there is no guest-side configuration capability in - this repo by design (internal/cnitap's own doc comment), so the - substitution above is this kind's *only* delivery mechanism — the - guest OS never needs to know the VIP exists at all. - - - - - -| Field | Description | Default | Validation | -| --- | --- | --- | --- | -| `apiVersion` _string_ | `galactic.datumapis.com/v1alpha1` | | | -| `kind` _string_ | `ServiceVIPBinding` | | | -| `kind` _string_ | Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds | | | -| `apiVersion` _string_ | APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources | | | -| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | | -| `spec` _[ServiceVIPBindingSpec](#servicevipbindingspec)_ | | | | -| `status` _[ServiceVIPBindingStatus](#servicevipbindingstatus)_ | | | | - - -#### ServiceVIPBindingEgressKind - -_Underlying type:_ _string_ - -ServiceVIPBindingEgressKind mirrors usidmap's EgressKindVeth/EgressKindTap -constants at the API layer — see ServiceVIPBinding's doc comment. - -_Validation:_ -- Enum: [veth tap] - -_Appears in:_ -- [ServiceVIPBindingSpec](#servicevipbindingspec) - -| Field | Description | -| --- | --- | -| `veth` | ServiceVIPBindingEgressKindVeth selects the netns-bind mechanism.
| -| `tap` | ServiceVIPBindingEgressKindTap selects the transparent tap-boundary
translation mechanism.
| - - -#### ServiceVIPBindingHealth - - - -ServiceVIPBindingHealth is the health decision for a binding's backend. A -decision describes one backend: the VPCAttachment with AttachmentUID, probed -on Port. A reader treats a decision whose attachment UID or port does not -match the backend it is checking as Unknown. - - - -_Appears in:_ -- [ServiceVIPBindingStatus](#servicevipbindingstatus) - -| Field | Description | Default | Validation | -| --- | --- | --- | --- | -| `state` _[BackendHealthState](#backendhealthstate)_ | State is the decision. | | Enum: [Healthy Unhealthy Unknown]
Required: \{\}
| -| `reason` _string_ | Reason is ProbeSucceeded, ProbeFailed, Pending or ProbeUnavailable. | | MaxLength: 64
Required: \{\}
| -| `message` _string_ | Message is the last probe error, when there is one. | | MaxLength: 1024
| -| `attachmentUID` _[UID](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#uid-types-pkg)_ | AttachmentUID is the UID of the VPCAttachment that held the backend's
address when the decision was made. | | Required: \{\}
| -| `port` _integer_ | Port is the TCP port that was probed. | | Maximum: 65535
Minimum: 1
Required: \{\}
| -| `lastTransitionTime` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#time-v1-meta)_ | LastTransitionTime is when State last changed. | | Required: \{\}
| - - -#### ServiceVIPBindingSpec - - - -ServiceVIPBindingSpec defines the desired VIP binding/translation state. - - - -_Appears in:_ -- [ServiceVIPBinding](#servicevipbinding) - -| Field | Description | Default | Validation | -| --- | --- | --- | --- | -| `targetRef` _[TargetRef](#targetref)_ | TargetRef identifies the Node this binding applies to. | | Required: \{\}
| -| `vpcRef` _string_ | VPCRef is the opaque identifier of the VPC the backend belongs to,
copied from the owning NetworkService. It names the tenant VRF the
binding's translation rows are written for, so two tenants using the
same backend address on one node never share a row. | | MinLength: 1
Required: \{\}
| -| `vipAddress` _string_ | VIPAddress is the service VIP the backend must be reachable on. | | Required: \{\}
| -| `port` _integer_ | Port is the VIP-facing port traffic arrives on. | | Maximum: 65535
Minimum: 1
Required: \{\}
| -| `backendAddress` _string_ | BackendAddress is the backend's own real address (its pod-netns
address for a veth backend, or its actual guest-facing address for a
tap backend) — the VIP-boundary substitution target for both kinds
now (see EgressKind's own doc comment for why veth needs this too,
not just tap). +optional at the API level for the same reason
EgressKind itself carries no matching CEL requirement; the
reconciler validates it's set for either kind before doing anything. | | | -| `backendPort` _integer_ | BackendPort is the backend's own real port, paired with
BackendAddress — required for both kinds, see that field's doc
comment. | | Maximum: 65535
Minimum: 1
| -| `egressKind` _[ServiceVIPBindingEgressKind](#servicevipbindingegresskind)_ | EgressKind selects which backend mechanism this binding drives. | | Enum: [veth tap]
Required: \{\}
| - - -#### ServiceVIPBindingStatus - - - -ServiceVIPBindingStatus defines the observed state of a ServiceVIPBinding. - - - -_Appears in:_ -- [ServiceVIPBinding](#servicevipbinding) - -| Field | Description | Default | Validation | -| --- | --- | --- | --- | -| `observedGeneration` _integer_ | ObservedGeneration is the .metadata.generation this status was computed from. | | | -| `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#condition-v1-meta) array_ | Conditions contains the standard conditions for this resource,
including Bound (set True once internal/plumbing/vip.Verify or the
equivalent tap-translation-table check confirms the backend is
actually reachable on VIPAddress, not merely that the bind/table-write
call itself returned nil). | | | -| `health` _[ServiceVIPBindingHealth](#servicevipbindinghealth)_ | Health is the health decision for this binding's backend, set by
galactic-router on the backend's node while the owning NetworkService
has a healthCheck, and cleared once it has none. Every binding of one
backend carries the same decision. | | | - #### StandardCommunityAction @@ -3813,8 +3258,6 @@ Supported values for kind: Node. _Appears in:_ - [BGPRouterSpec](#bgprouterspec) -- [EgressShardSpec](#egressshardspec) -- [ServiceVIPBindingSpec](#servicevipbindingspec) | Field | Description | Default | Validation | | --- | --- | --- | --- | diff --git a/docs/api/network-gateway.md b/docs/api/network-gateway.md index ec4004b85..7f8993b9f 100644 --- a/docs/api/network-gateway.md +++ b/docs/api/network-gateway.md @@ -1,3 +1,7 @@ + + +Generated from `api/network/v1alpha1`. Edit the API comments or `.crd-ref-docs-network-gateway.yaml`, then run `task generate:api-docs`. See the [API index](README.md) for resource ownership. + # API Reference ## Packages @@ -87,7 +91,7 @@ _Appears in:_ | Field | Description | | --- | --- | | `Healthy` | BackendHealthHealthy: the last HealthyThreshold probes succeeded.
| -| `Unhealthy` | BackendHealthUnhealthy: the last UnhealthyThreshold probes failed. Only
this state takes a backend out of the gateways' Maglev tables.
| +| `Unhealthy` | BackendHealthUnhealthy: the last UnhealthyThreshold probes failed. Only
this state filters a backend with FailOpen; FailClosed also filters
Unknown, missing and expired decisions.
| | `Unknown` | BackendHealthUnknown: too few probes have completed to decide, or the
probe cannot run on the backend's node.
| @@ -453,6 +457,7 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | +| `failurePolicy` _string_ | FailurePolicy determines whether unknown and all-unhealthy backends may
receive traffic. FailClosed requires a current Healthy decision and
withdraws the service when health filtering is unavailable. | FailOpen | Enum: [FailOpen FailClosed]
| | `port` _integer_ | Port is the TCP port probed on every backend, 1-65535. Unset, it is the
service's backendPort. A udp service must set it to a TCP port its
backends listen on, since a UDP datagram draws no reply a generic
probe can expect. | | Maximum: 65535
Minimum: 1
| | `intervalSeconds` _integer_ | IntervalSeconds is the time between two probes of one backend. | 5 | Maximum: 300
Minimum: 1
| | `timeoutSeconds` _integer_ | TimeoutSeconds is how long a probe waits for the handshake. It must not
exceed IntervalSeconds. | 2 | Maximum: 60
Minimum: 1
| @@ -534,7 +539,7 @@ _Appears in:_ | `backendSelector` _[LabelSelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#labelselector-v1-meta)_ | BackendSelector selects the VPCAttachments (galactic.datumapis.com/v1alpha1)
that serve this service, matched against each VPCAttachment object's own
labels: in any namespace for a service in a gateway namespace, and only
in its own namespace for a service in a project namespace. Only
attachments whose status.vpc equals VPCRef are candidates, whatever their
labels, so a selector cannot reach into another tenant's VPC. Each selected attachment contributes the
IPv6 addresses in its spec.interface.addresses as backends, on
BackendPort, for both VIPs: its node translates the IPv4 VIP's flows to
and from IPv6, and its IPv4 addresses are never backends. An attachment
with no status.node, or no IPv6 address, is not a backend until it has
both. An empty selector is rejected rather than read as "every
attachment in the VPC". | | Required: \{\}
| | `backendPort` _integer_ | BackendPort is the destination port on every selected backend, 1-65535.
Like Port, it is required for tcp, udp and sctp and must be unset for
esp, gre and icmp. Zero means unset and is omitted when encoding, and an
explicit 0 is refused. | | Maximum: 65535
Minimum: 1
| | `sessionAffinity` _[NetworkServiceSessionAffinity](#networkservicesessionaffinity)_ | SessionAffinity selects which connections from one client share a
backend: None, the default, balances each connection on its own;
ClientIP pins a client address to one backend; ClientIPAndProtocol pins
a client address and protocol to one. Two services pin a client to the
same backend only if both set the same affinity and select the same
backend addresses. A change takes effect on every gateway node without a
restart, and rehashes every connection of the service, so most open
connections reach a different backend afterwards. | None | Enum: [None ClientIP ClientIPAndProtocol]
| -| `healthCheck` _[NetworkServiceHealthCheck](#networkservicehealthcheck)_ | HealthCheck turns on health checks for the service's backends. Each
backend's own node opens a TCP connection to it on the health check
port, from the link-local address of the backend's host-side interface,
and publishes a decision in status.health of the backend's
ServiceVIPBindings. The gateway nodes take a backend whose decision is
Unhealthy out of the service's Maglev table, and keep every backend
when all of them are Unhealthy. Unset, no backend is probed and every
one stays in the table.
Where interface traffic policy is enforced, the backend's policy must
allow TCP from fe80::/10 to the health check port on the Private path,
and the replies back. | | | +| `healthCheck` _[NetworkServiceHealthCheck](#networkservicehealthcheck)_ | HealthCheck turns on health checks for the service's backends. Each
backend's own node opens a TCP connection to it on the health check
port, from the link-local address of the backend's host-side interface,
and publishes a decision in status.health of the backend's
ServiceVIPBindings. The gateway nodes take a backend whose decision is
Unhealthy out of the service's Maglev table, and keep every backend
when all of them are Unhealthy by default. FailClosed instead requires
fresh Healthy results for the current configuration and withdraws a VIP
with no healthy backends. Unset, no backend is probed and every
one stays in the table.
Where interface traffic policy is enforced, the backend's policy must
allow TCP from fe80::/10 to the health check port on the Private path,
and the replies back. | | | #### NetworkServiceStatus @@ -979,6 +984,8 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | +| `lastProbeTime` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#time-v1-meta)_ | LastProbeTime is refreshed after every probe for FailClosed services. | | | +| `observedGeneration` _integer_ | ObservedGeneration identifies the NetworkService configuration probed. | | | | `state` _[BackendHealthState](#backendhealthstate)_ | State is the decision. | | Enum: [Healthy Unhealthy Unknown]
Required: \{\}
| | `reason` _string_ | Reason is ProbeSucceeded, ProbeFailed, Pending or ProbeUnavailable. | | MaxLength: 64
Required: \{\}
| | `message` _string_ | Message is the last probe error, when there is one. | | MaxLength: 1024
| diff --git a/hack/docs/.gitignore b/hack/docs/.gitignore new file mode 100644 index 000000000..c18dd8d83 --- /dev/null +++ b/hack/docs/.gitignore @@ -0,0 +1 @@ +__pycache__/ diff --git a/hack/docs/check.py b/hack/docs/check.py new file mode 100644 index 000000000..dd1adb204 --- /dev/null +++ b/hack/docs/check.py @@ -0,0 +1,232 @@ +#!/usr/bin/env python3 +"""Check local documentation links, GitHub anchors and generated API coverage.""" + +import argparse +from collections import Counter +from dataclasses import dataclass +from html.parser import HTMLParser +from pathlib import Path +import re +import subprocess +import unicodedata +from urllib.parse import unquote, urlsplit + +from markdown_it import MarkdownIt + + +ROOT = Path(__file__).resolve().parents[2] +MARKDOWN = MarkdownIt("commonmark").enable("table") +API_PACKAGES = { + "api/v1alpha1": ("galactic.md",), + "api/cloud/v1alpha1": ("cloud.md",), + "api/network/v1alpha1": ("network-bgp.md", "network-gateway.md"), +} + + +@dataclass(frozen=True) +class Link: + target: str + line: int + + +@dataclass +class Document: + anchors: set[str] + links: list[Link] + + +class HTMLLinks(HTMLParser): + """Collect explicit anchors and local destinations without inspecting comments.""" + + def __init__(self, line: int): + super().__init__(convert_charrefs=True) + self.line = line + self.anchors: set[str] = set() + self.links: list[Link] = [] + + def handle_starttag(self, tag, attrs): + attrs = dict(attrs) + if attrs.get("id"): + self.anchors.add(attrs["id"]) + if tag == "a" and attrs.get("name"): + self.anchors.add(attrs["name"]) + attribute = "href" if tag == "a" else "src" if tag == "img" else None + if attribute and attrs.get(attribute): + self.links.append(Link(attrs[attribute], self.line + self.getpos()[0] - 1)) + + handle_startendtag = handle_starttag + + +def heading_text(tokens) -> str: + """Extract visible text, including code and image labels, from a heading.""" + return "".join( + token.content if token.type in ("text", "code_inline") + else heading_text(token.children or []) if token.type == "image" + else " " if token.type in ("softbreak", "hardbreak") else "" + for token in tokens + ) + + +def slug(text: str) -> str: + """Apply GitHub's heading punctuation removal and space replacement.""" + return "".join( + char for char in text.lower() + if char in "-_ " or unicodedata.category(char)[0] in "LNM" + ).replace(" ", "-") + + +def parse_document(text: str) -> Document: + tokens = MARKDOWN.parse(text) + document = Document(set(), []) + generated: set[str] = set() + heading = False + for token in tokens: + if token.type == "heading_open": + heading = True + elif token.type == "heading_close": + heading = False + elif token.type == "inline": + line = token.map[0] + 1 if token.map else 1 + if heading: + base = slug(heading_text(token.children or [])) + anchor = base + suffix = 0 + while anchor in generated: + suffix += 1 + anchor = f"{base}-{suffix}" + generated.add(anchor) + document.anchors.add(anchor) + for child in token.children or []: + if child.type == "link_open": + document.links.append(Link(child.attrGet("href"), line)) + elif child.type == "image": + document.links.append(Link(child.attrGet("src"), line)) + elif child.type == "html_inline": + html = HTMLLinks(line) + html.feed(child.content) + document.anchors.update(html.anchors) + document.links.extend(html.links) + elif child.type in ("softbreak", "hardbreak"): + line += 1 + elif token.type == "html_block": + html = HTMLLinks(token.map[0] + 1 if token.map else 1) + html.feed(token.content) + document.anchors.update(html.anchors) + document.links.extend(html.links) + return document + + +def link_errors(root: Path, sources: list[Path]) -> list[str]: + """Check all links in docs/ and entry points, and links into docs/ elsewhere.""" + root = root.resolve() + documents = {} + errors = [] + + def read(path): + if path not in documents: + documents[path] = parse_document(path.read_text()) + return documents[path] + + for source in sources: + source = source.resolve() + relative = source.relative_to(root) + complete = relative.parts[0] == "docs" or str(relative) in ("README.md", "AGENTS.md") + for link in read(source).links: + url = urlsplit(link.target) + if url.scheme or url.netloc: + continue + path = unquote(url.path) + target = (root / path.lstrip("/") if path.startswith("/") + else source.parent / path if path else source).resolve() + if not complete and not target.is_relative_to(root / "docs"): + continue + location = f"{relative}:{link.line}" + if not target.is_relative_to(root): + errors.append(f"{location}: link leaves repository: {link.target}") + continue + if not target.exists(): + errors.append(f"{location}: missing file: {link.target}") + continue + if target.is_dir(): + target = target / "README.md" + if not target.exists(): + if url.fragment: + errors.append(f"{location}: directory has no README for anchor: {link.target}") + continue + if target.suffix.lower() == ".md" and url.fragment: + anchor = unquote(url.fragment) + if anchor not in read(target).anchors: + errors.append(f"{location}: missing anchor: {link.target}") + return errors + + +def resource_names(package: Path) -> set[str]: + """Find resource structs by ObjectMeta, not by suffix (PrefixList is a kind).""" + names = set() + for source in package.glob("*.go"): + if source.name.endswith("_test.go"): + continue + for match in re.finditer(r"^type (\w+) struct \{(.*?)^\}", source.read_text(), re.M | re.S): + if re.search(r"\bmetav1\.ObjectMeta\b", match[2]): + names.add(match[1]) + return names + + +def indexed_resources(text: str) -> list[str]: + match = re.search(r"^### Resource Types\s*\n(.*?)(?=^#{1,4} |\Z)", text, re.M | re.S) + return re.findall(r"^- \[([^]]+)\]\(#[^)]+\)", match[1], re.M) if match else [] + + +def api_errors(root: Path) -> list[str]: + errors = [] + for package, references in API_PACKAGES.items(): + indexed = Counter() + for name in references: + path = root / "docs/api" / name + if not path.exists(): + errors.append(f"docs/api/{name}: missing generated reference") + continue + text = path.read_text() + resources = indexed_resources(text) + indexed.update(resources) + anchors = parse_document(text).anchors + for resource in resources: + if slug(resource) not in anchors: + errors.append(f"docs/api/{name}: no section for indexed resource {resource}") + expected = resource_names(root / package) + for missing in sorted(expected - indexed.keys()): + errors.append(f"{package}: resource missing from API index: {missing}") + for extra in sorted(indexed.keys() - expected): + errors.append(f"{package}: index names an unknown resource: {extra}") + for name, count in sorted(indexed.items()): + if count != 1: + errors.append(f"{package}: resource appears {count} times in API indexes: {name}") + return errors + + +def markdown_sources(root: Path) -> list[Path]: + """Include uncommitted docs and tracked Markdown callers without walking worktrees.""" + result = subprocess.run(["git", "ls-files", "-z", "--", "*.md"], cwd=root, + check=True, capture_output=True, text=True) + sources = {root / name for name in result.stdout.split("\0") if name} + sources.update((root / "docs").rglob("*.md")) + return sorted({p.resolve() for p in sources if p.is_file()}) + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--root", type=Path, default=ROOT, help="Repository root") + args = parser.parse_args() + root = args.root.resolve() + sources = markdown_sources(root) + errors = link_errors(root, sources) + api_errors(root) + if errors: + print("\n".join(errors)) + print(f"Documentation check failed: {len(errors)} errors.") + return 1 + print(f"Documentation links and API resource coverage passed ({len(sources)} Markdown files).") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/hack/docs/generate_api.py b/hack/docs/generate_api.py new file mode 100644 index 000000000..369e51a96 --- /dev/null +++ b/hack/docs/generate_api.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python3 +"""Generate API references, or compare temporary output with committed files.""" + +import argparse +import difflib +from pathlib import Path +import subprocess +import re +import tempfile + + +ROOT = Path(__file__).resolve().parents[2] +REFERENCES = ( + ("api/v1alpha1", "galactic", ".crd-ref-docs.yaml"), + ("api/cloud/v1alpha1", "cloud", ".crd-ref-docs-cloud.yaml"), + ("api/network/v1alpha1", "network-bgp", ".crd-ref-docs-network-bgp.yaml"), + ("api/network/v1alpha1", "network-gateway", ".crd-ref-docs-network-gateway.yaml"), +) +GENERATOR = "github.com/elastic/crd-ref-docs@v0.2.0" + + +def format_validation_patterns(text: str) -> str: + """Quote array regex validations that crd-ref-docs v0.2.0 leaves as Markdown.""" + def quote(match): + pattern = match[1] + if pattern.startswith("`"): + return match[0] + fence = "`" * (max((len(run) for run in re.findall(r"`+", pattern)), default=0) + 1) + return f"items:Pattern: {fence}{pattern}{fence}
" + + return re.sub(r"items:Pattern: ([^\n]*?)
", quote, text) + + +def generate(root: Path, check: bool) -> bool: + """Return whether committed references match, writing only outside check mode.""" + matched = True + with tempfile.TemporaryDirectory(prefix="galactic-api-docs-") as temporary: + for source, name, config in REFERENCES: + generated = Path(temporary) / f"{name}.md" + subprocess.run( + ["go", "run", GENERATOR, "--renderer=markdown", + f"--source-path={source}", f"--output-path={generated}", + f"--config={config}"], + cwd=root, check=True, + ) + banner = ( + "\n\n" + f"Generated from `{source}`. Edit the API comments or `{config}`, " + "then run `task generate:api-docs`. " + "See the [API index](README.md) for resource ownership.\n\n" + ) + expected = banner + format_validation_patterns(generated.read_text()).rstrip() + "\n" + target = root / "docs/api" / f"{name}.md" + if check: + actual = target.read_text() if target.exists() else "" + if actual != expected: + matched = False + print(f"API reference drift: {target.relative_to(root)}") + diff = list(difflib.unified_diff( + actual.splitlines(), expected.splitlines(), + fromfile=str(target.relative_to(root)), tofile="regenerated", + lineterm="", + )) + print("\n".join(diff[:60])) + if len(diff) > 60: + print(f"... {len(diff) - 60} more diff lines") + else: + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text(expected) + return matched + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--check", action="store_true", help="Compare without changing tracked files") + args = parser.parse_args() + if not generate(ROOT, args.check): + print("Run task generate:api-docs and commit the updated references.") + return 1 + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/hack/docs/requirements.txt b/hack/docs/requirements.txt new file mode 100644 index 000000000..19274be25 --- /dev/null +++ b/hack/docs/requirements.txt @@ -0,0 +1,3 @@ +# CommonMark parsing keeps examples, code spans and reference links accurate. +markdown-it-py==4.0.0 +mdurl==0.1.2 diff --git a/hack/docs/test_check.py b/hack/docs/test_check.py new file mode 100644 index 000000000..0bda851af --- /dev/null +++ b/hack/docs/test_check.py @@ -0,0 +1,112 @@ +"""Regression tests for documentation failures that string matching misses.""" + +from pathlib import Path +import tempfile +import unittest + +from check import api_errors, link_errors, parse_document, resource_names + + +class MarkdownTests(unittest.TestCase): + def test_code_and_comments_are_not_links(self): + document = parse_document('''# Start +`[fake](missing.md)` + +```md +[fake](missing.md) +``` + + [fake](missing.md) + + + +[real](exists.md) +''') + self.assertEqual([link.target for link in document.links], ["exists.md"]) + + def test_reference_image_and_html_links(self): + document = parse_document('''[guide][ref] +![diagram](images/a%20b.svg) +Other + + +[ref]: guide.md#start +''') + self.assertEqual([link.target for link in document.links], + ["guide.md#start", "images/a%20b.svg", "other.md#here", "images/other.svg"]) + + def test_heading_anchors_and_aliases(self): + document = parse_document('''# `Active/active` **egress** +## Café & UDP +## Repeat +## Repeat +## Repeat-1 + + +''') + self.assertEqual(document.anchors, {"activeactive-egress", "café--udp", "repeat", + "repeat-1", "repeat-1-1", "old-heading", "legacy"}) + + def test_missing_anchors_files_and_outside_paths_fail(self): + with tempfile.TemporaryDirectory() as temporary: + root = Path(temporary) + docs = root / "docs" + docs.mkdir() + source = docs / "README.md" + source.write_text("[good](target.md#old)\n[bad](target.md#absent)\n" + "[missing](missing.md)\n[outside](../../missing.md)\n") + (docs / "target.md").write_text('# New\n\n') + errors = link_errors(root, [source]) + self.assertEqual(len(errors), 3) + self.assertTrue(any("missing anchor" in error for error in errors)) + self.assertTrue(any("missing file" in error for error in errors)) + self.assertTrue(any("leaves repository" in error for error in errors)) + + def test_paths_fragments_and_scope(self): + with tempfile.TemporaryDirectory() as temporary: + root = Path(temporary) + docs = root / "docs" + docs.mkdir() + (docs / "a b.md").write_text("# Hello\n") + source = root / "elsewhere.md" + source.write_text("[good](/docs/a%20b.md#hello)\n[ignored](missing.md)\n" + "[bad](docs/a%20b.md#missing)\n[web](https://example.com/absent)\n") + self.assertEqual(len(link_errors(root, [source])), 1) + + +class APIReferenceTests(unittest.TestCase): + def test_real_list_named_resource_is_required(self): + with tempfile.TemporaryDirectory() as temporary: + root = Path(temporary) + package = root / "api/network/v1alpha1" + package.mkdir(parents=True) + (package / "types.go").write_text('''package v1alpha1 + type Irrelevant struct {} +type BGPPrefixList struct { + metav1.ObjectMeta +} +type BGPPrefixListList struct { + metav1.ListMeta +} +''') + self.assertEqual(resource_names(package), {"BGPPrefixList"}) + errors = api_errors(root) + self.assertTrue(any("resource missing from API index: BGPPrefixList" in e for e in errors)) + + def test_duplicate_indexes_and_missing_sections_fail(self): + with tempfile.TemporaryDirectory() as temporary: + root = Path(temporary) + docs = root / "docs/api" + docs.mkdir(parents=True) + package = root / "api/network/v1alpha1" + package.mkdir(parents=True) + (package / "types.go").write_text("type Resource struct {\n metav1.ObjectMeta\n}\n") + for name in ("network-bgp.md", "network-gateway.md"): + (docs / name).write_text("### Resource Types\n- [Resource](#resource)\n") + errors = api_errors(root) + self.assertTrue(any("appears 2 times" in e for e in errors)) + self.assertTrue(any("no section for indexed resource" in e for e in errors)) + + +if __name__ == "__main__": + unittest.main() diff --git a/hack/docs/test_generate_api.py b/hack/docs/test_generate_api.py new file mode 100644 index 000000000..d39bf2e48 --- /dev/null +++ b/hack/docs/test_generate_api.py @@ -0,0 +1,41 @@ +"""Check generated Markdown escaping and the read-only drift gate.""" + +from contextlib import redirect_stdout +from io import StringIO +from pathlib import Path +import tempfile +import unittest +from unittest.mock import patch + +from check import parse_document +from generate_api import format_validation_patterns, generate, REFERENCES + + +class GenerationTests(unittest.TestCase): + def test_array_regex_is_code_not_a_link(self): + pattern = "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" + raw = "| Validation |\n| --- |\n| items:Pattern: " + pattern + "
|\n" + rendered = format_validation_patterns(raw) + self.assertIn("`" + pattern + "`", rendered) + self.assertEqual(parse_document(rendered).links, []) + self.assertEqual(format_validation_patterns(rendered), rendered) + + def test_check_detects_drift_without_editing_checkout(self): + def render(args, **kwargs): + output = next(arg.split("=", 1)[1] for arg in args if arg.startswith("--output-path=")) + Path(output).write_text("# API Reference\n\n") + + with tempfile.TemporaryDirectory() as temporary, patch("generate_api.subprocess.run", side_effect=render): + root = Path(temporary) + self.assertTrue(generate(root, check=False)) + self.assertTrue(generate(root, check=True)) + target = root / "docs/api" / f"{REFERENCES[0][1]}.md" + target.write_text("# Stale reference\n") + before = {path: path.read_bytes() for path in (root / "docs/api").glob("*.md")} + with redirect_stdout(StringIO()): + self.assertFalse(generate(root, check=True)) + self.assertEqual(before, {path: path.read_bytes() for path in before}) + + +if __name__ == "__main__": + unittest.main() From 1112943bb7452ff0de6e02e5fde576032c5af960 Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Mon, 26 Oct 2026 08:00:49 -0400 Subject: [PATCH 3/4] docs: Link readers to maintained guides Update repository callers to the canonical component, operations and observability pages. Compatibility pages remain available for external links, while every maintained guide is reachable from the main index. --- config/galactic-cni/README.md | 2 +- deploy/containerlab/README.md | 204 ++++++++++++------------ docs/architecture/README.md | 4 +- docs/cni/architecture.md | 4 +- docs/cni/environment-variables.md | 2 +- docs/controller/README.md | 6 +- docs/designs/README.md | 2 +- docs/designs/private-service-connect.md | 6 +- docs/gateway/architecture.md | 4 +- docs/gateway/deployment.md | 4 +- docs/gateway/packet-paths.md | 2 +- docs/nat/active-active-rollout.md | 2 +- docs/nat/configuration.md | 2 +- docs/nat/deployment.md | 2 +- docs/observability/gateway.md | 2 +- docs/router/architecture.md | 4 +- docs/router/configuration.md | 2 +- docs/traffic-policy/controller.md | 2 +- docs/traffic-policy/node.md | 4 +- docs/traffic-policy/rollout.md | 2 +- examples/edge-provider/README.md | 14 +- 21 files changed, 138 insertions(+), 138 deletions(-) diff --git a/config/galactic-cni/README.md b/config/galactic-cni/README.md index 8af71ba5d..4005b39d4 100644 --- a/config/galactic-cni/README.md +++ b/config/galactic-cni/README.md @@ -10,7 +10,7 @@ kubectl apply -k config/galactic-cni/ or as part of the whole platform with `kubectl apply -k config/`. This DaemonSet opts in via the independent `galactic.datumapis.com/galactic: router` label and runs on both compute and edge nodes (see -[docs/node-labels.md](../../docs/node-labels.md)). +[docs/node-labels.md](../../docs/operations/node-labels.md)). ## What's here diff --git a/deploy/containerlab/README.md b/deploy/containerlab/README.md index ef66e4cf2..6a5aa8d5d 100644 --- a/deploy/containerlab/README.md +++ b/deploy/containerlab/README.md @@ -73,20 +73,20 @@ link and the transit mesh stay single links: nothing attaches to them. the next free one, so `eth1` is still the transit-facing member on every edge node. The table below lists the members. -| Node | Bond | Members | Peer | -|-------------|-------|-----------|--------------------------| -| dfw-worker | bond0 | eth1 eth3 | dfw-worker2 bond1 | -| dfw-worker | bond1 | eth2 eth4 | dfw-worker3 bond1 | -| dfw-worker2 | bond0 | eth1 eth3 | tr1 bond1 (eth1 eth6) | -| dfw-worker2 | bond1 | eth2 eth4 | dfw-worker bond0 | -| dfw-worker3 | bond0 | eth1 eth3 | tr1 bond2 (eth5 eth7) | -| dfw-worker3 | bond1 | eth2 eth4 | dfw-worker bond1 | -| sjc-worker | bond0 | eth1 eth2 | sjc-worker2 bond1 | -| sjc-worker2 | bond0 | eth1 eth3 | tr2 bond1 (eth1 eth5) | -| sjc-worker2 | bond1 | eth2 eth4 | sjc-worker bond0 | -| iad-worker | bond0 | eth1 eth2 | iad-worker2 bond1 | -| iad-worker2 | bond0 | eth1 eth4 | tr3 bond1 (eth4 eth5) | -| iad-worker2 | bond1 | eth2 eth5 | iad-worker bond0 | +| Node | Bond | Members | Peer | +| ------------- | ------- | ----------- | -------------------------- | +| dfw-worker | bond0 | eth1 eth3 | dfw-worker2 bond1 | +| dfw-worker | bond1 | eth2 eth4 | dfw-worker3 bond1 | +| dfw-worker2 | bond0 | eth1 eth3 | tr1 bond1 (eth1 eth6) | +| dfw-worker2 | bond1 | eth2 eth4 | dfw-worker bond0 | +| dfw-worker3 | bond0 | eth1 eth3 | tr1 bond2 (eth5 eth7) | +| dfw-worker3 | bond1 | eth2 eth4 | dfw-worker bond1 | +| sjc-worker | bond0 | eth1 eth2 | sjc-worker2 bond1 | +| sjc-worker2 | bond0 | eth1 eth3 | tr2 bond1 (eth1 eth5) | +| sjc-worker2 | bond1 | eth2 eth4 | sjc-worker bond0 | +| iad-worker | bond0 | eth1 eth2 | iad-worker2 bond1 | +| iad-worker2 | bond0 | eth1 eth4 | tr3 bond1 (eth4 eth5) | +| iad-worker2 | bond1 | eth2 eth5 | iad-worker bond0 | `task verify:bonds` (part of `task verify`) checks every member on both ends is collecting and distributing in its bond's active aggregator. `task @@ -107,21 +107,21 @@ hanging off `tr4`, the transit router with no site attached. ### Node roles -| Node | Kind | Role | -|---------------------|---------------|--------------------------------------------------------------------------------| -| `dfw-control-plane` | ext-container | Kind control-plane; runs Cilium, Multus | -| `dfw-worker` | ext-container | compute: FRR PE, galactic-router PE, galactic-cni | -| `dfw-worker2` | ext-container | edge: FRR PE, galactic-router PE, galactic-cni, egress shard, galactic-gateway | -| `dfw-worker3` | ext-container | edge: dfw's second edge node, same components as `dfw-worker2` | -| `sjc-control-plane` | ext-container | Kind control-plane; runs Cilium, Multus | -| `sjc-worker` | ext-container | compute: FRR PE, galactic-router PE, galactic-cni | -| `sjc-worker2` | ext-container | edge: FRR PE, galactic-router PE, galactic-cni, egress shard, galactic-gateway | -| `iad-control-plane` | ext-container | Kind control-plane; runs Cilium, Multus | -| `iad-worker` | ext-container | compute: FRR PE, galactic-router PE, galactic-cni | -| `iad-worker2` | ext-container | edge: FRR PE, galactic-router PE, galactic-cni, egress shard, galactic-gateway | -| `iad-worker3` | ext-container | EVPN route reflector for all three clusters; FRR PE only | -| `tr1`–`tr4` | linux (FRR) | iBGP full mesh, AS 65100 | -| `remote-host` | linux (nginx) | off-fabric host on `tr4`; runs no Galactic component, no BGP; VIP client | +| Node | Kind | Role | +| --------------------- | --------------- | -------------------------------------------------------------------------------- | +| `dfw-control-plane` | ext-container | Kind control-plane; runs Cilium, Multus | +| `dfw-worker` | ext-container | compute: FRR PE, galactic-router PE, galactic-cni | +| `dfw-worker2` | ext-container | edge: FRR PE, galactic-router PE, galactic-cni, egress shard, galactic-gateway | +| `dfw-worker3` | ext-container | edge: dfw's second edge node, same components as `dfw-worker2` | +| `sjc-control-plane` | ext-container | Kind control-plane; runs Cilium, Multus | +| `sjc-worker` | ext-container | compute: FRR PE, galactic-router PE, galactic-cni | +| `sjc-worker2` | ext-container | edge: FRR PE, galactic-router PE, galactic-cni, egress shard, galactic-gateway | +| `iad-control-plane` | ext-container | Kind control-plane; runs Cilium, Multus | +| `iad-worker` | ext-container | compute: FRR PE, galactic-router PE, galactic-cni | +| `iad-worker2` | ext-container | edge: FRR PE, galactic-router PE, galactic-cni, egress shard, galactic-gateway | +| `iad-worker3` | ext-container | EVPN route reflector for all three clusters; FRR PE only | +| `tr1`–`tr4` | linux (FRR) | iBGP full mesh, AS 65100 | +| `remote-host` | linux (nginx) | off-fabric host on `tr4`; runs no Galactic component, no BGP; VIP client | Every edge node is tainted (`galactic.datumapis.com/nat=enabled:NoSchedule`) and so is the route reflector (`galactic.datumapis.com/galactic=control:NoSchedule`): no tenant pods land @@ -140,7 +140,7 @@ Compute nodes run no shard: each egresses through its own site's edge shards onl reflector runs neither `galactic-cni` nor a shard — its `galactic=control` label is mutually exclusive with the `galactic=router` value that pulls those in, which is why the reflector needs a worker of its own (see -[docs/node-labels.md](../../docs/node-labels.md)). +[docs/node-labels.md](../../docs/operations/node-labels.md)). veth's native `XDP_TX`/`XDP_REDIRECT` fast path does not deliver a frame to the peer interface's normal receive stack at all unless the peer *also* runs an XDP program, and @@ -211,39 +211,39 @@ node's pre-existing `bgp router-id`, so router-id and loopback are the same valu ### Transit loopbacks -| Node | IPv6 loopback | IPv4 loopback | -|------|-----------------|-------------------| -| tr1 | fc00:0:1::1/128 | 10.255.255.100/32 | -| tr2 | fc00:0:5::1/128 | 10.255.255.101/32 | -| tr3 | fc00:0:6::1/128 | 10.255.255.102/32 | -| tr4 | fc00:0:7::1/128 | 10.255.255.103/32 | +| Node | IPv6 loopback | IPv4 loopback | +| ------ | ----------------- | ------------------- | +| tr1 | fc00:0:1::1/128 | 10.255.255.100/32 | +| tr2 | fc00:0:5::1/128 | 10.255.255.101/32 | +| tr3 | fc00:0:6::1/128 | 10.255.255.102/32 | +| tr4 | fc00:0:7::1/128 | 10.255.255.103/32 | ### Fabric (worker) loopbacks -| Node | Role | IPv6 loopback | IPv4 loopback | -|-------------|---------|-----------------|-----------------| -| iad-worker | compute | fc00:0:4::1/128 | 10.255.255.1/32 | -| dfw-worker | compute | fc00:0:2::1/128 | 10.255.255.2/32 | -| sjc-worker | compute | fc00:0:3::1/128 | 10.255.255.3/32 | -| iad-worker3 | EVPN RR | fc00:0:8::1/128 | 10.255.255.4/32 | -| iad-worker2 | edge | fc00:0:9::1/128 | 10.255.255.5/32 | -| dfw-worker2 | edge | fc00:0:a::1/128 | 10.255.255.6/32 | -| dfw-worker3 | edge | fc00:0:b::1/128 | 10.255.255.7/32 | -| sjc-worker2 | edge | fc00:0:c::1/128 | 10.255.255.8/32 | +| Node | Role | IPv6 loopback | IPv4 loopback | +| ------------- | --------- | ----------------- | ----------------- | +| iad-worker | compute | fc00:0:4::1/128 | 10.255.255.1/32 | +| dfw-worker | compute | fc00:0:2::1/128 | 10.255.255.2/32 | +| sjc-worker | compute | fc00:0:3::1/128 | 10.255.255.3/32 | +| iad-worker3 | EVPN RR | fc00:0:8::1/128 | 10.255.255.4/32 | +| iad-worker2 | edge | fc00:0:9::1/128 | 10.255.255.5/32 | +| dfw-worker2 | edge | fc00:0:a::1/128 | 10.255.255.6/32 | +| dfw-worker3 | edge | fc00:0:b::1/128 | 10.255.255.7/32 | +| sjc-worker2 | edge | fc00:0:c::1/128 | 10.255.255.8/32 | ### TR–TR point-to-point links (numbered) The host octet/hextet is the transit router's own index on both families, so `10.0.13.3` and `2001:db8:0:13::3` are both tr3 on the tr1–tr3 link. -| Link | IPv6 subnet | IPv4 subnet | -|---------|--------------------|--------------| -| tr1–tr2 | 2001:db8:0:12::/64 | 10.0.12.0/24 | -| tr1–tr3 | 2001:db8:0:13::/64 | 10.0.13.0/24 | -| tr1–tr4 | 2001:db8:0:14::/64 | 10.0.14.0/24 | -| tr2–tr3 | 2001:db8:0:23::/64 | 10.0.23.0/24 | -| tr2–tr4 | 2001:db8:0:24::/64 | 10.0.24.0/24 | -| tr3–tr4 | 2001:db8:0:34::/64 | 10.0.34.0/24 | +| Link | IPv6 subnet | IPv4 subnet | +| --------- | -------------------- | -------------- | +| tr1–tr2 | 2001:db8:0:12::/64 | 10.0.12.0/24 | +| tr1–tr3 | 2001:db8:0:13::/64 | 10.0.13.0/24 | +| tr1–tr4 | 2001:db8:0:14::/64 | 10.0.14.0/24 | +| tr2–tr3 | 2001:db8:0:23::/64 | 10.0.23.0/24 | +| tr2–tr4 | 2001:db8:0:24::/64 | 10.0.24.0/24 | +| tr3–tr4 | 2001:db8:0:34::/64 | 10.0.34.0/24 | ### Edge uplinks (numbered, eBGP to the transit) @@ -252,26 +252,26 @@ site (`1x` dfw, `2x` sjc, `3x` iad) and the node within it; the IPv4 third octet exactly. `remote-host` is not a worker and runs no BGP — `tr4` originates its subnets on its behalf. -| Link | IPv6 subnet | TR address | Edge address | IPv4 subnet | TR address | Edge address | -|-------------------------|--------------------|------------------|------------------|--------------|------------|--------------| -| dfw-worker2 – tr1:bond1 | 2001:db8:1:11::/64 | 2001:db8:1:11::1 | 2001:db8:1:11::2 | 10.1.11.0/24 | 10.1.11.1 | 10.1.11.2 | -| dfw-worker3 – tr1:bond2 | 2001:db8:1:12::/64 | 2001:db8:1:12::1 | 2001:db8:1:12::2 | 10.1.12.0/24 | 10.1.12.1 | 10.1.12.2 | -| sjc-worker2 – tr2:bond1 | 2001:db8:1:21::/64 | 2001:db8:1:21::1 | 2001:db8:1:21::2 | 10.1.21.0/24 | 10.1.21.1 | 10.1.21.2 | -| iad-worker2 – tr3:bond1 | 2001:db8:1:32::/64 | 2001:db8:1:32::1 | 2001:db8:1:32::2 | 10.1.32.0/24 | 10.1.32.1 | 10.1.32.2 | -| remote-host – tr4:eth4 | 2001:db8:1:40::/64 | 2001:db8:1:40::1 | 2001:db8:1:40::2 | 11.1.40.0/24 | 11.1.40.1 | 11.1.40.2 | +| Link | IPv6 subnet | TR address | Edge address | IPv4 subnet | TR address | Edge address | +| ------------------------- | -------------------- | ------------------ | ------------------ | -------------- | ------------ | -------------- | +| dfw-worker2 – tr1:bond1 | 2001:db8:1:11::/64 | 2001:db8:1:11::1 | 2001:db8:1:11::2 | 10.1.11.0/24 | 10.1.11.1 | 10.1.11.2 | +| dfw-worker3 – tr1:bond2 | 2001:db8:1:12::/64 | 2001:db8:1:12::1 | 2001:db8:1:12::2 | 10.1.12.0/24 | 10.1.12.1 | 10.1.12.2 | +| sjc-worker2 – tr2:bond1 | 2001:db8:1:21::/64 | 2001:db8:1:21::1 | 2001:db8:1:21::2 | 10.1.21.0/24 | 10.1.21.1 | 10.1.21.2 | +| iad-worker2 – tr3:bond1 | 2001:db8:1:32::/64 | 2001:db8:1:32::1 | 2001:db8:1:32::2 | 10.1.32.0/24 | 10.1.32.1 | 10.1.32.2 | +| remote-host – tr4:eth4 | 2001:db8:1:40::/64 | 2001:db8:1:40::1 | 2001:db8:1:40::2 | 11.1.40.0/24 | 11.1.40.1 | 11.1.40.2 | ### Site-internal links (numbered, iBGP to the site's edge node) Same convention with the edge node in the router's seat: it takes `::1`/`.1`, the worker behind it `::2`/`.2`. -| Link | IPv6 subnet | Edge address | Node address | IPv4 subnet | Edge address | Node address | -|--------------------------------|--------------------|------------------|------------------|--------------|--------------|--------------| -| dfw-worker – dfw-worker2:bond1 | 2001:db8:1:10::/64 | 2001:db8:1:10::1 | 2001:db8:1:10::2 | 10.1.10.0/24 | 10.1.10.1 | 10.1.10.2 | -| dfw-worker – dfw-worker3:bond1 | 2001:db8:1:13::/64 | 2001:db8:1:13::1 | 2001:db8:1:13::2 | 10.1.13.0/24 | 10.1.13.1 | 10.1.13.2 | -| sjc-worker – sjc-worker2:bond1 | 2001:db8:1:20::/64 | 2001:db8:1:20::1 | 2001:db8:1:20::2 | 10.1.20.0/24 | 10.1.20.1 | 10.1.20.2 | -| iad-worker – iad-worker2:bond1 | 2001:db8:1:30::/64 | 2001:db8:1:30::1 | 2001:db8:1:30::2 | 10.1.30.0/24 | 10.1.30.1 | 10.1.30.2 | -| iad-worker3 – iad-worker2:eth3 | 2001:db8:1:31::/64 | 2001:db8:1:31::1 | 2001:db8:1:31::2 | 10.1.31.0/24 | 10.1.31.1 | 10.1.31.2 | +| Link | IPv6 subnet | Edge address | Node address | IPv4 subnet | Edge address | Node address | +| -------------------------------- | -------------------- | ------------------ | ------------------ | -------------- | -------------- | -------------- | +| dfw-worker – dfw-worker2:bond1 | 2001:db8:1:10::/64 | 2001:db8:1:10::1 | 2001:db8:1:10::2 | 10.1.10.0/24 | 10.1.10.1 | 10.1.10.2 | +| dfw-worker – dfw-worker3:bond1 | 2001:db8:1:13::/64 | 2001:db8:1:13::1 | 2001:db8:1:13::2 | 10.1.13.0/24 | 10.1.13.1 | 10.1.13.2 | +| sjc-worker – sjc-worker2:bond1 | 2001:db8:1:20::/64 | 2001:db8:1:20::1 | 2001:db8:1:20::2 | 10.1.20.0/24 | 10.1.20.1 | 10.1.20.2 | +| iad-worker – iad-worker2:bond1 | 2001:db8:1:30::/64 | 2001:db8:1:30::1 | 2001:db8:1:30::2 | 10.1.30.0/24 | 10.1.30.1 | 10.1.30.2 | +| iad-worker3 – iad-worker2:eth3 | 2001:db8:1:31::/64 | 2001:db8:1:31::1 | 2001:db8:1:31::2 | 10.1.31.0/24 | 10.1.31.1 | 10.1.31.2 | ### Cluster SRv6 addressing @@ -299,12 +299,12 @@ node running both tenant delivery and an egress shard needs two Node-IDs, not one. Sharing one would let `galactic-nat`'s XDP program claim that node's own tenant ingress before the TC decap hook ever ran, silently. -| Service | Node-ID range | Identity | -|-------------|-------------------|-----------------------------------------------------------------------------------------------------------------------| -| `0x1` | `0x1000`–`0x1FFF` | Tenant delivery — every node's `BGPRouter` | -| `0x2` | `0x2000`–`0x2FFF` | NAT egress shard (`EgressShard.spec.shardSID`) | -| `0x3` | `0x3000`–`0x3FFF` | Edge gateway (`GALACTIC_GATEWAY_SRV6_ADDRESS`); unused in this lab, whose gateways derive their node's own `0x1` uSID | -| `0x4`–`0xD` | — | Unallocated | +| Service | Node-ID range | Identity | +| ------------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------- | +| `0x1` | `0x1000`–`0x1FFF` | Tenant delivery — every node's `BGPRouter` | +| `0x2` | `0x2000`–`0x2FFF` | NAT egress shard (`EgressShard.spec.shardSID`) | +| `0x3` | `0x3000`–`0x3FFF` | Edge gateway (`GALACTIC_GATEWAY_SRV6_ADDRESS`); unused in this lab, whose gateways derive their node's own `0x1` uSID | +| `0x4`–`0xD` | — | Unallocated | `0x0` is left reserved (it is the one short range, since Node-ID `0x0000` is invalid), and `0xE`–`0xF` are the LIB — Function space, not Node-ID space. See @@ -313,16 +313,16 @@ invalid), and `0xE`–`0xF` are the LIB — Function space, not Node-ID space. S The node index is per site and stable across services: `*-worker` is `001`, `*-worker2` is `002`, `*-worker3` is `003`. -| Node | BGPRouter nodeID | Shard SID | -|-------------|------------------|-----------------------------| -| dfw-worker | 4097 (`0x1001`) | — | -| dfw-worker2 | 4098 (`0x1002`) | `2001:db8:ff01:2002:e001::` | -| dfw-worker3 | 4099 (`0x1003`) | `2001:db8:ff01:2003:e001::` | -| sjc-worker | 4097 (`0x1001`) | — | -| sjc-worker2 | 4098 (`0x1002`) | `2001:db8:ff02:2002:e001::` | -| iad-worker | 4097 (`0x1001`) | — | -| iad-worker2 | 4098 (`0x1002`) | `2001:db8:ff03:2002:e001::` | -| iad-worker3 | 4099 (`0x1003`) | — (route reflector) | +| Node | BGPRouter nodeID | Shard SID | +| ------------- | ------------------ | ----------------------------- | +| dfw-worker | 4097 (`0x1001`) | — | +| dfw-worker2 | 4098 (`0x1002`) | `2001:db8:ff01:2002:e001::` | +| dfw-worker3 | 4099 (`0x1003`) | `2001:db8:ff01:2003:e001::` | +| sjc-worker | 4097 (`0x1001`) | — | +| sjc-worker2 | 4098 (`0x1002`) | `2001:db8:ff02:2002:e001::` | +| iad-worker | 4097 (`0x1001`) | — | +| iad-worker2 | 4098 (`0x1002`) | `2001:db8:ff03:2002:e001::` | +| iad-worker3 | 4099 (`0x1003`) | — (route reflector) | Each edge node therefore holds two identities in its site locator: delivery (`0x1NNN`) and egress shard (`0x2NNN`). Its `frr.conf` @@ -337,11 +337,11 @@ The test VPC `ns10` (see [docs/tenants.md](docs/tenants.md)) gets a host address within its node's block (illustrative only — the exact hextet depends on allocation order; see docs/tenants.md's [SRv6 USID Argument allocation](docs/tenants.md#srv6-usid-argument-allocation)): -| Cluster | Compute node | FRR loopback | Node locator block | USID ns10 | -|---------|--------------|-----------------|-------------------------|---------------------------------| -| dfw | dfw-worker | fc00:0:2::1/128 | 2001:db8:ff01:1001::/64 | 2001:db8:ff01:1001:e001::/128 | -| sjc | sjc-worker | fc00:0:3::1/128 | 2001:db8:ff02:1001::/64 | 2001:db8:ff02:1001:e001::/128 | -| iad | iad-worker | fc00:0:4::1/128 | 2001:db8:ff03:1001::/64 | 2001:db8:ff03:1001:e001::/128 | +| Cluster | Compute node | FRR loopback | Node locator block | USID ns10 | +| --------- | -------------- | ----------------- | ------------------------- | --------------------------------- | +| dfw | dfw-worker | fc00:0:2::1/128 | 2001:db8:ff01:1001::/64 | 2001:db8:ff01:1001:e001::/128 | +| sjc | sjc-worker | fc00:0:3::1/128 | 2001:db8:ff02:1001::/64 | 2001:db8:ff02:1001:e001::/128 | +| iad | iad-worker | fc00:0:4::1/128 | 2001:db8:ff03:1001::/64 | 2001:db8:ff03:1001:e001::/128 | The `galactic-router address` column is no longer set explicitly in the per-cluster Kustomize patches — `galactic-router` auto-detects it from `lo` @@ -350,19 +350,19 @@ FRR loopback address on the same host. ### Management network (fc00:10::/64) -| Node | Address | -|-------------------|--------------| -| dfw-control-plane | fc00:10::102 | -| dfw-worker | fc00:10::103 | -| dfw-worker2 | fc00:10::104 | -| dfw-worker3 | fc00:10::105 | -| iad-control-plane | fc00:10::112 | -| iad-worker | fc00:10::113 | -| iad-worker2 | fc00:10::114 | -| iad-worker3 | fc00:10::115 | -| sjc-control-plane | fc00:10::122 | -| sjc-worker | fc00:10::123 | -| sjc-worker2 | fc00:10::124 | +| Node | Address | +| ------------------- | -------------- | +| dfw-control-plane | fc00:10::102 | +| dfw-worker | fc00:10::103 | +| dfw-worker2 | fc00:10::104 | +| dfw-worker3 | fc00:10::105 | +| iad-control-plane | fc00:10::112 | +| iad-worker | fc00:10::113 | +| iad-worker2 | fc00:10::114 | +| iad-worker3 | fc00:10::115 | +| sjc-control-plane | fc00:10::122 | +| sjc-worker | fc00:10::123 | +| sjc-worker2 | fc00:10::124 | ## Known limitations diff --git a/docs/architecture/README.md b/docs/architecture/README.md index 14e27fa22..834c545bc 100644 --- a/docs/architecture/README.md +++ b/docs/architecture/README.md @@ -10,7 +10,7 @@ NSO owns VPC and attachment lifecycle. Galactic's cell controller handles policy ## Deployment groups -Gateway, NAT and Edge agents have independent opt-in labels on edge nodes. Tenant router and CNI placement is independent of those opt-ins. Fabric routing and diagnostics have their own deployment prerequisites. See [node labels](../node-labels.md) and each component's deployment guide. +Gateway, NAT and Edge agents have independent opt-in labels on edge nodes. Tenant router and CNI placement is independent of those opt-ins. Fabric routing and diagnostics have their own deployment prerequisites. See [node labels](../operations/node-labels.md) and each component's deployment guide. The gateway and NAT share an XDP hook only when configured to use the dispatcher. The router uses the underlay to carry EVPN sessions; it does not establish the underlay's FRR sessions itself. @@ -35,4 +35,4 @@ With a container runtime, use the PlantUML image selected by your development en - [Ingress gateway](../gateway/architecture.md) - [Active/active egress](../nat/active-active.md) - [Fabric routing](../fabric-routing/topology.md) -- [Fabric diagnostics](../agents/ARCHITECTURE-FABRIC-API.md) +- [Fabric diagnostics](../fabric-api/architecture.md) diff --git a/docs/cni/architecture.md b/docs/cni/architecture.md index 9496739c1..16c553a41 100644 --- a/docs/cni/architecture.md +++ b/docs/cni/architecture.md @@ -145,7 +145,7 @@ The [ADD and DEL sequences](cni-cmd-sequence.md) describe attachment; the [GC se - **Tenant egress supports ordered and hashed shard selection.** Ordered mode uses the first resolvable configured shard. Hashed mode publishes immutable Maglev snapshots per translation class and pins tenant addresses to compatible shards. The installer owns membership; CNI ADD and repair register class-specific group routes. Empty classes stay fail-closed and class IDs are not reused until old routes are retired. See [active/active egress](../nat/active-active.md) for the publication protocol, class compatibility, concurrency fences and rollback, and [staging acceptance](../nat/active-active-rollout.md) before enabling it. - **A packet too big for the fabric gets an ICMP error from the datapath, not a silent drop at the uplink.** `usid_egress` calls `send_too_big` after the MSS clamp and before it encapsulates. A packet longer than `encap_mtu_table`'s limit (the uplink MTU less 40, so 1460 at a 1500-byte fabric) is rewritten in place into an ICMPv6 Packet Too Big, or an ICMPv4 Fragmentation Needed for an IPv4 tenant with DF set, and redirected back out the interface it arrived on. The error carries the limit, comes from the attachment's own IPAM gateway (`tenant_gw_table`, keyed by host-side ifindex and written by `galactic-bgp` at ADD, removed by `galactic-veth`/`galactic-tap` at DEL), and quotes the packet's first 68 bytes with NPTv6 undone, so the tenant's path MTU discovery matches it to the socket that sent it. A GSO packet is judged by its segment length. No error is sent for an IPv4 packet without DF, for an ICMP error, past a per-CPU token bucket of 1,000 a second with a burst of 100 (`pmtu_icmp_bucket`), or for an attachment with no gateway in that family; those are dropped and counted as `fib_frag_needed`. Each outcome is counted in `pmtu_stats`, exported as `galactic_usid_pmtu_packets_total{result}`, and the limit as `galactic_usid_pmtu_limit_bytes`. The same `mssclamp.Reconciler` writes `encap_mtu_table` and `mss_clamp_table` from one `GALACTIC_CNI_TCP_MSS_CLAMP` setting, so the two cannot disagree. A pod's or guest's TCP and UDP packets usually arrive `CHECKSUM_PARTIAL`, which no BPF helper can clear, and a device without checksum offload (a tap whose guest did not negotiate it) would finish that checksum into the middle of the error. So the error is laid out with room pushed at the front until the kernel's checksum spot (the original transport header plus 16 for TCP, 6 otherwise) lands on a trailing slot word, with a pad word chosen so the sum the kernel writes there equals what is already there. `usid_pmtu_tap_test.go` checks this against the kernel through a `virtio_net_hdr` tap, with offload on and off. -- **Per-VRF traffic is counted in each direction in its own per-CPU map, not in `vrf_value`.** `vrf_traffic_counters` is a `BPF_MAP_TYPE_PERCPU_HASH` keyed like `vrf_table` (Block<<12|Argument, so one VPC per node) holding packets, tenant bytes and claimed drops for `ingress` and `egress`. Per CPU, because the hot path then increments its own copy with no atomic and no shared cache line; a new map, because changing `vrf_value`'s layout would make `attach.Load` recreate `vrf_table` empty. The datapath only looks rows up: `VRFTable.Register` creates a VRF's row with `BPF_NOEXIST`, so registering again never resets it, `Unregister` removes it, and `Reconcile` ends with `SyncTraffic`, which creates rows for VRFs that predate the map and removes orphans, re-checking `vrf_table` before each delete and again after it, so a VRF registered while it runs keeps its row. `galactic-cni run` also calls `SyncTraffic` once the datapath loads, so an upgraded node counts from its first packet rather than its first 5-minute GC sweep. Every writer of `vrf_table` rows (CNI ADD, the datapath repair, the GC sweep, the ingress sidecar) goes through `VRFTable`, so none needs code of its own. Inbound counts at `usid_ingress`'s two redirects (warm FIB and `bpf_redirect_neigh`). Outbound counts at `usid_egress`'s encapsulating redirect, which covers egress shards, and its VIP reply redirect, and at the service path's redirects, remote ones inside `service_remote_encap` because its caller cannot tell a forwarded packet from a Packet Too Big. Same-node traffic between two attachments never reaches `usid_ingress`: the sender's `usid_egress` matches the receiver's local pass-through entry and hands the packet to the kernel, so that hit counts once in each direction on the shared VPC row, except a destination equal to the sender's own `tenant_gw_table` gateway. Bytes are the tenant packet's own length in both directions, unlike `vrf_value.bytes`, which counts the whole frame at step 6 and stays for `galactic_usid_vrf_bytes_total` and make-before-break checks. Exported as `galactic_usid_vrf_{forwarded_packets,forwarded_bytes,dropped_packets}_total{direction}`; see [docs/metrics.md](../metrics.md#traffic). The gateway check reads the destination from `service_fib_scratch` itself rather than taking a pointer to it: passed a map-value pointer as a subprogram argument, `usid_egress`'s verifier cost went past the kernel's 1M-instruction limit. +- **Per-VRF traffic is counted in each direction in its own per-CPU map, not in `vrf_value`.** `vrf_traffic_counters` is a `BPF_MAP_TYPE_PERCPU_HASH` keyed like `vrf_table` (Block<<12|Argument, so one VPC per node) holding packets, tenant bytes and claimed drops for `ingress` and `egress`. Per CPU, because the hot path then increments its own copy with no atomic and no shared cache line; a new map, because changing `vrf_value`'s layout would make `attach.Load` recreate `vrf_table` empty. The datapath only looks rows up: `VRFTable.Register` creates a VRF's row with `BPF_NOEXIST`, so registering again never resets it, `Unregister` removes it, and `Reconcile` ends with `SyncTraffic`, which creates rows for VRFs that predate the map and removes orphans, re-checking `vrf_table` before each delete and again after it, so a VRF registered while it runs keeps its row. `galactic-cni run` also calls `SyncTraffic` once the datapath loads, so an upgraded node counts from its first packet rather than its first 5-minute GC sweep. Every writer of `vrf_table` rows (CNI ADD, the datapath repair, the GC sweep, the ingress sidecar) goes through `VRFTable`, so none needs code of its own. Inbound counts at `usid_ingress`'s two redirects (warm FIB and `bpf_redirect_neigh`). Outbound counts at `usid_egress`'s encapsulating redirect, which covers egress shards, and its VIP reply redirect, and at the service path's redirects, remote ones inside `service_remote_encap` because its caller cannot tell a forwarded packet from a Packet Too Big. Same-node traffic between two attachments never reaches `usid_ingress`: the sender's `usid_egress` matches the receiver's local pass-through entry and hands the packet to the kernel, so that hit counts once in each direction on the shared VPC row, except a destination equal to the sender's own `tenant_gw_table` gateway. Bytes are the tenant packet's own length in both directions, unlike `vrf_value.bytes`, which counts the whole frame at step 6 and stays for `galactic_usid_vrf_bytes_total` and make-before-break checks. Exported as `galactic_usid_vrf_{forwarded_packets,forwarded_bytes,dropped_packets}_total{direction}`; see [docs/metrics.md](../observability/vpc-dataplane.md#traffic). The gateway check reads the destination from `service_fib_scratch` itself rather than taking a pointer to it: passed a map-value pointer as a subprogram argument, `usid_egress`'s verifier cost went past the kernel's 1M-instruction limit. - **An uplink that drops out of auto-detection keeps `usid_ingress` for 60 seconds.** `attach.Watch` re-resolves the uplink set on every netlink link or route event, and an uplink found only through BGP-learned routes leaves that set whenever FRR withdraws them, which it does for every restart (#778). Detaching on the first miss dropped SRv6 traffic still arriving on that bond for 6 to 14 seconds. An attached interface whose link still exists now keeps its hook, and its place in the published uplink list, until it has been missing for `detachHoldDown`. Watch re-evaluates on its own when the hold-down ends, so an uplink that really stops carrying fabric routes is still detached. A deleted link is dropped at once. - **CRD-driven config, no sidecar gRPC.** `galactic-bgp` writes `BGPVRFInstance`/`BGPAdvertisement` CRDs directly via a bare controller-runtime client; `galactic-router`'s reconciler picks them up. No in-node gRPC calls between any of the CNI-chain binaries and `galactic-router`. - **DEL is intentionally minimal everywhere in the CNI chain; GC reclaims shared state asynchronously.** Every binary's own `cmdDel` only cleans up what it itself created *and* is safe to release immediately per-container: IPAM deallocation via `galactic-ipam`'s own on-disk marker file; guest-netns flush/host-device DEL in `galactic-veth`; and, in both `galactic-veth`/`galactic-tap`, deleting this attachment's own host/guest veth pair or tap device outright, since that interface is private to one attachment and no sibling pod/VM can ever depend on it. None of them delete the VRF, routes, the eBPF `vrf_table` entry, or `BGPAdvertisement`/`BGPVRFInstance` CRDs — those are keyed by `(vpc, vpcAttachment)` or `(vpc, node)` and may be shared/reused by another pod/VM (deleting them in DEL would race with a concurrent ADD during restarts). `galactic-router`'s GC controller (see [ARCHITECTURE-ROUTER.md](../router/architecture.md)) reclaims orphaned CRDs and stale kernel VRFs once no live container still references them; the installer separately sweeps stale eBPF VRF entries — see [docs/cni/gc-cmd-sequence.md](../cni/gc-cmd-sequence.md) for why the host veth/tap interface has no GC path of its own at all. @@ -156,7 +156,7 @@ The [ADD and DEL sequences](cni-cmd-sequence.md) describe attachment; the [GC se --- -- **Interface traffic policy is decided at each egress exit, and is off unless a node turns it on.** `usid_egress` and `usid_service_egress` call `tp_capture` at their top, before any NPTv6 or VIP rewrite, which parses the packet with `bpf_skb_load_bytes` into the per-CPU `tp_scratch`; every exit that hands the packet on then calls `tp_decide` with the forwarding path that exit implies (a shard group sentinel or a route whose SID's locator is in `tp_nat_locator_table` is PublicNAT, the VIP reply redirect PublicService, everything else Private). `tp_decide` walks the interface's snapshot in `tp_binding_table` (a `HASH_OF_MAPS` keyed by ifindex and direction) with `bpf_for_each_map_elem` and counts exactly one outcome. Both return at once while `tp_state.mode` is off, the default, so the datapath forwards as before. Entries carry precomputed masks: a prefix compare that branched on the length cost the verifier about 13,000 instructions. The maps are written through `internal/plumbing/ebpf/tpmap`, whose kernel tests hold the datapath to the Go evaluator in `internal/trafficpolicy`. Toward the workload, `usid_ingress` decides after decapsulation and before any of its three delivery helpers, with the path read from the outer header (a private service tunnel is Private, a gateway slot PublicService, an outer source in `tp_nat_locator_table` PublicNAT), and marks what it sends through the host interface so `tp_deliver`, a new program on every managed interface's tc egress, does not decide it twice; `tp_deliver` decides everything else the host transmits to the interface as Private. While the mode is on, the master plugins leave a new host side down and `galactic-bgp` brings it up only after writing the interface's `tp_iface_table` row with a fresh policy token and reading both hooks' programs back; CNI DEL removes the row, its addresses, fallback counters and bindings; the ingress sidecar's peers are `infra` rows that are never evaluated. See [the design](../enhancements/networking/interface-traffic-policy/README.md). +- **Interface traffic policy is decided at each egress exit, and is off unless a node turns it on.** `usid_egress` and `usid_service_egress` call `tp_capture` at their top, before any NPTv6 or VIP rewrite, which parses the packet with `bpf_skb_load_bytes` into the per-CPU `tp_scratch`; every exit that hands the packet on then calls `tp_decide` with the forwarding path that exit implies (a shard group sentinel or a route whose SID's locator is in `tp_nat_locator_table` is PublicNAT, the VIP reply redirect PublicService, everything else Private). `tp_decide` walks the interface's snapshot in `tp_binding_table` (a `HASH_OF_MAPS` keyed by ifindex and direction) with `bpf_for_each_map_elem` and counts exactly one outcome. Both return at once while `tp_state.mode` is off, the default, so the datapath forwards as before. Entries carry precomputed masks: a prefix compare that branched on the length cost the verifier about 13,000 instructions. The maps are written through `internal/plumbing/ebpf/tpmap`, whose kernel tests hold the datapath to the Go evaluator in `internal/trafficpolicy`. Toward the workload, `usid_ingress` decides after decapsulation and before any of its three delivery helpers, with the path read from the outer header (a private service tunnel is Private, a gateway slot PublicService, an outer source in `tp_nat_locator_table` PublicNAT), and marks what it sends through the host interface so `tp_deliver`, a new program on every managed interface's tc egress, does not decide it twice; `tp_deliver` decides everything else the host transmits to the interface as Private. While the mode is on, the master plugins leave a new host side down and `galactic-bgp` brings it up only after writing the interface's `tp_iface_table` row with a fresh policy token and reading both hooks' programs back; CNI DEL removes the row, its addresses, fallback counters and bindings; the ingress sidecar's peers are `infra` rows that are never evaluated. See [the design](../designs/interface-traffic-policy.md). ## Known Constraints diff --git a/docs/cni/environment-variables.md b/docs/cni/environment-variables.md index 41af398b9..f7ae6def3 100644 --- a/docs/cni/environment-variables.md +++ b/docs/cni/environment-variables.md @@ -294,7 +294,7 @@ host side stays down until `galactic-bgp` has attached and verified every enforcement program, and CNI ADD fails if the kernel failed the traffic policy preflight or the node has no SRv6 locator. Read by `galactic-cni run`, which writes it where the datapath and the CNI plugins read it. See the -[design](../enhancements/networking/interface-traffic-policy/README.md#rollout). +[design](../designs/interface-traffic-policy.md#rollout). **Type:** `off`, `audit` or `enforce` · **Default:** `off` diff --git a/docs/controller/README.md b/docs/controller/README.md index 5e0ca9ac1..ab7bf51ef 100644 --- a/docs/controller/README.md +++ b/docs/controller/README.md @@ -13,7 +13,7 @@ | `galactic-router` | Node BGP and traffic-policy programming and node-owned status | | `galactic-edge` | Node-side Edge attachment programming, fencing and release | -The ownership split above is reflected in `cmd/galactic-controller/main.go` (`SetupCloud`, `Setup`) and `fabric.go`. The [API consolidation migration](../migration/galactic-api-consolidation.md) describes the transition from the previous cloud controller. Do not run two attachment writers during that transition. +The ownership split above is reflected in `cmd/galactic-controller/main.go` (`SetupCloud`, `Setup`) and `fabric.go`. The [API consolidation migration](../operations/migrations/galactic-api-consolidation.md) describes the transition from the previous cloud controller. Do not run two attachment writers during that transition. ## Shared flags @@ -47,7 +47,7 @@ CLI defaults below describe the binary. Deployment overlays may override them; f Admission fails closed. Deploy the webhook with its serving Deployment, and keep its certificates and Service reachable. Neither the controller nor its CRDs are installed by the root `config/` kustomization. -For `--edge`, first install the Edge prerequisites in `config/galactic-edge/` and its node agent on eligible nodes. A deleting attachment is held until the node reports `Released` or the node is removed. See [Edge troubleshooting](../edge/troubleshooting.md) and the [provider contract](../enhancements/networking/galactic-edge/contract.md) for ownership and timing requirements. +For `--edge`, first install the Edge prerequisites in `config/galactic-edge/` and its node agent on eligible nodes. A deleting attachment is held until the node reports `Released` or the node is removed. See [Edge troubleshooting](../edge/troubleshooting.md) and the [provider contract](../edge/provider-contract.md) for ownership and timing requirements. ## Fabric flags @@ -63,7 +63,7 @@ For `--edge`, first install the Edge prerequisites in `config/galactic-edge/` an Use `config/galactic-controller/fabric/` as the deployment base and supply the platform project and both credentials through the environment's overlay. Its default project is empty, so the base is not a complete deployment. Apply `hub-rbac.yaml` to the hub for the hub credential; the local ServiceAccount and lease remain in the deployment's own cluster. -The allocator reads network intent from the hub, requests identities through platform IPAM, and writes NetworkFabricIdentity there for distribution to cells. Keep these central credentials out of cell deployments. Verify identity objects and their propagation before migrating attachment writers, following the [migration sequence](../migration/galactic-api-consolidation.md#cutover-sequence). +The allocator reads network intent from the hub, requests identities through platform IPAM, and writes NetworkFabricIdentity there for distribution to cells. Keep these central credentials out of cell deployments. Verify identity objects and their propagation before migrating attachment writers, following the [migration sequence](../operations/migrations/galactic-api-consolidation.md#cutover-sequence). ## Further reading diff --git a/docs/designs/README.md b/docs/designs/README.md index bcc5a9f51..b54ae44a6 100644 --- a/docs/designs/README.md +++ b/docs/designs/README.md @@ -6,7 +6,7 @@ These documents explain decisions and planned work. Their status describes imple | --------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | | [Interface traffic policy](interface-traffic-policy.md) | Implemented design; rollout remains explicit | [Rollout](../traffic-policy/rollout.md) and [node behavior](../traffic-policy/node.md) | | [Galactic Edge](galactic-edge.md) | Partially implemented and subject to qualification | [Provider contract](../edge/provider-contract.md) and its open items | -| [Private Service Connect](private-service-connect.md) | Partially implemented; qualification gaps remain | [Private-service routes](../router/private-service-routes.md) | +| [Private Service Connect](private-service-connect.md) | Partially implemented; qualification gaps remain | [Private-service routes](../private-services/README.md) | | [Looking Glass backend service](looking-glass-service.md) | Proposed implementation contract; authentication scaffolding does not enable service execution | [Current fabric-api](../fabric-api/README.md) | | [Shared DNS64](dns64/README.md) | Proposed; end-to-end validation outstanding | [NAT configuration](../nat/configuration.md) for implemented translation | | [Latency-aware routing](latency-aware-routing.md) | Exploratory proposal | [Router configuration](../router/configuration.md) for available settings | diff --git a/docs/designs/private-service-connect.md b/docs/designs/private-service-connect.md index 419670de6..377d1d447 100644 --- a/docs/designs/private-service-connect.md +++ b/docs/designs/private-service-connect.md @@ -1,6 +1,6 @@ # Private Service Connect -Status: partially implemented design. Direct endpoint routes, producer selection and opt-in same-family frontend translation exist. Use the [private-service guide](../router/private-service-routes.md) for current behavior. The qualification gaps recorded below remain distinct from implementation availability. +Status: partially implemented design. Direct endpoint routes, producer selection and opt-in same-family frontend translation exist. Use the [private-service guide](../private-services/README.md) for current behavior. The qualification gaps recorded below remain distinct from implementation availability. - [Summary](#summary) - [Motivation](#motivation) @@ -127,7 +127,7 @@ project and propagated object UIDs are separate lifetimes. The networking APIs live in the [network repository](https://github.com/datum-cloud/network/blob/main/api/v1alpha1/serviceroute_types.go). Galactic owns route compilation and packet handling. The -[private-service routing reference](../router/private-service-routes.md) +[private-service routing reference](../private-services/README.md) documents packet handling for this contract. This enhancement defines the resource design; the network repository holds its schemas, and Galactic holds its controller and data-plane implementation. @@ -361,7 +361,7 @@ endpoint's selection contract. Galactic's attachment readiness checks establish network eligibility; they do not substitute for service health. A `Spread` endpoint's producers are probed over TCP by their own node, which publishes each decision in the endpoint's `status.producers`; see -[Private service routes](../router/private-service-routes.md#several-producers-on-one-node). +[Private service routes](../private-services/README.md#several-producers-on-one-node). ### Status and lifecycle diff --git a/docs/gateway/architecture.md b/docs/gateway/architecture.md index 1362ed269..48deced9a 100644 --- a/docs/gateway/architecture.md +++ b/docs/gateway/architecture.md @@ -13,7 +13,7 @@ Use [deployment](deployment.md) to install it, [configuration](configuration.md) | `galactic-cni` | Backend TC-BPF programs and pinned maps used for VIP translation and tenant forwarding | | `galactic-nat` | Independent NAT66/NAT64 egress sessions; shares XDP through the dispatcher when colocated | -The gateway and router run as separate pods. The gateway requires a public uplink and a node locator; it does not require a tenant VRF on the gateway itself. The DaemonSet selects `node=edge` and `gateway=enabled`, and the co-located router is independently selected by `galactic=router`. See [node labels](../node-labels.md). +The gateway and router run as separate pods. The gateway requires a public uplink and a node locator; it does not require a tenant VRF on the gateway itself. The DaemonSet selects `node=edge` and `gateway=enabled`, and the co-located router is independently selected by `galactic=router`. See [node labels](../operations/node-labels.md). ## Control plane @@ -37,7 +37,7 @@ The XDP program answers an oversized encapsulation with the applicable Packet To ## XDP ownership and recovery -The shared dispatcher owns the interface hook. Gateway and NAT use separate slots and leases, so one can stop without detaching the other's program. Direct attachment remains an explicit configuration choice. Attach selection, driver mode and bond-member sequencing follow the [host XDP guide](../xdp-attach-mode.md). +The shared dispatcher owns the interface hook. Gateway and NAT use separate slots and leases, so one can stop without detaching the other's program. Direct attachment remains an explicit configuration choice. Attach selection, driver mode and bond-member sequencing follow the [host XDP guide](../operations/xdp-attach-mode.md). ### Recovery diff --git a/docs/gateway/deployment.md b/docs/gateway/deployment.md index d751e45d3..1502be371 100644 --- a/docs/gateway/deployment.md +++ b/docs/gateway/deployment.md @@ -35,7 +35,7 @@ enabled` (see `config/galactic-gateway/base/daemonset.yaml`'s node affinity, which also excludes `node-role.kubernetes.io/control-plane` nodes outright). It runs there alongside `galactic-vrf`, which `node=edge` also places, so label an edge node `gateway=enabled` to opt it in. Read -[docs/node-labels.md](../node-labels.md) for the full node-labeling +[docs/node-labels.md](../operations/node-labels.md) for the full node-labeling strategy before doing anything else here. A gateway node still needs the same underlay BGP connectivity every other @@ -552,7 +552,7 @@ since a rule's backends can span many VPCAttachments. Confirm the eBPF program is actually attached to the node's public interface. `edgeattach.Attach` requests the host's XDP mode, native unless a -NIC on the host uses `bnxt_en` (see [XDP attach mode](../xdp-attach-mode.md)), +NIC on the host uses `bnxt_en` (see [XDP attach mode](../operations/xdp-attach-mode.md)), so a plain `ip -d link show dev ` on the node itself should show an attached `xdp` program, or `xdpgeneric` on a `bnxt_en` host, if this step succeeded; the pod-level checks above (healthy gRPC health status, nonzero diff --git a/docs/gateway/packet-paths.md b/docs/gateway/packet-paths.md index 1dd1ffa55..bb0e6ed8e 100644 --- a/docs/gateway/packet-paths.md +++ b/docs/gateway/packet-paths.md @@ -298,7 +298,7 @@ datapath runs from its own slot. Attached directly, the programs hold their own empty copies of the dispatcher maps, so every unclaimed packet passes to the kernel. - The dispatcher attaches in the host's XDP mode (`xdpmode`, see - [docs/xdp-attach-mode.md](../xdp-attach-mode.md)): generic on a host with a + [docs/xdp-attach-mode.md](../operations/xdp-attach-mode.md)): generic on a host with a `bnxt_en` NIC (#673), native elsewhere. `Linked` and `Coverage` read the mode back from the kernel, and `EnsureLink` migrates a pinned link left in the other mode, under the dispatch lock and the bond guards, keeping every diff --git a/docs/nat/active-active-rollout.md b/docs/nat/active-active-rollout.md index 913a3728e..41a7bd64c 100644 --- a/docs/nat/active-active-rollout.md +++ b/docs/nat/active-active-rollout.md @@ -15,7 +15,7 @@ are deployed by infra. unserved translation classes and stable group identity. Current source covers these in `TestSweepHashed_EmptyMembershipKeepsRoutesOnGroups`, `internal/plumbing/ebpf/attachreg/group_test.go` and - `TestSweepHashed_ClassListChanges`. The [October 9 review resolution](../feature_reviews/egress-active-active_2026-10-09-resolution.md#re-review-findings) + `TestSweepHashed_ClassListChanges`. The [October 9 review resolution](../archive/reviews/egress-active-active_2026-10-09-resolution.md#re-review-findings) records an intermediate implementation, not the current release's eligibility. Passing these regression tests does not replace the staging checks below. diff --git a/docs/nat/configuration.md b/docs/nat/configuration.md index 013a2d43b..f6c9f0bd7 100644 --- a/docs/nat/configuration.md +++ b/docs/nat/configuration.md @@ -70,7 +70,7 @@ its slaves at startup and the program attached to each of them, never to the master itself, the same way `galactic-gateway` treats a bonded public interface. As with the gateway, the program is attached in the host's XDP mode, generic on a host with a `bnxt_en` NIC and native elsewhere (see -[XDP attach mode](../xdp-attach-mode.md)). In native mode every resolved +[XDP attach mode](../operations/xdp-attach-mode.md)). In native mode every resolved interface is checked for native XDP support before any is touched. In either mode the slaves are attached one at a time, each waited back into its LACP aggregate before the next, so a NIC whose driver drops carrier to attach an diff --git a/docs/nat/deployment.md b/docs/nat/deployment.md index fd5f46da8..5107bb6e3 100644 --- a/docs/nat/deployment.md +++ b/docs/nat/deployment.md @@ -7,7 +7,7 @@ This guide describes the installation order for NAT66/NAT64 shards. Run it first `galactic-nat` runs on every `galactic.datumapis.com/node: edge` node that also carries `galactic.datumapis.com/nat: enabled`, one DaemonSet per cluster, alongside `galactic-vrf` and, on nodes that opt into it, -`galactic-gateway` (see [docs/node-labels.md](../node-labels.md)). An edge +`galactic-gateway` (see [docs/node-labels.md](../operations/node-labels.md)). An edge node without `nat=enabled`, a compute node, an unlabeled node and a control-plane node never run a shard. A shard there is one hop from the transit its masquerade addresses are originated into. Compute nodes run no diff --git a/docs/observability/gateway.md b/docs/observability/gateway.md index 01954e1bf..86666eaf1 100644 --- a/docs/observability/gateway.md +++ b/docs/observability/gateway.md @@ -6,7 +6,7 @@ See [scraping and component ports](README.md#where-the-metrics-come-from) and [s Every gateway node serves every VIP identically (anycast), so the same series appear on each one. Direct server return keeps no per-flow state, so there is no connection table to report. See -[ARCHITECTURE-GATEWAY.md](../agents/ARCHITECTURE-GATEWAY.md). +[ARCHITECTURE-GATEWAY.md](../gateway/architecture.md). | Metric | Type | Labels | Meaning | | ------------------------------------------------------- | ------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------- | diff --git a/docs/router/architecture.md b/docs/router/architecture.md index 28c84dac9..9966f4927 100644 --- a/docs/router/architecture.md +++ b/docs/router/architecture.md @@ -112,7 +112,7 @@ there instead. - **RuntimeFactory pattern.** `galactic-router` always builds a `gobgp.NewRuntimeFactory(...)` at startup — GoBGP is the only backend. A `RuntimeFactory` is a plain function value (`func(types.NamespacedName) (RouterRuntime, error)`), so a future backend still only needs a new factory function and a call-site change here, not a controller change. - **DEL is intentionally minimal everywhere in the CNI chain; GC reclaims shared state asynchronously.** See [ARCHITECTURE-CNI.md](../cni/architecture.md#key-design-decisions) for the CNI-side half of this decision. `galactic-router`'s GC controller (ticker-driven, default every 5m) reclaims orphaned CRDs, stale kernel VRFs, and stale eBPF entries once no live container still references them. A Galactic Edge attachment counts as a reference too: GC keeps the VRF and `BGPVRFInstance` of a VPC an edge attachment uses on the node and deletes them only under that VPC's write fence, shared with `galactic-edge` through the `/var/lib/galactic-edge/ownership` mount (`internal/edge/maintenance`, see [gc-cmd-sequence.md](../cni/gc-cmd-sequence.md)). - **gRPC health, configurable port.** Liveness and readiness probes use the gRPC health protocol (`google.golang.org/grpc/health`) on a configurable port (default `5179`). No HTTP health endpoint. `galactic-gateway` follows the identical convention on its own port — see [ARCHITECTURE-GATEWAY.md](../gateway/architecture.md). -- **A Galactic Edge route is advertised only while its node forwards it.** `galactic-controller` publishes one `BGPAdvertisement` per accepted edge route, labeled `galactic.datumapis.com/edge-route` and naming the holder's host link and address (`internal/edge/route/publish.go`). `BuildDesiredRouter` leaves such an advertisement out unless the node's pinned forwarding gate holds an unexpired gate for exactly its prefix on that link, read on every build (`reconcile.EdgeGate`, `cmd/galactic-router/edgegate.go`), and `edgeGateWatch` polls the gates of this node's edge advertisements every 250 ms to wake the router when one opens or closes, so a gate deadline withdraws the prefix with no API event. Without the pinned gate map the router advertises no edge route; it opens the map again at most every second while it is missing or after a read fails, so a router started before the uSID datapath needs no restart. A route reflector checks no gate and advertises none. A left-out advertisement is reported `Advertised` False with reason `GateClosed`. See the [provider contract](../enhancements/networking/galactic-edge/contract.md#publication). +- **A Galactic Edge route is advertised only while its node forwards it.** `galactic-controller` publishes one `BGPAdvertisement` per accepted edge route, labeled `galactic.datumapis.com/edge-route` and naming the holder's host link and address (`internal/edge/route/publish.go`). `BuildDesiredRouter` leaves such an advertisement out unless the node's pinned forwarding gate holds an unexpired gate for exactly its prefix on that link, read on every build (`reconcile.EdgeGate`, `cmd/galactic-router/edgegate.go`), and `edgeGateWatch` polls the gates of this node's edge advertisements every 250 ms to wake the router when one opens or closes, so a gate deadline withdraws the prefix with no API event. Without the pinned gate map the router advertises no edge route; it opens the map again at most every second while it is missing or after a read fails, so a router started before the uSID datapath needs no restart. A route reflector checks no gate and advertises none. A left-out advertisement is reported `Advertised` False with reason `GateClosed`. See the [provider contract](../edge/provider-contract.md#publication). - **`galactic-router` carries no gateway-role code.** The edge XDP load-balancing gateway used to be a `galactic-router` mode; it was split into its own `galactic-gateway` binary specifically so a crash on either side no longer takes the other down with it — see [ARCHITECTURE-GATEWAY.md](../gateway/architecture.md) for the full rationale and design. - **Peer FSM transitions are logged via a dedicated GoBGP event watcher, not GoBGP's own logger — and also drive real-time BGPPeer Kubernetes Events.** `GALACTIC_ROUTER`'s `LogLevel` config only gates GoBGP's *internal* `slog` logger, whose handler is wired to `io.Discard` regardless of level (`internal/runtime/gobgp/server.go`'s `buildServerOptions`) — so none of GoBGP's own peer state log lines ever reach this process's output. Instead, `internal/runtime/gobgp/peer_monitor.go` runs a shared `BgpServer.WatchEvent(..., WatchPeer())` goroutine (the same one-goroutine-per-runtime pattern `monitor.go`'s `watchEVPNRIB` uses for EVPN best-path) that diffs each peer's FSM state against `lastPeerState` and logs a `slog.Info` line on every real transition, including `disconnectReason`/`disconnectMessage` when a peer drops out of Established. The same transition is also handed to an optional `model.PeerStateObserver` (set via `gobgp.NewRuntimeFactory`'s `observer` parameter): in production this is `internal/controller/peer_events.go`'s `PeerStateEventEmitter`, a `manager.Runnable` that resolves the peer's address to its `BGPPeer` object and raises a `SessionEstablished`/`SessionDown` Kubernetes Event on it — but only for transitions into/out of Established, not every intermediate FSM hop (see the emitter's own doc comments for why). This is independent of, and does not replace, the periodic (`peerStatusRequeue`, 30s) `BGPPeer.Status` update in `internal/controller/bgprouter_controller.go`'s `updatePeerStatuses`: that keeps the CRD's status current on a poll and can miss a transition that reverts between two polls; the `slog` line and the Event are both real-time and don't have that gap. See `docs/plans/router-bgp-peer-session-events.md` for the full design. @@ -120,7 +120,7 @@ there instead. - **A tenant VRF route that fails to install is retried, not dropped.** `processEVPNPath` writes a VRF-scoped path's route into `egress_route_table` through `internal/runtime/gobgp/vrfroutes.go`. `Register` resolves the SID's uplink and neighbor MAC at write time, which fails while an uplink is still coming up after a restart, and BGP never redelivers an unchanged best path, so before #676 such a route stayed missing until the path changed upstream. `vrfRoutes` keeps each failed route in a pending set and retries it whenever the main table changes (1s debounce) and every 30s, until it installs or its path is withdrawn; removing a VRF drops its pending routes. One mutex serializes every write to the map from this runtime, taken per route during a retry so an unresolvable neighbor (up to 2s) does not hold up the RIB watcher for the whole pass. `EgressRouteTable.Refresh` cannot cover this: it walks existing entries only. The pending count, and the plain-route reconciler's failing count, are exported as `galactic_router_route_install_failing{kind="vrf"|"plain"}`, and `GalacticRouterRoutesNotInstalled` fires when either stays above 0 for 10 minutes. - **`ServiceVIPBinding`s are generated, one per node per backend.** `NetworkServiceBindingReconciler` (`internal/controller/networkservice_binding_controller.go`) runs on every node and writes a binding for each VIP of each accepted `NetworkService`, at most one per family (`ruleTranslatedVIPs`) and, for the IPv4 VIP, only while some gateway node's `/IPv4Served` condition reports it loaded (`ipv4LoadedOnSomeNode`; a status change to that signal passes `ruleBindingInputsChanged`, and the node deletes its IPv4 bindings once no gateway does), and each backend the rule's `backendSelector` places on this node, through the same `selectRuleBackends` the gateway uses, so the gateway never sends a backend's flows to a node with no binding planned for it. Workloads are IPv6 only, so both VIPs' backends are the selected attachments' IPv6 addresses: an IPv4 VIP's binding pairs the IPv4 `vipAddress` with an IPv6 `backendAddress`, which the backend node serves by translating the flows (see [ARCHITECTURE-CNI.md](../cni/architecture.md#key-design-decisions)). `ServiceVIPBindingReconciler` refuses an IPv4 `backendAddress` with `BindFailed`. Each node writes and deletes only its own bindings (labelled `galactic.datum.net/binding-node` and `app.kubernetes.io/managed-by: galactic-router`), so there is one writer per object and no leader election. A binding is owned by its rule, records the rule's `vpcRef` (which names the VRF its rows go in) and takes `egressKind` from the attachment's interface mode. `ServiceVIPBindingReconciler` programs a binding only when a `BGPAdvertisement` on this node's `BGPRouter` with that VRF's ID has a prefix containing `backendAddress`, and otherwise reports `BindFailed`; it watches advertisements on its own router so a binding written before its advertisement converges, and teardown skips the check. A backend serves only the oldest rule (by creation time, then namespace/name) selecting it on the same backend port and protocol, since its node translates the backend's replies back to only one VIP; a claim (`backendClaim`) carries the VIP's family, since a reply to an IPv4 client takes the IPv4 VIP's egress-translated row and any other reply the IPv6 VIP's egress row, so one backend socket answers for one VIP of each family, an IPv4 rule never competes with an IPv6 one, and two rules with IPv4 VIPs on one socket do; both sides compute that owner with `ruleBackendOwners` over every rule in the namespace, so a newer rule gets no binding for the backend and no flows for it from the gateway, and every rule in a namespace is re-queued when one of them changes. Rules compete only within a VPC, so the per-VPC `VPCAttachment` fan-out still reaches every rule an attachment change can affect. The node summarizes its bindings on the rule as `/BackendsBound` (`BackendsClaimed` names a backend an older rule serves); a rule whose spec cannot be built into bindings (a second IPv6 VIP, or a selector that does not parse) keeps the node's existing bindings, the same as a rule that loses `Accepted`, so an invalid edit does not drop the backend nodes' `vip_xlat_table` rows; a second IPv4 VIP does the same for the IPv4 family alone, writing no IPv4 binding and keeping the IPv4 ones it had while the IPv6 VIP's bindings stay current, and both report `InvalidRule`. Only the nodes that hold bindings for such a rule report `InvalidRule`, since the gateways already report the error and a condition from every node would be a status write per node per edit. Each rule reconcile lists only its own VPC's attachments, through the VPCAttachment→`status.vpc` field index (`listVPCAttachmentsInVPC`), and skips the cache's deep copy because nothing it does writes to them. Several backends of one VIP can share a node: the gateway writes each backend's slot into the uSID and `usid.c` keys the ingress row on it (#799). - **Each node probes its own backends and publishes their health.** For a `NetworkService` with `spec.healthCheck`, `BackendHealthReconciler` (`internal/controller/backendhealth_controller.go`) runs one TCP probe loop per backend on its node (`internal/healthprobe`), over the backend's host-side interface (the attachment's `status.hostInterface`) from that interface's link-local address, on `healthCheck.port` or the rule's `backendPort`. The link-local source is what lets the SYN-ACK back: `usid_egress` hands a reply to a link-local destination to the kernel before its VIP rewrite (see [ARCHITECTURE-CNI.md](../cni/architecture.md#key-design-decisions)). A decision moves after `unhealthyThreshold` consecutive failures or `healthyThreshold` consecutive successes; a probe that cannot be sent (no interface, no link-local address) counts toward `Unknown`/`ProbeUnavailable`, never toward `Unhealthy`. The decision goes into `status.health` of each of the backend's bindings, with the attachment UID and probed port, by a merge patch of that field alone and only when it changes, so it never races the `Bound` condition. Every binding of one backend shares one loop. A restarted router seeds each loop from the published decision when its attachment UID and port still match, so a restart changes no gateway's table. A rule losing its `healthCheck` clears `status.health` and stops the loops. The design is [docs/gateway/backend-health.md](../gateway/backend-health.md). -- **A `Spread` service endpoint's producers are probed by their own node, and a consumer's route reads a producer set.** `ServiceProducerHealthReconciler` (`internal/controller/serviceproducerhealth_controller.go`) runs one `internal/healthprobe` loop per producer on its node of each `ServiceEndpoint` with `spec.distribution: Spread`, to the producer attachment's first IPv6 address on `healthCheck.port`, and server-side applies that node's entries of the endpoint's `status.producers` under its own field manager (`galactic-router/`), so nodes never overwrite each other's entries and an entry a node stops applying disappears. `ServiceRoutePolicyReconciler` reads them: for a Spread endpoint, `serviceroute.Compile` emits one `LocalSet` intent per consumer holding every producer on the consumer's node, `Unhealthy` ones marked draining unless all are. `EBPFRouteProgrammer` writes it as a mode-3 `service_route_table` row plus a `service_producer_set_table` row under the same key; `usid_egress` pins each TCP flow in `service_flow_table` and picks a producer per UDP datagram (see [docs/router/private-service-routes.md](../router/private-service-routes.md#several-producers-on-one-node)). A changed `LocalSet` intent is applied before the old one is removed, and the programmer keeps the newest of a key's producer sets in the map, so a health or membership change never drops the consumer's route. A datapath without the producer set map gets `serviceroute.ErrProducerSetsUnavailable` for `LocalSet` intents only. +- **A `Spread` service endpoint's producers are probed by their own node, and a consumer's route reads a producer set.** `ServiceProducerHealthReconciler` (`internal/controller/serviceproducerhealth_controller.go`) runs one `internal/healthprobe` loop per producer on its node of each `ServiceEndpoint` with `spec.distribution: Spread`, to the producer attachment's first IPv6 address on `healthCheck.port`, and server-side applies that node's entries of the endpoint's `status.producers` under its own field manager (`galactic-router/`), so nodes never overwrite each other's entries and an entry a node stops applying disappears. `ServiceRoutePolicyReconciler` reads them: for a Spread endpoint, `serviceroute.Compile` emits one `LocalSet` intent per consumer holding every producer on the consumer's node, `Unhealthy` ones marked draining unless all are. `EBPFRouteProgrammer` writes it as a mode-3 `service_route_table` row plus a `service_producer_set_table` row under the same key; `usid_egress` pins each TCP flow in `service_flow_table` and picks a producer per UDP datagram (see [docs/router/private-service-routes.md](../private-services/README.md#several-producers-on-one-node)). A changed `LocalSet` intent is applied before the old one is removed, and the programmer keeps the newest of a key's producer sets in the map, so a health or membership change never drops the consumer's route. A datapath without the producer set map gets `serviceroute.ErrProducerSetsUnavailable` for `LocalSet` intents only. - **Surviving routers clean up after a departed node.** Only a node's own `NetworkServiceBindingReconciler` clears its `/BackendsBound` conditions and deletes its generated bindings, and only its own `ServiceVIPBindingReconciler` removes the teardown finalizer from bindings targeting it. So once a node's `Node` object is deleted, `NodeDepartureReconciler` (`internal/controller/node_departure_controller.go`) on every other router removes that node's `BackendsBound` condition from every `NetworkService`, deletes its generated bindings and removes the finalizer from every binding whose `targetRef.name` names it, hand-written ones included; the kernel rows went with the node. Without it the conditions stayed forever and a deleted rule's bindings stayed `Terminating`. Every Node create and delete maps to one sweep key, so the sweep runs on the initial Node list (startup), on every Node delete and every `--gc-interval`, and a router down during the delete still converges. A node missing from the cached Node list counts as departed only once an uncached `Get` returns NotFound. Every router sweeps, with no leader election: status writes and finalizer patches retry on conflict (the patch carries the resourceVersion) and NotFound counts as done. - **Deleting a `ServiceVIPBinding` does not need its VRF on the node.** A binding's two `vip_xlat_table` rows are keyed on its VRF's uSID Argument. `ServiceVIPBindingReconciler` reads it from the `BGPVRFInstance` its `vpcRef` names on this node, and that is gone once the VPC leaves the node. Before #750, deletion re-derived it, failed, held the finalizer forever and left both rows in the map. Teardown now finds the rows by value with `vipxlatmap.UnregisterBinding`: since #764 each key carries the VIP or backend address, and since #799 the ingress key also carries the backend's slot, so the binding's ingress row (its VIP, port and slot, rewriting to its backend) and egress row (its backend and port, rewriting to its VIP) are found exactly, under any Argument. Each row is removed only while it still holds the binding's values, so a row another binding has since written stays. When the VRF context still resolves, `UnregisterBindingAt` applies the same checks at that location too. Neither pass deletes a row without first reading it, and a process-wide lock keeps a bind from landing between the read and the delete. A value check cannot tell two bindings with identical values apart, so while such a twin is live on the node, deleting one removes nothing. Rows exist only for an IPv6 backend, so an IPv4 or unparseable `backendAddress` skips both passes instead of blocking deletion. Only a failed kernel delete keeps the finalizer. Rows left behind some other way, by a finalizer cleared by hand, a crash or a manual write, are removed by the periodic sweep below; to remove one sooner, use `galactic-router vip xlat list` and `vip xlat remove --protocol --vip --port --backend --backend-port` (`--slot` defaults to the backend's own), run in that node's `galactic-router` pod (`kubectl exec -- /galactic-router vip xlat list`). - **`vip_xlat_table` holds both VIP families in one layout.** The map (`struct vip_xlat_key`, 32 bytes: block, argument, protocol, direction, port, slot, 16-byte address; `struct vip_xlat_value`, 18 bytes: 16-byte address, port) is pinned by `galactic-cni` at `/sys/fs/bpf/galactic/vip_xlat_table` and reused across restarts and upgrades by `attach.Load`; `galactic-router`'s `ServiceVIPBindingReconciler` and the `vip xlat` CLI are its only writers. Its layout is fixed, since CNI ADD and binding time write the rows and a new layout would empty the map until every binding was written again. A binding writes two rows, by its VIP's family (every key also carries block, argument and protocol): diff --git a/docs/router/configuration.md b/docs/router/configuration.md index 26d1665eb..d4171fad0 100644 --- a/docs/router/configuration.md +++ b/docs/router/configuration.md @@ -226,7 +226,7 @@ cluster may not have installed: an informer for a missing CRD never syncs. A route reflector has no tenant interfaces, so `--reflector` with this option is a configuration error. Whether the datapath enforces what this publishes is galactic-cni's setting, not this one. See -[the traffic policy design](../enhancements/networking/interface-traffic-policy/README.md). +[the traffic policy design](../designs/interface-traffic-policy.md). ### `--service-frontend-enabled` / `GALACTIC_ROUTER_SERVICE_FRONTEND_ENABLED` diff --git a/docs/traffic-policy/controller.md b/docs/traffic-policy/controller.md index 567e073a6..2b3115e55 100644 --- a/docs/traffic-policy/controller.md +++ b/docs/traffic-policy/controller.md @@ -4,7 +4,7 @@ side of interface traffic policy. It does not program any node: the per-node datapath state belongs to `galactic-router`, which reads the bindings this controller resolves (see [Traffic policy on the node](node.md)). The design is in -[the traffic policy proposal](../enhancements/networking/interface-traffic-policy/README.md); +[the traffic policy proposal](../designs/interface-traffic-policy.md); the API reference is [docs/api/galactic.md](../api/galactic.md). ## What it does diff --git a/docs/traffic-policy/node.md b/docs/traffic-policy/node.md index ea0e898a4..b7f779fc0 100644 --- a/docs/traffic-policy/node.md +++ b/docs/traffic-policy/node.md @@ -8,7 +8,7 @@ datapath, reports what it applied in the TrafficPolicyBinding's Galactic Edge attachment on its node (see [Edge attachments](#edge-attachments)). The cell side, which validates policies and resolves bindings, is [galactic-controller](controller.md); the design is in -[the traffic policy proposal](../enhancements/networking/interface-traffic-policy/README.md). +[the traffic policy proposal](../designs/interface-traffic-policy.md). ## Enabling it @@ -146,7 +146,7 @@ entry disappears when the attachment leaves the node. galactic-router serves the policy counters on its metrics port (`9179`), which the `galactic-router` PodMonitor already scrapes, as `galactic_cni_traffic_policy_*`: the prefix names the datapath that counts, -not the process that serves them. [docs/metrics.md](../metrics.md#traffic-policy--galactic_cni_traffic_policy_) +not the process that serves them. [docs/metrics.md](../observability/traffic-policy.md#traffic-policy--galactic_cni_traffic_policy_) lists every series, its labels and example queries. Every installed rule has a series from the moment it is published, at zero, diff --git a/docs/traffic-policy/rollout.md b/docs/traffic-policy/rollout.md index 3c8b889d8..577d719bc 100644 --- a/docs/traffic-policy/rollout.md +++ b/docs/traffic-policy/rollout.md @@ -5,7 +5,7 @@ interface forwards only what its bindings grant, in each direction. That is a deliberate behavior change, so turning it on in a cell is a migration. This guide is the order to do it in, what to check at each step, and how to back out. The design is in -[the traffic policy proposal](../enhancements/networking/interface-traffic-policy/README.md); +[the traffic policy proposal](../designs/interface-traffic-policy.md); [controller.md](controller.md) and [node.md](node.md) are the component references. diff --git a/examples/edge-provider/README.md b/examples/edge-provider/README.md index 24ba95b3e..df7a0bbea 100644 --- a/examples/edge-provider/README.md +++ b/examples/edge-provider/README.md @@ -1,7 +1,7 @@ # Reference edge provider A minimal Galactic Edge provider built only on the -[provider contract](../../docs/enhancements/networking/galactic-edge/contract.md): +[provider contract](../../docs/edge/provider-contract.md): the `galactic.datumapis.com/v1alpha1` edge resources, its own ServiceAccount, and the attachment `galactic-edge` programs into its pod. It is a separate Go module that imports only `go.datum.net/galactic/api/v1alpha1`; its module path @@ -41,12 +41,12 @@ beside the provider. ## What the cell needs -| Prerequisite | Why | Who | -| --- | --- | --- | -| `config/galactic-edge` applied, `galactic-controller --role=cell --edge`, and the `galactic-edge` DaemonSet on nodes labeled `galactic.datumapis.com/node=edge` and `galactic.datumapis.com/edge=enabled` | Admission, allocation, programming and the forwarding gate | Operator | -| A device plugin that gives pods `/dev/net/tun` as a resource | Kubernetes gives no unprivileged pod `/dev/net/tun`, and the contract gives a provider no hostPath or capability. Only `PacketAccess` needs it. | Operator | -| A workload of the VPC on the provider's node | An attachment joins the VPC's existing host VRF on its node; only CNI ADD creates that VRF | Tenant or platform | -| An `EdgeService` granting the VPC to the provider | Authorizes the attachment and its prefixes | Platform authority | +| Prerequisite | Why | Who | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | +| `config/galactic-edge` applied, `galactic-controller --role=cell --edge`, and the `galactic-edge` DaemonSet on nodes labeled `galactic.datumapis.com/node=edge` and `galactic.datumapis.com/edge=enabled` | Admission, allocation, programming and the forwarding gate | Operator | +| A device plugin that gives pods `/dev/net/tun` as a resource | Kubernetes gives no unprivileged pod `/dev/net/tun`, and the contract gives a provider no hostPath or capability. Only `PacketAccess` needs it. | Operator | +| A workload of the VPC on the provider's node | An attachment joins the VPC's existing host VRF on its node; only CNI ADD creates that VRF | Tenant or platform | +| An `EdgeService` granting the VPC to the provider | Authorizes the attachment and its prefixes | Platform authority | The containerlab lab's `deploy:galactic-edge` task sets all of this up on dfw; see `deploy/containerlab/resources/galactic-edge/`, including the From 61166b95272842c13951c7857f876ad859279fc7 Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Mon, 26 Oct 2026 08:01:37 -0400 Subject: [PATCH 4/4] docs: Format documentation check configuration --- .crd-ref-docs-network-bgp.yaml | 1 - .crd-ref-docs-network-gateway.yaml | 1 - .github/workflows/docs.yaml | 4 --- Taskfile.yaml | 57 ++++-------------------------- 4 files changed, 7 insertions(+), 56 deletions(-) diff --git a/.crd-ref-docs-network-bgp.yaml b/.crd-ref-docs-network-bgp.yaml index 94bbbf87a..102af97eb 100644 --- a/.crd-ref-docs-network-bgp.yaml +++ b/.crd-ref-docs-network-bgp.yaml @@ -45,7 +45,6 @@ processor: - "NetworkEgressPolicySpec" - "NetworkEgressPolicyStatus" ignoreFields: [] - render: kubernetes: {} markdown: diff --git a/.crd-ref-docs-network-gateway.yaml b/.crd-ref-docs-network-gateway.yaml index e985c4753..e714c3ba3 100644 --- a/.crd-ref-docs-network-gateway.yaml +++ b/.crd-ref-docs-network-gateway.yaml @@ -94,7 +94,6 @@ processor: - "BGPPrefixListSpec" - "BGPPrefixListStatus" ignoreFields: [] - render: kubernetes: {} markdown: diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 2e479ec05..270bfaf40 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -6,20 +6,16 @@ # Produces no deployment artifacts. # --- name: Documentation - on: push: branches: [main] pull_request: workflow_dispatch: - permissions: contents: read - concurrency: group: docs-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true - jobs: # -- documentation # Parse Markdown with CommonMark rules before checking links and anchors. diff --git a/Taskfile.yaml b/Taskfile.yaml index aa0ab2ebb..7481cc32b 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -1,5 +1,4 @@ version: '3' - vars: LOCALBIN: sh: echo "$(pwd)/bin" @@ -14,29 +13,24 @@ vars: YAMLFMT_VERSION: v0.21.0 GO_LICENSES_VERSION: v1.6.0 PROMETHEUS_VERSION: v3.15.0 - tasks: default: silent: true cmds: - task --list - ## ## Development ## - fmt: desc: Format code run: once cmds: - go fmt ./... - vet: desc: Vet code run: once cmds: - GOOS=linux go vet ./... - ci: desc: Run the full CI pipeline cmds: @@ -44,39 +38,33 @@ tasks: - task: build - task: test:unit - task: test:e2e - test: desc: Run all tests cmds: - task: test:unit - task: test:e2e - lint: desc: Lint - deps: [golangci-lint, yamlfmt, yaml-ext, build:ebpf] + deps: [golangci-lint, yamlfmt, yaml-ext, 'build:ebpf'] cmds: - '{{.GOLANGCI_LINT}} run' # examples/edge-provider is its own module, which the root run skips. - cd examples/edge-provider && {{.GOLANGCI_LINT}} run --config ../../.golangci.yaml - '{{.YAMLFMT}} -lint' - lint-fix: desc: Lint and apply fixes - deps: [golangci-lint, yamlfmt, build:ebpf] + deps: [golangci-lint, yamlfmt, 'build:ebpf'] cmds: - '{{.GOLANGCI_LINT}} run --fix' - '{{.YAMLFMT}}' - notice: desc: Regenerate NOTICE file deps: [go-licenses] cmds: - '{{.GO_LICENSES}} report ./... --ignore go.datum.net/galactic --template scripts/licenses/notice.tmpl > NOTICE' - ## ## Build ## - build: desc: Build binaries cmds: @@ -89,21 +77,18 @@ tasks: - task: fmt - task: vet - task: build:binaries - generate:proto: desc: Regenerate api/**/*.pb.go from the .proto files (requires buf, protoc-gen-go, protoc-gen-go-grpc) dir: api cmds: - buf lint - buf generate - build:service-api: desc: Build the Looking Glass service API release asset and its SHA256SUMS in dist/ (requires buf) vars: VERSION: '{{.VERSION | default "dev"}}' cmds: - hack/service-api-bundle.sh "{{.VERSION}}" dist - generate:crd: desc: Regenerate all Galactic API deepcopy code and CRDs (requires controller-gen) cmds: @@ -115,23 +100,19 @@ tasks: - controller-gen crd paths=./api/cloud/v1alpha1/... output:crd:artifacts:config=config/crd - controller-gen object:headerFile=hack/boilerplate.go.txt paths=./api/network/v1alpha1/... - controller-gen crd paths=./api/network/v1alpha1/... output:crd:artifacts:config=config/crd - generate:api-docs: desc: Regenerate Galactic, cloud, BGP and gateway API references cmds: - python3 hack/docs/generate_api.py - docs:check: desc: Check documentation links, anchors and API resource coverage (install hack/docs/requirements.txt first) cmds: - python3 -m unittest discover -s hack/docs -p 'test_*.py' - python3 hack/docs/check.py - docs:check-generated: desc: Check generated API references without changing tracked files cmds: - python3 hack/docs/generate_api.py --check - build:ebpf: desc: Regenerate the eBPF uSID, edge gateway DSR, NAT egress, and XDP dispatcher datapaths (requires clang) run: once @@ -141,7 +122,6 @@ tasks: - go generate ./internal/plumbing/ebpf/edgeprog/... - go generate ./internal/plumbing/ebpf/natprog/... - go generate ./internal/plumbing/ebpf/xdpdispatch/... - require-clang: internal: true run: once @@ -157,7 +137,6 @@ tasks: echo " Debian/Ubuntu: sudo apt install clang llvm" >&2 exit 1 fi - build:binaries: internal: true vars: @@ -172,13 +151,7 @@ tasks: SPDX_LICENSE: AGPL-3.0-or-later GIT_URL: https://github.com/datum-cloud/galactic LDFLAGS: >- - -s -w - -X go.datum.net/galactic/internal/metadata.Version={{.VERSION}} - -X go.datum.net/galactic/internal/metadata.GitCommit={{.GIT_COMMIT}} - -X go.datum.net/galactic/internal/metadata.GitTreeState={{.GIT_TREE_STATE}} - -X go.datum.net/galactic/internal/metadata.BuildDate={{.BUILD_DATE}} - -X go.datum.net/galactic/internal/metadata.SPDXLicense={{.SPDX_LICENSE}} - -X go.datum.net/galactic/internal/metadata.GitURL={{.GIT_URL}} + -s -w -X go.datum.net/galactic/internal/metadata.Version={{.VERSION}} -X go.datum.net/galactic/internal/metadata.GitCommit={{.GIT_COMMIT}} -X go.datum.net/galactic/internal/metadata.GitTreeState={{.GIT_TREE_STATE}} -X go.datum.net/galactic/internal/metadata.BuildDate={{.BUILD_DATE}} -X go.datum.net/galactic/internal/metadata.SPDXLicense={{.SPDX_LICENSE}} -X go.datum.net/galactic/internal/metadata.GitURL={{.GIT_URL}} cmds: - go build -ldflags "{{.LDFLAGS}}" -o bin/galactic-cni ./cmd/galactic-cni - go build -ldflags "{{.LDFLAGS}}" -o bin/galactic-veth ./cmd/galactic-veth @@ -195,18 +168,15 @@ tasks: - go build -ldflags "{{.LDFLAGS}}" -o bin/galactic-controller ./cmd/galactic-controller - go build -ldflags "{{.LDFLAGS}}" -o bin/galactic-usid ./cmd/galactic-usid - GOBIN={{.LOCALBIN}} go install github.com/containernetworking/plugins/plugins/main/host-device@v1.9.1 - ## ## CI ## - test:unit: desc: Unit tests with race detection and coverage - deps: [build:ebpf] + deps: ['build:ebpf'] cmds: - bash scripts/ci.sh unittest - task: test:edge-provider - test:edge-provider: desc: Build, vet and unit-test the reference edge provider (examples/edge-provider, its own module) dir: examples/edge-provider @@ -214,13 +184,11 @@ tasks: - go build ./... - go vet ./... - go test -race ./... - test:unit-root: desc: Re-run just the requireRoot(t)-gated unit tests, as root - deps: [build:ebpf] + deps: ['build:ebpf'] cmds: - bash scripts/ci.sh unittest-root - test:fabric-api-load: desc: Measure fabric-api queries against FRR with full Internet tables (MRT=, needs Docker) # The release gate for enabling AS-path and community searches: bgpd @@ -235,7 +203,6 @@ tasks: - mkdir -p {{.GOBGP_BIN}} - CGO_ENABLED=0 GOBIN={{.GOBGP_BIN}} go install github.com/osrg/gobgp/v4/cmd/gobgpd@v4.10.0 github.com/osrg/gobgp/v4/cmd/gobgp@v4.10.0 - go run ./hack/fabric-api-loadtest --mrt {{.MRT}} --gobgp-bin {{.GOBGP_BIN}} {{.CLI_ARGS}} - test:alerts: desc: Unit-test the alert rules in config/monitoring/ with promtool # promtool reads plain rule files, so the PrometheusRule's spec is @@ -249,7 +216,6 @@ tasks: - cp config/monitoring/tests/rules-test.yaml {{.ALERTS_DIR}}/ - docker run --rm -v {{.ALERTS_DIR}}:/t -w /t --entrypoint promtool prom/prometheus:{{.PROMETHEUS_VERSION}} check rules rules.yaml - docker run --rm -v {{.ALERTS_DIR}}:/t -w /t --entrypoint promtool prom/prometheus:{{.PROMETHEUS_VERSION}} test rules rules-test.yaml - test:fabric-parity: desc: Compile every fabric frr.conf back through the typed API and diff it with the pinned FRR's frr-reload # Needs Docker, so it is not part of ci. The synthetic fixtures always @@ -257,31 +223,26 @@ tasks: # fabric-router configs to check real routers too. cmds: - go test -count=1 -tags frr -run 'TestImportCompileParity' ./internal/fabric/routing/ - test:e2e: desc: E2E tests (Kind cluster, build+load image, lifecycle) # build:ebpf here is only for the host-side `go test ./tests/e2e/...` # compile in scripts/ci.sh -- the galactic-cni image built inside # ci.sh's docker build regenerates its own copy via the Dockerfile. - deps: [build:ebpf] + deps: ['build:ebpf'] cmds: - bash scripts/ci.sh e2etest - ## ## Cleanup ## - clean: desc: Remove build artifacts cmds: - rm -rf bin/ - rm -rf dist/ - rm -f cover.out - ## ## Dependencies ## - golangci-lint: desc: Download golangci-lint if needed run: once @@ -291,7 +252,6 @@ tasks: TARGET: '{{.GOLANGCI_LINT}}' PACKAGE: github.com/golangci/golangci-lint/v2/cmd/golangci-lint VERSION: '{{.GOLANGCI_LINT_VERSION}}' - yamlfmt: desc: Download yamlfmt if needed run: once @@ -301,7 +261,6 @@ tasks: TARGET: '{{.YAMLFMT}}' PACKAGE: github.com/google/yamlfmt/cmd/yamlfmt VERSION: '{{.YAMLFMT_VERSION}}' - yaml-ext: desc: Enforce .yaml extension (no .yml) run: once @@ -312,7 +271,6 @@ tasks: echo "ERROR: .yml files found; rename to .yaml" exit 1 fi - go-licenses: internal: true run: once @@ -322,12 +280,11 @@ tasks: TARGET: '{{.GO_LICENSES}}' PACKAGE: github.com/google/go-licenses VERSION: '{{.GO_LICENSES_VERSION}}' - install-tool: internal: true cmds: - mkdir -p {{.LOCALBIN}} - - | + - |- if [ ! -f "{{.TARGET}}-{{.VERSION}}" ]; then echo "Downloading {{.PACKAGE}}@{{.VERSION}}" rm -f "{{.TARGET}}" || true