Skip to content

feat(gateway): Add gateway control-plane engine - #350

Merged
privateip merged 1 commit into
mainfrom
feat/edge-gateway-02-engine
Aug 12, 2026
Merged

feat(gateway): Add gateway control-plane engine#350
privateip merged 1 commit into
mainfrom
feat/edge-gateway-02-engine

Conversation

@privateip

Copy link
Copy Markdown
Contributor

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

  • Unit tests pass for the engine package (task test:unit)
  • task lint and task build are clean

Related to #17

@privateip
privateip requested a review from a team as a code owner August 12, 2026 18:09
@privateip
privateip requested review from AriaEdo and removed request for a team August 12, 2026 18:09
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.
@privateip
privateip force-pushed the feat/edge-gateway-02-engine branch from f810d87 to f0f9d98 Compare August 12, 2026 18:26
@privateip
privateip force-pushed the feat/edge-gateway-01-ebpf-datapath branch from c76f86a to 8af1be5 Compare August 12, 2026 18:26
ecv
ecv previously approved these changes Aug 12, 2026

@ecv ecv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these comments should all be struck, and replaced with a design document and verbose commit messages. retrain ur claudes

Base automatically changed from feat/edge-gateway-01-ebpf-datapath to main August 12, 2026 18:49
@privateip
privateip dismissed ecv’s stale review August 12, 2026 18:49

The base branch was changed.

@privateip
privateip enabled auto-merge August 12, 2026 18:50
@privateip
privateip requested a review from ecv August 12, 2026 18:53

@ecv ecv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@privateip
privateip merged commit df2f8cf into main Aug 12, 2026
15 checks passed
@privateip
privateip deleted the feat/edge-gateway-02-engine branch August 12, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants