Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Docs
on:
push:
branches: [main]
paths: ['docs/**', 'examples/**', 'scripts/check-links.sh', 'scripts/check-render-determinism.sh', '.github/workflows/docs.yml']
paths: ['docs/**', 'examples/**', 'versions.env', 'scripts/check-links.sh', 'scripts/check-render-determinism.sh', '.github/workflows/docs.yml']
pull_request:
paths: ['docs/**', 'examples/**', 'scripts/check-links.sh', 'scripts/check-render-determinism.sh', '.github/workflows/docs.yml']
paths: ['docs/**', 'examples/**', 'versions.env', 'scripts/check-links.sh', 'scripts/check-render-determinism.sh', '.github/workflows/docs.yml']
workflow_dispatch:
permissions:
contents: read
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ jobs:
working-directory: operator
run: go run ./cmd/check-default-images --values ../charts/nebari-llm-serving/values.yaml

- name: Check generated pins are fresh
working-directory: operator
run: go run ./cmd/render-pins --root .. --check

test-operator:
name: Test operator
runs-on: ubuntu-latest
Expand All @@ -53,9 +57,14 @@ jobs:

- name: Render released AI Gateway CRDs for admission checks
run: |
ai_gateway_version=$(grep -E '^AI_GATEWAY_VERSION=' versions.env | cut -d= -f2)
if [ -z "$ai_gateway_version" ]; then
echo "AI_GATEWAY_VERSION missing from versions.env" >&2
exit 1
fi
ai_gateway_crd_dir=$(mktemp -d)
helm template aieg-crd oci://docker.io/envoyproxy/ai-gateway-crds-helm \
--version v1.1.0 > "$ai_gateway_crd_dir/ai-gateway.yaml"
--version "$ai_gateway_version" > "$ai_gateway_crd_dir/ai-gateway.yaml"
echo "AI_GATEWAY_CRD_DIR=$ai_gateway_crd_dir" >> "$GITHUB_ENV"

- name: Run tests
Expand Down
8 changes: 5 additions & 3 deletions charts/nebari-llm-serving/charts/nebari-openmeter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,13 @@ To move to a new OpenMeter release:
2. Push the branch, and check that the tests pass.
3. Push tag `<upstream tag>-nebari.<n>` (`n` starting at 1) to publish the
image.
4. Pin the new image by digest in `openmeter.image` in `values.yaml`, and
4. Pin the new image by digest as `OPENMETER_IMAGE` in `versions.env` (run
`render-pins`, below, to write `openmeter.image` in `values.yaml`), and
bump `appVersion` in `Chart.yaml`.
5. Move the usage collector's `benthos-collector` image to the same OpenMeter
version: `usage.collector.image` in `charts/nebari-llm-serving/values.yaml`
and `USAGE_COLLECTOR_IMAGE` in `dev/Makefile`.
version: set `USAGE_COLLECTOR_IMAGE` in `versions.env` and run
`go run ./cmd/render-pins --root ..` from `operator/`, which writes
`usage.collector.image` in `charts/nebari-llm-serving/values.yaml`.

Drop the fork, and go back to `ghcr.io/openmeterio/openmeter`, once upstream
OpenMeter encrypts app secrets itself.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ inPack: false

# OpenMeter: the API (ingests usage events, answers queries) and the sink
# worker (moves events from Kafka into ClickHouse). Same image for both:
# OpenMeter v1.0.0-beta.234 with app secrets encrypted at rest, built from
# https://github.com/nebari-dev/openmeter/tree/nebari/v1.0.0-beta.234.
# OpenMeter with app secrets encrypted at rest, built from
# https://github.com/nebari-dev/openmeter (the nebari/<version> branch matching
# the tag). The pinned value lives in versions.env (OPENMETER_IMAGE).
openmeter:
image: ghcr.io/nebari-dev/openmeter:v1.0.0-beta.234-nebari.1@sha256:be471cd4036270c1f6c6979974bfcc7d6b03a46809a20fe3c6c72b45d0c12b22
api:
Expand Down
26 changes: 8 additions & 18 deletions dev/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,10 @@ KUBECTL := kubectl --context kind-$(CLUSTER_NAME)
# The same for helm, which otherwise installs into the current kube-context.
HELM := helm --kube-context kind-$(CLUSTER_NAME)

# Dependency versions. These move together: Envoy AI Gateway v1.1.x uses
# Envoy Gateway v1.8.1 and Gateway API v1.5.1 (see
# https://aigateway.envoyproxy.io/docs/compatibility/). Bump them as a set
# when upgrading the AI Gateway.
CERT_MANAGER_VERSION ?= v1.17.2
GATEWAY_API_VERSION ?= v1.5.1
GIE_VERSION ?= v1.4.0
ENVOY_GATEWAY_VERSION ?= v1.8.1
AI_GATEWAY_VERSION ?= v1.1.0
# OpenMeter collector image the usage collector runs; keep in step with
# usage.collector.image in the chart values.
USAGE_COLLECTOR_IMAGE ?= ghcr.io/openmeterio/benthos-collector:v1.0.0-beta.234@sha256:cdc35416af4ededfbdb531463a3135127274f595c4b4b44573e685e82aac4fc4
# CloudNativePG operator, which Nebari installs on every cluster; the bundled
# OpenMeter's Postgres is a CloudNativePG Cluster. 0.29.1 ships operator
# 1.30.1, which fixes CVE-2026-84304 (gRPC) in 1.30.0.
CNPG_CHART_VERSION ?= 0.29.1
CNPG_IMAGE_TAG ?= 1.30.1@sha256:923c267ec29636db3bee20f993d0ec4973fa22998e1adad37da79e4d32b5bc07
# Dependency versions live in ../versions.env, the one pin file (CI, the docs
# tests and the published examples read it too). They move together: see the
# comments there. Override one for a single run with e.g. `make setup GIE_VERSION=v1.4.0`.
include ../versions.env

# Helm 4 applies the eg chart's bundled Gateway API CRDs (crds/) server-side.
# Those are the experimental channel, and the safe-upgrades admission policy
Expand All @@ -38,11 +25,14 @@ HELM_MAJOR := $(shell helm version --template '{{.Version}}' 2>/dev/null | sed -
EG_CHART := oci://docker.io/envoyproxy/gateway-helm
EG_SKIP_BUNDLED_CRDS := $(if $(filter-out 1 2 3,$(HELM_MAJOR)),--skip-crds --set crds.gatewayAPI.safeUpgradePolicy.enabled=false,)

.PHONY: setup teardown build-images load-images deploy deploy-operator deploy-key-manager deploy-keycloak apply-test-model apply-passthrough-model create-openrouter-secret run-dev ui test-auth test-model-scope deploy-cnpg usage-e2e usage-tracer usage-forgery-check test-usage-collector logs-operator logs-key-manager logs-keycloak pf-key-manager pf-keycloak clean help
.PHONY: setup teardown build-images load-images deploy deploy-operator deploy-key-manager deploy-keycloak apply-test-model apply-passthrough-model create-openrouter-secret run-dev ui test-auth test-model-scope deploy-cnpg usage-e2e usage-tracer usage-forgery-check test-usage-collector logs-operator logs-key-manager logs-keycloak pf-key-manager pf-keycloak clean help render-pins

help: ## Show this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)

render-pins: ## Rewrite the published examples and chart image fields from ../versions.env
cd ../operator && go run ./cmd/render-pins --root ..

run-dev: ## One-command UI dev environment: cluster + models + port-forward + hot-reload UI server (needs dev/.env with OPENROUTER_API_KEY)
./run-dev.sh

Expand Down
32 changes: 32 additions & 0 deletions docs/architecture/contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,35 @@ Contracts the operator owns or depends on. Changing one updates its entry in the
**Owner:** `operator/internal/controller` · **Consumers:** `operator/cmd/main.go` (constructs both reconcilers without `Clock`), `passthroughmodel_controller.go:145` and `llmmodel_controller.go:217,224` (read it through `realClockIfNil`), the controller tests (verified: `rg -n "Clock" operator --glob '!*_test.go'`)
**Promises:** `PassthroughModelReconciler` has `Clock clock.PassiveClock` (`k8s.io/utils/clock`). A nil `Clock` means the real clock (`realClockIfNil`), and `cmd/main.go` leaves it nil; tests inject a fake clock to step through the route-acceptance windows. `LLMModelReconciler` has the same field (`llmmodel_controller.go:66`) and also leaves it nil in `cmd/main.go`. `Client`, `Scheme` and `Config` are unchanged.
**Since:** 2026-11-20 (issue #233)

### `versions.env` file format
**Owner:** `versions.env` at the repo root, parsed by `ParsePins` in `operator/cmd/render-pins/pins.go` · **Consumers:** `dev/Makefile` (`include ../versions.env`), `render-pins`, `.github/workflows/test.yaml` (the AI Gateway CRD render step reads `AI_GATEWAY_VERSION`; the `Check default images` job runs `render-pins --check`), the `paths` filter of `.github/workflows/docs.yml`, `scripts/check-render-determinism.sh` (`CHART_VERSION`), and the version case in `docs/test/docs-examples.test.mjs`. The docs pin plugin and the journey suite read it in later slices and are not consumers yet (verified: `rg -n "versions\.env" --glob '!node_modules' --glob '!.worktrees' --glob '!docs/superpowers/**' .`).
**Promises:** One `KEY=value` per line, `#` comment lines and blank lines allowed, no quotes, no spaces around `=` or in a key, no `$` expansion, no duplicate keys, so that make `include`, `grep` and the Go parser all read the same value. Keys today: `CERT_MANAGER_VERSION`, `GATEWAY_API_VERSION`, `GIE_VERSION` (v1.5.0; `dev/Makefile` had v1.4.0), `ENVOY_GATEWAY_VERSION`, `AI_GATEWAY_VERSION`, `USAGE_COLLECTOR_IMAGE`, `OPENMETER_IMAGE`, `CNPG_CHART_VERSION`, `CNPG_IMAGE_TAG`. The two `*_IMAGE` keys hold `repository:tag@digest`. `ENVOY_GATEWAY_VERSION` and `AI_GATEWAY_VERSION` are written into the published examples; `USAGE_COLLECTOR_IMAGE` and `OPENMETER_IMAGE` into the chart values (see the `render-pins` entry); the others are read only by `dev/Makefile`. The AI Gateway, Envoy Gateway and Gateway API versions move together. Adding a key changes this entry in the same PR.
**Errors:** `render-pins` rejects a line with no `=`, an empty key, a quote, a `$`, spaces around `=`, or a repeated key, naming the line number; a key a template names but the file lacks fails the render.
**Since:** 2026-11-26 (docs/superpowers/specs/2026-11-24-ci-journey-tests-design.md)

### `dev/Makefile` version variables
**Owner:** `dev/Makefile` · **Consumers:** `dev/Makefile` only (verified: `rg -n "CERT_MANAGER_VERSION|GATEWAY_API_VERSION|GIE_VERSION|ENVOY_GATEWAY_VERSION|AI_GATEWAY_VERSION|CNPG_CHART_VERSION|CNPG_IMAGE_TAG|USAGE_COLLECTOR_IMAGE" --glob '!node_modules' --glob '!.worktrees' --glob '!docs/superpowers/**' .`). The hits outside `dev/Makefile` are `versions.env`, `render-pins`, `scripts/check-render-determinism.sh` and `docs/test/docs-examples.test.mjs`, which read the pin file, not the Makefile.
**Promises:** The variables keep their names, but their values now come from `include ../versions.env` instead of `?=` defaults in the Makefile. Because the include sets them, they can still be overridden on the make command line (`make setup GIE_VERSION=v1.4.0`) but no longer from the environment. The default `GIE_VERSION` moved from v1.4.0 to v1.5.0. `OPENMETER_IMAGE` is not used by the Makefile. A new `make render-pins` target runs `go run ./cmd/render-pins --root ..` from `operator/`. The comment in `charts/nebari-llm-serving/charts/nebari-openmeter/README.md` that named `USAGE_COLLECTOR_IMAGE` in `dev/Makefile` now points at `versions.env`.
**Since:** 2026-11-26 (docs/superpowers/specs/2026-11-24-ci-journey-tests-design.md)

### Pinned fields in `examples/*.yaml`
**Owner:** `operator/cmd/render-pins/templates/` (`envoy-ai-gateway.yaml.tmpl`, `envoy-gateway.yaml.tmpl`), rendered to `examples/envoy-ai-gateway.yaml` and `examples/envoy-gateway.yaml` · **Consumers:** docs pages, `installation.md` copy commands, users (verified: `rg -n "examples/[a-z-]+\.yaml" docs/src docs/test README.md charts --glob '!node_modules'`; this finds the docs references to examples generally, and `docs/test/docs-examples.test.mjs` and `scripts/check-render-determinism.sh` read the rendered AI Gateway example's chart version).
**Promises:** The two rendered files are generated: each starts with `# Generated from <template>, do not edit.` and is edited only through its template. `targetRevision` is `AI_GATEWAY_VERSION` (twice) in the AI Gateway example and `ENVOY_GATEWAY_VERSION` in the Envoy Gateway example. The file names, their place under `examples/` and the rest of their content are unchanged. All other files in `examples/` are hand-written and carry no pin.
**Since:** 2026-11-26 (docs/superpowers/specs/2026-11-24-ci-journey-tests-design.md)

### Chart value `usage.collector.image` (`repository`, `tag`)
**Owner:** `charts/nebari-llm-serving/values.yaml:260-265`, written by `render-pins` from `USAGE_COLLECTOR_IMAGE` in `versions.env` · **Consumers:** `charts/nebari-llm-serving/templates/usage-collector.yaml:47`, `docs/src/content/docs/configuration.mdx:120-121`, `operator/cmd/check-default-images` (reads the whole values file) (verified: `rg -n "usage\.collector\.image|\.Values\.usage\.collector\.image" --glob '!node_modules' --glob '!.worktrees' --glob '!docs/superpowers/**' .`)
**Promises:** Same value and shape as before: `repository` and `tag` (`<version>@sha256:<digest>`), with `pullPolicy` untouched. `render-pins` splits `USAGE_COLLECTOR_IMAGE` at the last `:` before the `@` into `repository` and `tag` (the tag keeps its `@sha256:` digest), rewrites those two lines, and rewrites the comment line above `tag` to `# <version>, pinned by digest.`; other keys and comments are untouched. The template still renders `<repository>:<tag>`. The same mechanism writes `openmeter.image` of the `nebari-openmeter` subchart from `OPENMETER_IMAGE`; that value is a single string, not split.
**Since:** 2026-11-26 (docs/superpowers/specs/2026-11-24-ci-journey-tests-design.md)

### `render-pins` CLI and exit code
**Owner:** `operator/cmd/render-pins/` · **Consumers:** developers, `make render-pins` (`dev/Makefile:31`), and the `Check default images` job in `.github/workflows/test.yaml` (verified: `rg -n "render-pins" --glob '!node_modules' --glob '!.worktrees' --glob '!docs/superpowers/**' --glob '!operator/cmd/render-pins/**' .`)
**Promises:** Run as `cd operator && go run ./cmd/render-pins --root <repo root>`. `--root` is required. Without `--check` it rewrites each generated file that differs from what `versions.env` renders, prints `WROTE <path>` for each, and writes nothing else (a fresh tree is a no-op). With `--check` it writes nothing, prints `STALE <path>` for each stale file on stdout, and exits 1 if any. Exit codes: 0 fresh or written, 1 a read, parse or render failure or stale files under `--check`, 2 a usage error (bad flag or missing `--root`). The generated set is the two examples and the two chart image fields (see the entries above); adding one changes this entry.
**Errors:** Messages go to stderr as `ERROR: <cause>`; a stale check ends with `N generated file(s) stale; run: go run ./cmd/render-pins --root <root>`.
**Since:** 2026-11-26 (docs/superpowers/specs/2026-11-24-ci-journey-tests-design.md)

### CI wiring: required-check name, workflow triggers, image tag, F13 trigger
**Owner:** `.github/workflows/` · **Consumers:** ruleset 17703874 (required checks) (verified: `rg -n "versions\.env|render-pins" .github/workflows`)
**Promises:** Phase 1 only. `test.yaml` reads `AI_GATEWAY_VERSION` from `versions.env` in the "Render released AI Gateway CRDs for admission checks" step (failing if the key is missing), and its `Check default images` job gains the step "Check generated pins are fresh", which runs `render-pins --check`, so a stale generated file fails that existing check. `docs.yml` triggers on changes to `versions.env` and `examples/**` (both the `push` and `pull_request` `paths` filters). No job name and no required check changes. The image tag, the journey workflows and the F13 trigger are not wired yet; they are deferred to phase 2 (spec Q9, Q11, Q12, Q16, Q17, Q18, Q19).
**Since:** 2026-11-26 (docs/superpowers/specs/2026-11-24-ci-journey-tests-design.md)
24 changes: 24 additions & 0 deletions docs/architecture/patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,27 @@ The operator handles Gateway API and Envoy Gateway kinds as `unstructured.Unstru
### Uncached unstructured reads need only the `get` verb
Unstructured reads go to the API server uncached, so reading a kind the operator does not watch needs only `get` RBAC, not `list` or `watch`. See `operator/internal/controller/passthroughmodel_endpoints.go:26-30` and `charts/nebari-llm-serving/templates/operator-clusterrole.yaml:72-77`. This holds as long as `operator/cmd/main.go` does not enable the `Unstructured` cache option on the manager's client.
**Confirmed:** 2026-11-20 (issue #233)

### Every dev tool pins `kubectl` to `--context kind-<CLUSTER_NAME>`
Dev scripts and make targets pass `--context kind-<CLUSTER_NAME>` to `kubectl` and never use the current context, so a developer's other clusters are not touched. See `dev/Makefile:3-7`, `dev/test-auth.sh:31-33` and `dev/usage-e2e.sh:42-44`.
**Confirmed:** 2026-11-25 (spec: docs/superpowers/specs/2026-11-24-ci-journey-tests-design.md)

### Dev make targets are the entry points for local cluster work
Each target in `dev/Makefile` has a `##` help comment, and local cluster work starts from a target rather than a raw script. See `dev/Makefile:41-168`.
**Confirmed:** 2026-11-25 (spec: docs/superpowers/specs/2026-11-24-ci-journey-tests-design.md)

### Repo tooling written in Go lives under `operator/cmd/<tool>/`
It is run with `go run ./cmd/<tool>` from `operator/`. See `operator/cmd/check-default-images/main.go` and `.github/workflows/test.yaml:36-38`.
**Confirmed:** 2026-11-25 (spec: docs/superpowers/specs/2026-11-24-ci-journey-tests-design.md)

### Docs pages embed `examples/*.yaml` through a `?raw` import
Pages import the file with `?raw` and show it with `ExampleCode.astro`, with no inline copy of the manifest. See `docs/test/docs-examples.test.mjs:36-48` and `docs/src/content/docs/architecture.mdx:5-6`.
**Confirmed:** 2026-11-25 (spec: docs/superpowers/specs/2026-11-24-ci-journey-tests-design.md)

### Markdown transforms for the docs are remark plugins
They live in `docs/src/plugins/` and are unit-tested with vitest in `docs/tests/`. See `docs/astro.config.mjs:66`, `docs/src/plugins/remark-base-links.ts` and `docs/tests/remark-base-links.test.ts`.
**Confirmed:** 2026-11-25 (spec: docs/superpowers/specs/2026-11-24-ci-journey-tests-design.md)

### A session probes a shared prerequisite once
When many tests depend on one prerequisite, the session checks it once and fails every dependent test with a single precise diagnosis instead of many unrelated errors. The model is NIC `journeys/conftest.py:58-87` (`gateway_reachable`).
**Confirmed:** 2026-11-25 (spec: docs/superpowers/specs/2026-11-24-ci-journey-tests-design.md)
Loading
Loading