Skip to content

feat: inject projected SA token volume into sandbox pods#8

Merged
pdettori merged 1 commit into
mvpfrom
fix/projected-sa-token-mvp
Jun 4, 2026
Merged

feat: inject projected SA token volume into sandbox pods#8
pdettori merged 1 commit into
mvpfrom
fix/projected-sa-token-mvp

Conversation

@pdettori
Copy link
Copy Markdown

@pdettori pdettori commented Jun 4, 2026

Summary

  • Add projected serviceAccountToken volume with audience openshell-gateway to sandbox pods
  • Mount at /var/run/secrets/openshell/token (read-only, mode 0400)
  • Update OPENSHELL_K8S_SA_TOKEN_FILE from default K8s SA path to the projected token path
  • New CLI flags: -sa-token-audience (default openshell-gateway), -sa-token-ttl-secs (default 3600)

Context

The gateway's K8s SA authenticator validates sandbox tokens via TokenReview with audience
openshell-gateway. PR #6 added the env var but pointed it at the default K8s SA token
which carries the wrong audience (https://kubernetes.default.svc.cluster.local), causing:

K8s TokenReview did not authenticate token
  error="token audiences [\"https://kubernetes.default.svc.cluster.local\"] is invalid for the target audiences [\"openshell-gateway\"]"

This PR adds the projected volume with the correct audience, matching the upstream in-tree
driver implementation (kagenti/OpenShell@mvp-v2:crates/openshell-driver-kubernetes/src/driver.rs).

Fixes: kagenti/kagenti#1815

Test plan

  • Unit tests pass (go test ./...)
  • Deploy with Kind full test (kagenti PR #1814)
  • Verify sandbox supervisor connects to gateway successfully

Assisted-By: Claude Code

The gateway's K8s SA authenticator requires tokens with audience
"openshell-gateway". Replace the default SA token path with a projected
serviceAccountToken volume so the supervisor authenticates correctly
via IssueSandboxToken.

Changes:
- Add SATokenAudience/SATokenTTLSecs config fields and CLI flags
- Add projected volume with configurable audience and TTL
- Mount at /var/run/secrets/openshell/token (read-only, mode 0400)
- Update OPENSHELL_K8S_SA_TOKEN_FILE to the new path

Fixes: kagenti/kagenti#1815

Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>
Signed-off-by: Paolo Dettori <dettori@us.ibm.com>
@pdettori pdettori merged commit bbbd159 into mvp Jun 4, 2026
4 checks passed
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