Validate: agentgateway multi-auth on a single endpoint (machine + human) #1534

Closed
opened 2026-08-13 23:05:05 +00:00 by ginjiruu · 1 comment
Owner

Validate: agentgateway multi-auth on a single endpoint (machine + human)

Validation ticket for the hub architecture (#1532). The plan's D5 depends on one public endpoint per cluster (<cluster>.k8s.animeteamspeak.moe) serving both auth flows on the same listener:

  • Machine: kubeconfig carries a Kanidm SA API token → agentgateway performs the RFC 8693 exchange per request (Golden Path, iac#38/#39).
  • Human: kubelogin exec mints a fresh token client-side → agentgateway passes it through; apiserver validates OIDC.

Both flows arrive at the same URL. The question: can one agentgateway listener accept a static bearer token and route the request through backendAuth.oauthTokenExchange, and accept a fresh OIDC token and forward it unchanged — on the same route, disambiguated per request?

Why this matters

D5 is the load-bearing assumption of the architecture. If agentgateway cannot do both on one endpoint, the design forks:

  • Option A: two listeners per cluster (one exchange, one passthrough) — but then humans and machines hit different URLs, breaking the single-endpoint goal and the DNS wildcard (#1532 D7).
  • Option B: a separate gateway or a fronting proxy that splits flows — more moving parts, audit split across two paths.
  • Option C: treat every flow as an exchange (human gets a Kanidm SA token too) — changes the human UX and kubeconfig distribution.

The single-endpoint dual-auth model is only viable if agentgateway supports it, so this is a prerequisite validation — it gates the architecture, and should be checked before WG/CA work commits to D5.

What to verify

  • Does agentgateway support multiple auth configurations on a single listener/route (per-route backendAuth selection, or a request-level distinction between "static SA token → exchange" and "OIDC token → passthrough")?
  • If not today: is it on the agentgateway roadmap (upstream issue)? Precedent: kgateway / envoy-gateway support multi-auth on one listener.
  • How does the request disambiguate — by token type (JWT audience/issuer), by header, by route?
  • What does the audit trail look like per flow (machine vs human) — does one listener preserve both identities?
  • Impact on the kubectl exec/logs/port-forward SPDY path (ties to #1532 D6) — do both flows survive connection upgrades?

Deliverables

  • A decision recorded on #1532 D5: single-endpoint dual-auth is supported / needs upstream / use two endpoints
  • If upstream-needed: link the agentgateway issue and set a revisit gate before WG/CA implementation starts
  • #1532 (plan, D5) — this is its validation
  • iac#38 (Golden Path mechanism), iac#39 (RFC 8693 conformance, resolved)
  • #1530 (Sveltos auth — consumes the same machine flow)
## Validate: agentgateway multi-auth on a single endpoint (machine + human) Validation ticket for the hub architecture (#1532). The plan's D5 depends on one public endpoint per cluster (`<cluster>.k8s.animeteamspeak.moe`) serving **both** auth flows on the **same** listener: - **Machine**: kubeconfig carries a Kanidm SA API token → agentgateway performs the RFC 8693 exchange per request (Golden Path, iac#38/#39). - **Human**: kubelogin exec mints a fresh token client-side → agentgateway passes it through; apiserver validates OIDC. Both flows arrive at the same URL. The question: can one agentgateway listener accept a static bearer token and route the request through `backendAuth.oauthTokenExchange`, *and* accept a fresh OIDC token and forward it unchanged — on the same route, disambiguated per request? ## Why this matters D5 is the load-bearing assumption of the architecture. If agentgateway cannot do both on one endpoint, the design forks: - **Option A**: two listeners per cluster (one exchange, one passthrough) — but then humans and machines hit different URLs, breaking the single-endpoint goal and the DNS wildcard (#1532 D7). - **Option B**: a separate gateway or a fronting proxy that splits flows — more moving parts, audit split across two paths. - **Option C**: treat every flow as an exchange (human gets a Kanidm SA token too) — changes the human UX and kubeconfig distribution. The single-endpoint dual-auth model is only viable if agentgateway supports it, so this is a **prerequisite validation** — it gates the architecture, and should be checked before WG/CA work commits to D5. ## What to verify - [ ] Does agentgateway support multiple auth configurations on a single listener/route (per-route `backendAuth` selection, or a request-level distinction between "static SA token → exchange" and "OIDC token → passthrough")? - [ ] If not today: is it on the agentgateway roadmap (upstream issue)? Precedent: kgateway / envoy-gateway support multi-auth on one listener. - [ ] How does the request disambiguate — by token type (JWT audience/issuer), by header, by route? - [ ] What does the audit trail look like per flow (machine vs human) — does one listener preserve both identities? - [ ] Impact on the `kubectl exec/logs/port-forward` SPDY path (ties to #1532 D6) — do both flows survive connection upgrades? ## Deliverables - [ ] A decision recorded on #1532 D5: single-endpoint dual-auth is **supported** / **needs upstream** / **use two endpoints** - [ ] If upstream-needed: link the agentgateway issue and set a revisit gate before WG/CA implementation starts ## Related - #1532 (plan, D5) — this is its validation - iac#38 (Golden Path mechanism), iac#39 (RFC 8693 conformance, resolved) - #1530 (Sveltos auth — consumes the same machine flow)
Author
Owner

Validated: single endpoint dual-auth works on same listener.

  • Machine: Kanidm SA API token (HS256) -> gateway TokenExchange (audience minicluster/portablecluster) -> apiserver OIDC, 200 PodList + exec 101 via c05fba9c/31f3774a
  • Human: kubelogin exec -> ES256 id_token -> passthrough rule (Authorization regex HS256 only for exchange, ES256 falls to passthrough) -> apiserver OIDC direct, 200/101 with correct RBAC (ginjiruu mini-admins/portable-admins) via /tmp/testkubeconfig (fresh browser login 2026-08-27)
  • HTTPRoute mini.k8s now 2 rules: exchange (Bearer HS256 -> TokenExchange) + passthrough (no auth or ES256 -> direct). JWT Permissive scoped to exchange only (fe7af238) so passthrough forwards Authorization untouched. TLS split per sectionName (exchange mTLS for mini, passthrough CA-only).
  • Single hostname mini.k8s.animeteamspeak.moe / portable.k8s.animeteamspeak.moe serves both flows, disambiguated by Authorization header regex. No second listener needed. See commits fe7af238, c05fba9c, 31f3774a.
Validated: single endpoint dual-auth works on same listener. - Machine: Kanidm SA API token (HS256) -> gateway TokenExchange (audience minicluster/portablecluster) -> apiserver OIDC, 200 PodList + exec 101 via c05fba9c/31f3774a - Human: kubelogin exec -> ES256 id_token -> passthrough rule (Authorization regex HS256 only for exchange, ES256 falls to passthrough) -> apiserver OIDC direct, 200/101 with correct RBAC (ginjiruu mini-admins/portable-admins) via /tmp/testkubeconfig (fresh browser login 2026-08-27) - HTTPRoute mini.k8s now 2 rules: exchange (Bearer HS256 -> TokenExchange) + passthrough (no auth or ES256 -> direct). JWT Permissive scoped to exchange only (fe7af238) so passthrough forwards Authorization untouched. TLS split per sectionName (exchange mTLS for mini, passthrough CA-only). - Single hostname mini.k8s.animeteamspeak.moe / portable.k8s.animeteamspeak.moe serves both flows, disambiguated by Authorization header regex. No second listener needed. See commits fe7af238, c05fba9c, 31f3774a.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lab/clusters#1534
No description provided.