feat(gateway): Add gateway control-plane engine - #350
Conversation
Adds internal/gateway, the reconciliation engine that diffs desired vs. active rule state and drives a Datapath implementation (the KernelDatapath added here wraps the previous branch's edgemap.RuleTable and edgeprog XDP program): - engine.go/diff.go: Engine.Reconcile/ReconcileOrphans, desired-vs-active rule-key diffing. - kerneldatapath.go: Datapath backed by the real eBPF rule_table. - localpref.go/placement.go: primary/secondary BGP local-pref and backend placement helpers. - quota.go: per-VPC rule/backend quota enforcement. - telemetry.go/recovery.go: Prometheus telemetry and crash-recovery (datapath generation cutoff) support. - types.go: DesiredRule/DesiredBackend and friends -- deliberately its own types, not go.datum.net/network's CRD types, so this package has no CRD dependency at all. Second branch in the edge-gateway stack; builds on feat/edge-gateway-01-ebpf-datapath.
f810d87 to
f0f9d98
Compare
c76f86a to
8af1be5
Compare
ecv
left a comment
There was a problem hiding this comment.
these comments should all be struck, and replaced with a design document and verbose commit messages. retrain ur claudes
ecv
left a comment
There was a problem hiding this comment.
Approving. This is the only branch in the stack with green CI, and the engine reads clean: the mutex discipline is consistent, Reconcile converges rather than diffing field by field, and the crash-recovery generation ordering is right.
Four things found, all on failure paths, none blocking. Filed as #359 with the line references.
The one that matters: a rule that passes the quota check and then fails to program holds its reservation forever, because it never enters the active set and so never reaches the release path. cmd/galactic-gateway wires the real enforcer, not the noop, so the counters drift on a node that still has room.
The other three are smaller. Teardown skips the release on a datapath failure, which self-heals on retry. Stop deletes a rule from the active set on every teardown failure after the first. And a partial register leaves untracked entries in the rule table, which orphan recovery does eventually sweep.
The tests cover the happy paths and quota denial, but nothing asserts quota or active-set state after a failure, which is why none of these show up.
Separately, the comment volume here is tracked in #357 rather than as review comments.
Summary
The eBPF datapath from the previous PR needs a control-plane layer that decides what belongs in the rule table and keeps it converged as backends and quotas change. This adds that engine: desired-vs-active rule diffing, a kernel-backed datapath implementation, primary/secondary local-pref and placement logic, per-VPC quota enforcement, and telemetry. It defines its own types rather than reusing the CRD API, so this package has no Kubernetes dependency at all. Second branch in the edge-gateway stack; builds on the eBPF datapath PR.
Test plan
task test:unit)task lintandtask buildare cleanRelated to #17