You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repository contains the Go control plane for Nantian Gateway. It watches Kubernetes Gateway API resources, translates them into internal routing state, serves admin APIs, and publishes runtime snapshots to data planes over gRPC/xDS.
6
+
7
+
Do not use this repository for Rust data plane, Dashboard, Helm chart, Website, or Proto source-of-truth changes. Those live in sibling repositories.
8
+
9
+
## Git Workflow
10
+
11
+
The workspace root is not a Git repository. This component directory is its own Git repository.
12
+
13
+
Make changes in an isolated worktree under `~/.config/superpowers/worktrees/`, not directly in the checked-out `gateway/` main checkout. Do not merge a worktree branch back to `main` until the user explicitly approves. Do not push `main` until the user explicitly asks after merge approval.
14
+
15
+
Root `docs/` files are workspace notes and do not need to be committed with gateway changes unless the user explicitly asks for archival handling.
16
+
17
+
## Commands
18
+
19
+
Run commands from the gateway repository root.
20
+
21
+
-`make build` builds all Go packages.
22
+
-`make test` runs `go test -count=1 -timeout 5m ./...`.
23
+
-`go test ./internal/translator` runs focused translator tests.
24
+
-`go test ./internal/controller` runs focused controller tests.
25
+
-`go test ./internal/admin` runs focused admin API tests.
26
+
-`make e2e-smoke` runs the Kind smoke test.
27
+
-`make conformance` creates a Kind cluster and runs Gateway API conformance tests.
28
+
- No local protobuf generation target is currently defined here; protobuf source and generation workflow live in the sibling Proto repository.
29
+
30
+
Use focused `go test ./path` checks while iterating, then run the broader relevant target before committing.
31
+
32
+
## Project Map
33
+
34
+
-`cmd/manager/` starts the controller manager and wires runtime services.
35
+
-`internal/controller/` watches Kubernetes resources and coordinates full or partial rebuilds.
36
+
-`internal/translator/` converts Gateway API resources, policies, services, workloads, and extension objects into internal IR snapshots.
37
+
-`internal/grpcserver/` publishes snapshots and status over gRPC/xDS to data planes.
38
+
-`internal/admin/` serves operational, topology, metrics, and management APIs for the Dashboard and operators.
39
+
-`internal/gatewayapi/` contains Gateway API helper logic, validation, encoding, and supported feature declarations.
40
+
-`internal/ir/` defines the internal routing and runtime model shared by translator and gRPC publication code.
41
+
-`deploy/` contains Kubernetes manifests and overlays.
42
+
-`gen/` contains generated protobuf code.
43
+
44
+
## Generated Code
45
+
46
+
Do not edit generated files under `gen/` by hand. Change the source `.proto` definitions in the sibling Proto repository and bring generated output into this repository only when the source change and generation command are clear.
47
+
48
+
## Translator Maintenance
49
+
50
+
The translator package is the highest-risk package in this repository. When changing it:
51
+
52
+
- Preserve Gateway API semantics for parent refs, route attachment, listener validity, backend refs, filters, and status conditions.
53
+
- Preserve ReferenceGrant and namespace scoping rules for cross-namespace references.
- Prefer shared indexes and support-object loaders over ad hoc list scans.
56
+
- Keep full rebuild and partial rebuild behavior aligned.
57
+
- Add or update focused tests for route semantics, backend policy precedence, ReferenceGrant behavior, status summaries, partial rebuild paths, and IR shape changes.
58
+
59
+
## Documentation And Comments
60
+
61
+
Use English by default for documentation and code comments. Add localized text only when editing existing localized user-facing content.
62
+
63
+
## Acceptance
64
+
65
+
Every change needs a spec, plan, and strict acceptance criteria. Record exact verification commands and results before marking work complete.
66
+
67
+
For documentation-only changes in this repository, run at least:
68
+
69
+
-`go test ./internal/translator` when touching translator documentation.
70
+
-`make test` unless the plan explicitly scopes a smaller command and records why.
71
+
- A local README link/path check when rewriting `README.md`.
72
+
-`git diff --check origin/main...HEAD`.
73
+
74
+
For behavior changes, add focused tests first and then run all affected package checks.
Nantian Gateway is a Kubernetes Gateway API implementation with a Go control plane and a Rust data plane. This repository contains the control plane: it watches Gateway API resources, translates them into internal routing state, serves operational and admin APIs, and publishes runtime snapshots to data planes over gRPC/xDS.
19
19
20
-
Nantian Gateway is a [Kubernetes Gateway API](https://gateway-api.sigs.k8s.io/) implementation that handles ingress traffic, API routing, and AI gateway features — all using standard Kubernetes resources. No custom CRDs for routing. No proprietary config language. Just Gateway API.
20
+
Use Nantian Gateway when you want standard Kubernetes Gateway API resources for ingress traffic, API routing, and AI gateway workloads without inventing a custom routing CRD or proprietary configuration language.
21
21
22
-
**If you've used nginx ingress or Envoy Gateway** — Nantian Gateway does the same job, but with a Go control plane and a Rust data plane, targeting full Gateway API v1.5.1 conformance with 55 supported features.
23
-
24
-
### Why Nantian Gateway?
25
-
26
-
| Problem | Nantian Gateway's answer |
27
-
|---|---|
28
-
|**Vendor lock-in**| Standard Gateway API — switch implementations without changing route definitions |
29
-
|**Complex AI routing**| Built-in AI Gateway: multi-provider proxy, API keys, rate limiting, PII masking |
30
-
|**Observability gaps**| Prometheus metrics, Grafana dashboards, and admin APIs out of the box |
31
-
|**Performance at scale**| Rust data plane with xDS push — sub-millisecond config propagation |
32
-
|**Custom logic**| Wasm plugin system for request/response hooks without rebuilding |
HTTP, gRPC, TCP, UDP, TLS, AI gateway, and Wasm runtime traffic handling
36
+
|
37
+
v
38
+
Backends and AI providers
54
39
```
55
40
56
-
## Quick Start
41
+
The control plane is designed to stay Kubernetes-native. Gateway API resources remain the source of truth. The Rust data plane consumes the translated runtime model and handles live traffic. Optional sibling projects provide the Helm chart, Dashboard, Website, and shared Proto contract.
The smoke test creates a local cluster, installs required resources, deploys the gateway stack, and verifies a basic route path. For Gateway API conformance testing, run:
150
81
151
-
### Wasm Plugin System
82
+
```bash
83
+
make conformance
84
+
```
152
85
153
-
Extend the data plane with custom logic without rebuilding or restarting:
86
+
Both commands require local Kubernetes tooling such as Kind, kubectl, and kustomize.
154
87
155
-
- **Request/response hooks** — modify headers, bodies, or status codes
- **Write in any language** — compile to Wasm from Rust, Go, C, or JavaScript
88
+
## Gateway API Support
158
89
159
-
→ [Wasm plugin documentation](docs/design/wasm/)
90
+
Nantian Gateway targets Gateway API v1.5.1. Use the conformance package and supported-feature declarations as the local source of truth for exact support status:
160
91
161
-
### Observability
92
+
-[Conformance tests](conformance/)
93
+
-[Gateway API support tool](cmd/gateway-api-support/)
Nantian Gateway is under active development. It has a working control plane, data plane, admin interfaces, Kind smoke tests, conformance workflows, and production deployment overlays. It is not yet an officially recognized Gateway API implementation.
152
+
Nantian Gateway is under active development. It has a working control plane, data plane integration, admin APIs, Kind smoke tests, conformance workflows, and production deployment overlays. It is not yet an officially recognized Gateway API implementation.
0 commit comments