-
Notifications
You must be signed in to change notification settings - Fork 31
Repo structure to host proposals, apis #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,38 @@ | ||||||
| # API design | ||||||
|
|
||||||
| This document describes the design of the project’s custom APIs and how they fit with the Gateway API. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ## Overview | ||||||
|
|
||||||
| The project extends the [Kubernetes Gateway API](https://gateway-api.sigs.k8s.io/) with two main custom resources: | ||||||
|
|
||||||
| - **XBackend** — describes a backend (e.g. an MCP server) that HTTPRoutes can reference via BackendRef. | ||||||
| - **XAccessPolicy** — describes who can access what: it targets one or more XBackends and defines rules (sources and authorization) that the data plane enforces. | ||||||
|
|
||||||
| Type definitions and generated code live under [`api/`](../../api/) and [`k8s/`](../../k8s/). For a short “what lives where” guide, see [repo_structure.md](repo_structure.md). | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Recommend removing this |
||||||
|
|
||||||
| ## XBackend | ||||||
|
|
||||||
| An **XBackend** represents a backend that agents or tools call into—for example, an MCP server. It is namespaced and is referenced by HTTPRoute `BackendRef`s (and by XAccessPolicy targetRefs). The controller and translator use XBackends to configure the data plane (e.g. clusters, RBAC) so that traffic to that backend is correctly routed and authorized. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Recommend leaving out any implementation details here and just focusing on what the API does
Suggested change
|
||||||
|
|
||||||
| Key design points: | ||||||
|
|
||||||
| - One XBackend per logical backend (e.g. one MCP server). | ||||||
| - Backend identity can be specified by Kubernetes Service name (in-cluster) or by hostname (external). | ||||||
| - The data plane uses XBackend to know where to send traffic and how to secure it (e.g. mTLS, path). | ||||||
|
Comment on lines
+18
to
+22
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These details feel like they could become stale pretty quickly, recommend omitting. |
||||||
|
|
||||||
| ## XAccessPolicy | ||||||
|
|
||||||
| An **XAccessPolicy** is an authorization policy: it defines *who* can access *what* for the backends it targets. It targets XBackends via `targetRefs` and contains rules that describe allowed (or denied) sources and optional authorization (e.g. which tools or methods). The translator turns XAccessPolicy into data-plane configuration (e.g. Envoy RBAC) so that only allowed callers can reach the targeted backends. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| Key design points: | ||||||
|
|
||||||
| - Targets one or more XBackends via `targetRefs`. | ||||||
| - Rules combine a source (e.g. service account, namespace) with optional authorization (e.g. allowed tools/methods). | ||||||
| - If no XAccessPolicy targets an XBackend, the data plane does not enforce RBAC for that backend (allow-all behaviour). If at least one XAccessPolicy targets it, the translated rules are enforced. | ||||||
|
Comment on lines
+28
to
+32
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These details could become stale pretty quickly, recommend omitting. |
||||||
|
|
||||||
| ## Relationship to Gateway API | ||||||
|
|
||||||
| The project is built on top of the Gateway API and works with Gateway resources (Gateway, GatewayClass, and route types such as HTTPRoute; GRPCRoute may be supported later). Route resources can reference XBackends via BackendRef. **XBackend** and **XAccessPolicy** are custom resources that work with these Gateway resources and the data plane: BackendRef → XBackend, and XAccessPolicy → RBAC (or equivalent) for those backends. | ||||||
|
|
||||||
| Proposals that introduce or change these APIs are under [docs/proposals/](../proposals/). | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # Repository structure | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While I see the value in a doc like this, unfortunately I think it would go stale very quickly, especially with such a relatively young project. Mind leaving this out of this PR? |
||
|
|
||
| This document describes where to find and where to add proposals, APIs, documentation, and code in this repo. | ||
|
|
||
| ## Top-level layout | ||
|
|
||
| ``` | ||
| ├── api/ # API type definitions (Go structs) | ||
| ├── cmd/ # Application entrypoints (e.g. controller main) | ||
| ├── docs/ # Design docs, proposals, and repo documentation | ||
| ├── hack/ # Build, codegen, and CI helpers | ||
| ├── k8s/ # Generated clients, CRDs, and deploy manifests | ||
| ├── pkg/ # Go packages (controller, translator, infra, etc.) | ||
| ├── quickstart/ # Quickstart examples (agents, MCP server, policy) | ||
| ├── site-src/ # MkDocs source for the published docs site | ||
| └── tests/ # Tests (CEL, CRD validation, examples) | ||
| ``` | ||
|
|
||
| ## Proposals | ||
|
|
||
| **Location:** [`docs/proposals/`](../proposals/) | ||
|
|
||
| Design proposals and enhancement docs live here. Each proposal is a markdown file. | ||
|
|
||
| - **Naming:** `NNNN-short-title.md` (e.g. `0008-ToolAuthAPI.md`). Use the 4-digit PR number once the PR exists; use a placeholder like `XXXX-my-proposal` during development. | ||
| - **Index and practices:** See [docs/design/proposals.md](proposals.md). | ||
|
|
||
| ## APIs | ||
|
|
||
| **Type definitions:** [`api/`](../../api/) (Go) | ||
|
|
||
| - `api/v0alpha0/` — Current API version (e.g. `backend_types.go`, `accesspolicy_types.go`). Run `make generate` after editing. | ||
|
|
||
| **CRDs (manifests):** [`k8s/crds/`](../../k8s/crds/) | ||
|
|
||
| - Installed YAML for XBackend, XAccessPolicy, etc. Generated from `api/`. | ||
|
|
||
| **Generated clients:** [`k8s/client/`](../../k8s/client/) | ||
|
|
||
| - Clientsets, listers, informers for the API types. Regenerated via project Makefile/codegen. | ||
|
|
||
| For an overview of the APIs and design, see [api.md](api.md). | ||
|
|
||
| ## Documentation | ||
|
|
||
| - **Design docs (this folder):** [`docs/design/`](.) — API design, repo structure, control plane, data plane. | ||
| - **Repo docs (proposals, api):** [`docs/`](../) — Markdown in the repo; good for GitHub browsing and linking from the docs site. | ||
| - **Published docs site:** [`site-src/`](../../site-src/) — MkDocs source; built output goes to `site/`. Add user-facing pages, guides, and links to proposals/APIs here. Config: [`mkdocs.yml`](../../mkdocs.yml). | ||
|
|
||
| ## Code | ||
|
|
||
| - **Controller and business logic:** [`pkg/controller/`](../../pkg/controller/), [`pkg/translator/`](../../pkg/translator/) | ||
| - **Infrastructure (xDS, Envoy, pod certificate signer):** [`pkg/infra/`](../../pkg/infra/) | ||
| - **Constants and shared config:** [`pkg/constants/`](../../pkg/constants/) | ||
| - **Entrypoint:** [`cmd/`](../../cmd/) | ||
|
|
||
| ## Quickstart and examples | ||
|
|
||
| - **Quickstart:** [`quickstart/`](../../quickstart/) — ADK agent, MCP server, and policy examples (e.g. `quickstart/policy/e2e.yaml`). | ||
| - **CRD examples (valid/invalid):** [`tests/crd/examples/`](../../tests/crd/examples/) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,24 @@ | ||
| # Proposals Best Practices | ||
| # Proposals | ||
|
|
||
| Design proposals and enhancement documents for Kubernetes Agentic Networking. | ||
|
|
||
| ## Index | ||
|
|
||
| | Proposal | Description | | ||
| |----------|-------------| | ||
| | [0008-ToolAuthAPI.md](0008-ToolAuthAPI.md) | Tool Authorization API | | ||
| | [0017-DynamicAuth.md](0017-DynamicAuth.md) | Dynamic Auth | | ||
| | [0059-AccessPolicyTargetRefs.md](0059-AccessPolicyTargetRefs.md) | AccessPolicy TargetRefs | | ||
|
Comment on lines
+7
to
+11
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is very useful to have, but again very worried about it going stale. Maybe we could autogenerate the list here? For example, Gateway API autogenerates this list for GEPs, but it does admittedly rely on a GEP metadata file. We could potentially copy most of this over, but that may be better for a standalone PR since it could get quite large: https://github.com/kubernetes-sigs/gateway-api/blob/main/tools/geps/main.go. |
||
|
|
||
| ## Naming | ||
| The directory of the proposal should lead with a 4-digit PR number (will move to 5,6,... should our PR count get that high), followed by kebab-cased title. The PR number is not known until the PR is cut, so development can use a placeholder, ex. XXXX-my-proposal. PR number is used b/c it is unique & chronological, allowing the default ordering of proposals to follow the timeline of development. | ||
|
|
||
| - Use a **4-digit number** (PR number when available) followed by a **kebab-cased title**: `NNNN-short-title.md`. | ||
| - Examples: `0008-ToolAuthAPI.md`, `0059-AccessPolicyTargetRefs.md`. | ||
| - While developing, you can use a placeholder (e.g. `XXXX-my-proposal.md`) and rename to the PR number when the PR is opened. | ||
| - The number gives a chronological order to proposals. | ||
|
|
||
| ## Adding a new proposal | ||
|
|
||
| 1. Create a new markdown file under `docs/proposals/` with the naming above. | ||
| 2. Include: context, goals, design (API changes, behavior), and alternatives considered. | ||
| 3. Add the new proposal to the **Index** table in this README. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intended to be part of the website? If so, I'd recommend putting it in the site-src directory