Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ second command matches; Postgres's volume goes with its `Cluster`.
cd openmeter-setup && go test ./... # bootstrap and ensure-secret against fakes
cd usage-console/server && go test ./internal/openmeter/ # the console API against a fake OpenMeter
cd usage-console/console && npm ci --ignore-scripts && npx vitest run
cd dev && make usage-e2e # on the kind cluster: install, send traffic, check totals
cd dev && make usage-e2e # on the kind cluster: the integration profile, then the journey suite's usage features (F10, F12)
```

## History
Expand Down
41 changes: 31 additions & 10 deletions dev/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ FEATURES ?=
# otherwise shadow the locked packages.
JOURNEYS_PIXI := cd ../tests/journeys && PYTHONNOUSERSITE=1 pixi run --locked

# Every suite run (integration-test and the four feature targets) is one
# `journeys-run` under this checkout's run lock, tests/journeys/results/.run.lock
# (llm_journeys.runlock), held from the profile check to the report. A second
# run started while one is in progress fails at once (the lock step exits 1,
# so make exits 2), before it checks the profile, reinstalls nebari_journeys
# or touches results/ under the first. The kernel drops the lock however a
# run ends.
JOURNEYS_RUN = $(JOURNEYS_PIXI) python -m llm_journeys.runlock results/.run.lock -- $(MAKE) -C $(CURDIR) --no-print-directory journeys-run

# Pin every kubectl to the local kind cluster's context. Without this, the dev
# targets act on whatever your current kube-context happens to be - which could
# be a remote/production cluster - and would deploy the auth-bypassing dev-mode
Expand All @@ -41,7 +50,7 @@ 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 integration-up spa-real-auth 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 integration-test profile-check logs-operator logs-key-manager logs-keycloak pf-key-manager pf-keycloak clean help render-pins
.PHONY: setup teardown build-images load-images deploy integration-up spa-real-auth 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 integration-test journeys-run profile-check 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)
Expand Down Expand Up @@ -111,6 +120,14 @@ profile-check: ## Exit 0 when the kind-dev profile the journey suite needs is co
$(JOURNEYS_PIXI) python -m llm_journeys.preflight --target kind-dev --kube-context kind-$(CLUSTER_NAME) --gateway-https-port $(GATEWAY_HOST_HTTPS_PORT)

integration-test: ## Run the journey suite's integration tier on kind-dev and report it by feature (FEATURES=F4,F8 narrows it); run make integration-up first, an incomplete profile fails the run
$(JOURNEYS_RUN) FEATURES=$(FEATURES)

# The steps every suite run shares, run only through $(JOURNEYS_RUN), which
# holds the run lock. ENSURE_PROFILE=1 (the four feature targets) first runs
# integration-up when profile-check fails.
journeys-run:
@test -n "$$LLM_JOURNEYS_RUN_LOCK" || { echo "journeys-run is not a target to run on its own: use make integration-test" >&2; exit 2; }
$(if $(ENSURE_PROFILE),$(MAKE) --no-print-directory profile-check || $(MAKE) --no-print-directory integration-up)
tag="$$(nic/resolve-nic-tag.sh)" && $(JOURNEYS_PIXI) ./install-helpers.sh "$$tag"
$(JOURNEYS_PIXI) python ../../dev/mock-vllm/test_server.py
$(JOURNEYS_PIXI) pytest tests_lib -W error
Expand Down Expand Up @@ -159,19 +176,23 @@ ui: ## Run the React UI dev server against the local cluster (alias for run-dev)
@echo "Starting the one-command dev environment (cluster + models + API port-forward + Vite)..."
./run-dev.sh

test-auth: ## Verify the key-manager's real bearer-token JWKS validation (deploys Keycloak, flips off dev mode, mints a token, asserts 200/401). KEEP_AUTH=1 leaves real-auth mode on.
./test-auth.sh
# The four feature targets run integration-up when profile-check fails, then
# their features through the suite. They leave the cluster on the integration
# profile (no dev mode on exit, Q75): make deploy switches back for run-dev.
test-auth: ## Journey suite F4 (key REST API; the key-manager rejects missing and invalid bearers) on the kind-dev profile, running integration-up first if it is not up; leaves the integration profile (make deploy for dev mode). For the SPA login: make spa-real-auth
@test -z "$(KEEP_AUTH)" || { echo "KEEP_AUTH is gone: use make spa-real-auth" >&2; exit 1; }
$(JOURNEYS_RUN) FEATURES=F4 ENSURE_PROFILE=1

test-model-scope: ## Verify per-model API-key scoping and x-llm-client-id anti-spoofing through the gateway (deploys two mock models, asserts the 200/403/401 matrix). KEEP=1 leaves the models.
./test-model-scope.sh
test-model-scope: ## Journey suite F8 (per-model API-key scope, client-id anti-spoofing) on the kind-dev profile, running integration-up first if it is not up; leaves the integration profile (make deploy for dev mode)
$(JOURNEYS_RUN) FEATURES=F8 ENSURE_PROFILE=1

usage-e2e: ## Usage metering end to end with the bundled OpenMeter and usage console: alice and bob call the mock provider, per-person and per-team totals read back from OpenMeter's meters and the console's API (run `make setup` first)
./usage-e2e.sh
usage-e2e: ## Journey suite F10 and F12 (usage metering and the usage console; network isolation) on the kind-dev profile, running integration-up first if it is not up; leaves the integration profile (make deploy for dev mode)
$(JOURNEYS_RUN) FEATURES=F10,F12 ENSURE_PROFILE=1

usage-forgery-check: ## Check callers cannot choose the identity or request id the usage access log records (after usage-e2e)
./usage-forgery-check.sh
usage-forgery-check: ## Journey suite F14 (callers cannot choose the identity or request id the usage log records) on the kind-dev profile, running integration-up first if it is not up; leaves the integration profile (make deploy for dev mode)
$(JOURNEYS_RUN) FEATURES=F14 ENSURE_PROFILE=1

usage-tracer: ## Web page that sends one request and follows it through the gateway log, collector, Kafka, ClickHouse, OpenMeter and the console, at http://127.0.0.1:18894 (run `make usage-e2e` first)
usage-tracer: ## Web page that sends one request and follows it through the gateway log, collector, Kafka, ClickHouse, OpenMeter and the console, at http://127.0.0.1:18894 (run `make integration-up` first)
python3 usage-tracer/server.py

test-usage-collector: ## Run the usage collector pipeline tests in the pinned collector image
Expand Down
2 changes: 1 addition & 1 deletion dev/demo-users.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# kept in the Secret keycloak/demo-users (random, made on the first run).
#
# The dev Keycloak runs start-dev, so a restart of its pod forgets them;
# re-run this afterwards. Used by usage-e2e.sh and the usage tracer.
# re-run this afterwards. Used by integration-up.sh and the usage tracer.
set -euo pipefail

CLUSTER_NAME="${CLUSTER_NAME:-llm-serving-test}"
Expand Down
15 changes: 0 additions & 15 deletions dev/gateways.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,3 @@ spec:
allowedRoutes:
namespaces:
from: All
---
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: nebari-internal-gateway
namespace: envoy-gateway-system
spec:
gatewayClassName: nebari-gateway-class
listeners:
- name: http
protocol: HTTP
port: 80
allowedRoutes:
namespaces:
from: All
4 changes: 2 additions & 2 deletions dev/integration-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ restart_if_stale "$NS" mock-provider app=mock-provider
# --- 5. gateway: access log, ClientTrafficPolicy, usage collector ------------------
step "configuring the gateway: access log (manifests/access-log) and ClientTrafficPolicy"
# Written whole (create, or replace when present) rather than applied, so no
# field outside the published example survives, such as the trust-store patch
# usage-e2e.sh makes with `kubectl patch`.
# field outside the published example survives (the mock provider is trusted
# through the PassthroughModel's caConfigMapName, not an EnvoyProxy patch).
kubectl kustomize --load-restrictor=LoadRestrictionsNone manifests/access-log > "$WORK/envoyproxy.yaml"
if $KUBECTL -n "$GW_NS" get envoyproxy nebari-gateway-proxy >/dev/null 2>&1; then
$KUBECTL replace -f "$WORK/envoyproxy.yaml" >/dev/null
Expand Down
2 changes: 1 addition & 1 deletion dev/manifests/integration/key-manager-patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
env:
# Set to "false", not deleted: `kubectl apply` removes only fields
# it applied before, so a delete would leave a value someone set
# with `kubectl set env` (dev/test-auth.sh does) in place.
# with `kubectl set env` in place.
- name: LLM_DEV_MODE
value: "false"
- name: LLM_KEYCLOAK_URL
Expand Down
2 changes: 1 addition & 1 deletion dev/manifests/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ spec:
- name: LLM_EXTERNAL_GATEWAY_NAMESPACE
value: "envoy-gateway-system"
- name: LLM_INTERNAL_GATEWAY_NAME
value: "nebari-internal-gateway"
value: "nebari-gateway"
- name: LLM_INTERNAL_GATEWAY_NAMESPACE
value: "envoy-gateway-system"
# Issue the shared llm.local / llm-internal.local cert via the
Expand Down
22 changes: 0 additions & 22 deletions dev/manifests/usage-envoyproxy-dev.yaml

This file was deleted.

6 changes: 4 additions & 2 deletions dev/manifests/usage-key-manager-patch.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Dev key-manager settings for `make usage-e2e`: strategic-merge patch for
# Dev key-manager settings for usage metering (the same settings
# manifests/integration/key-manager-patch.yaml applies, which `make
# integration-up` uses; nothing applies this file): strategic-merge patch for
# deployment/llm-key-manager.
#
# - Real bearer-token validation against the in-cluster dev Keycloak instead of
# dev mode, so minted keys record their creator's OIDC subject and groups.
# - The key-owner lookup on :8081 for the usage collector.
# - OpenMeter customer sync; usage-e2e.sh sets LLM_OPENMETER_URL to the
# - OpenMeter customer sync; LLM_OPENMETER_URL names the
# openmeter subchart, whose network policy admits the label below.
spec:
template:
Expand Down
2 changes: 1 addition & 1 deletion dev/manifests/usage-key-owners-service.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# The dev key-manager's key-owner lookup (usage-e2e.sh), for the usage
# The dev key-manager's key-owner lookup (`make integration-up`), for the usage
# collector. The chart creates the same Service when usage.enabled.
apiVersion: v1
kind: Service
Expand Down
12 changes: 6 additions & 6 deletions dev/manifests/usage-mock-provider.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# In-cluster stand-in for an external OpenAI-compatible provider, used by
# `make usage-e2e` to exercise usage metering through the PassthroughModel
# `make integration-up` to exercise usage metering through the PassthroughModel
# path without a provider account.
#
# A PassthroughModel always connects to its provider over TLS and validates the
# certificate against the gateway's system trust store, so the mock serves
# HTTPS with a certificate from the local self-signed issuer, and
# usage-e2e.sh adds that certificate to the gateway's trust store (see
# usage-envoyproxy-dev.yaml).
# certificate against its trust store, so the mock serves HTTPS with a
# certificate from the local self-signed issuer, and integration-up.sh puts
# that certificate in the ConfigMap mock-provider-ca, which the PassthroughModel
# names in spec.provider.tls.caConfigMapName.
#
# Prereq: the provider credential Secret `mock-provider-api-key` (created by
# usage-e2e.sh with a random value; the mock does not check it).
# integration-up.sh with a random value; the mock does not check it).
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
Expand Down
2 changes: 1 addition & 1 deletion dev/manifests/usage-openmeter-values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Values for the openmeter subchart on the dev kind cluster (usage-e2e.sh):
# Values for the openmeter subchart on the dev kind cluster (`make integration-up`):
# the mock provider alongside Bedrock, the locally built openmeter-setup and
# usage console images, small volumes.
modelResources:
Expand Down
131 changes: 0 additions & 131 deletions dev/test-auth.sh

This file was deleted.

Loading
Loading