Skip to content

Feat(scripts): add --enable-spiffe-auth flag - #2188

Merged
Alan-Cha merged 3 commits into
mainfrom
feat/spiffe-auth-full
Jul 13, 2026
Merged

Alan-Cha merged 3 commits into
mainfrom
feat/spiffe-auth-full

Conversation

@Alan-Cha

@Alan-Cha Alan-Cha commented Jul 12, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds three new flags to setup-kagenti.sh for enabling SPIFFE-based Keycloak authentication. Tracks #2174.

Changes

  • --enable-operator-spiffe-auth — operator authenticates to Keycloak using JWT-SVID instead of admin credentials. Sets kagenti-operator-chart.spiffe.operatorAuth.enabled=true. Requires --with-spire.
  • --enable-agent-spiffe-auth — agent/tool workloads authenticate using JWT-SVID (authBridge.clientAuthType=federated-jwt). Requires --with-spire.
  • --enable-spiffe-auth — convenience shorthand that sets both.
  • Guard: both SPIFFE flags now exit immediately with a clear error if --with-spire is not passed.

Dependency

--enable-operator-spiffe-auth requires a kagenti-operator-chart OCI release that includes the conditional spiffe-helper sidecar template from kagenti-operator#473. That PR is merged to main but a new chart version has not been published yet. The current OCI chart (0.3.0-alpha.6) predates it, so the flag is a no-op until a new release is cut.

Related

Checklist

  • All commits signed-off (DCO)
  • Feature gated (default: disabled, requires explicit flags)
  • Backward compatible

Assisted-By: Claude Code

@Alan-Cha
Alan-Cha force-pushed the feat/spiffe-auth-full branch from 161269c to 6c92f0d Compare July 12, 2026 13:50
@Alan-Cha Alan-Cha added Ready for Review! ready-for-ai-review Request automated AI code review from clawgenti labels Jul 12, 2026
@Alan-Cha Alan-Cha changed the title feat(scripts+docs): add --enable-spiffe-auth flag and SPIFFE auth guide feat(scripts): add --enable-spiffe-auth flag and SPIFFE auth guide Jul 12, 2026
@Alan-Cha

Copy link
Copy Markdown
Member Author

The goal of this PR to help simplify setting up SPIFFE auth in Kagenti.

@clawgenti clawgenti left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds --enable-agent-spiffe-auth and --enable-spiffe-auth convenience flags to setup-kagenti.sh, with matching --with-spire guards and updated help text. Changes are minimal, well-scoped, and consistent with existing patterns.

All checks pass. Ready for human review.


Reviewed by clawgenti using github:pr-review

@Alan-Cha Alan-Cha changed the title feat(scripts): add --enable-spiffe-auth flag and SPIFFE auth guide Feat(scripts): add --enable-spiffe-auth flag and SPIFFE auth guide Jul 12, 2026

@clawgenti clawgenti left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shell script adds --enable-agent-spiffe-auth, --enable-spiffe-auth convenience flags, proper --with-spire guard validation, and wires authBridge.clientAuthType and kagenti-operator-chart.spiffe.enabled into the Helm flags. All checks pass. Ready for human review.


Reviewed by clawgenti using github:pr-review

@Alan-Cha

Copy link
Copy Markdown
Member Author

The 91-run-authbridge-weather-e2e.sh failure is a pre-existing issue in kagenti-extensions main unrelated to this PR. The same langchain-core==1.4.8 dependency conflict is failing on every PR (e.g. feat/simulated-tool-example-e2e-docs, run 29253960368). The fix belongs in the kagenti-extensions requirements.txt.

@mrsabath mrsabath left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean, well-gated change. Adds --enable-agent-spiffe-auth + --enable-spiffe-auth shorthand and a --with-spire guard for both SPIFFE flags.

Verified against kagenti@main and kagenti-operator@main: the subchart keys (spiffe.enabled, spiffe.operatorAuth.enabled, keycloak.publicUrl) all exist, keycloak.publicUrl is genuinely required by the subchart (it derives the JWT audience from it — subcharts don't inherit parent values), dual-mode parity holds (the client-secret off-path exactly matches the chart default at charts/kagenti/values.yaml:295, so it's a true no-op when disabled), and both guards are sound.

CI note: "Deploy & Test" is red, but the failure is a cross-repo Python dependency conflict (langchain-core==1.4.8 → ResolutionImpossible) in kagenti-extensions@main's advanced weather demo (deploy_and_verify_advanced.sh runs a pip install). It is not caused by this PR, which only edits a shell script — no requirements.txt is touched. The same failure hits unrelated PR branches (feat/simulated-tool-*), confirming it's environmental. The published pytest JUnit suites all passed (0 failures / 0 errors).

Areas reviewed: Shell, Helm value wiring (cross-repo verified), CI. Commits: 2, all signed-off (DCO green). CI: failing on an unrelated cross-repo dependency conflict.

Comments below are all non-blocking (2 suggestions, 1 nit).

Comment thread scripts/kind/setup-kagenti.sh Resolved
Comment thread scripts/kind/setup-kagenti.sh Resolved
Comment thread scripts/kind/setup-kagenti.sh Resolved
@Alan-Cha Alan-Cha changed the title Feat(scripts): add --enable-spiffe-auth flag and SPIFFE auth guide Feat(scripts): add --enable-spiffe-auth flag Jul 13, 2026

@mrsabath mrsabath left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-approving on the new HEAD (33bdb6c). This re-review covers only the delta since my approval at 2b49ad5 — one new commit plus your responses to my earlier feedback.

Delta

The entire change since my approval is a single line added to KAGENTI_FLAGS:

--set "spire.enabled=${WITH_SPIRE}"

This is exactly the nit I raised at line 1226. Verified against upstream/main:

Check Result
Guard rationale ✓ _helpers.tpl:99-100 does fail when clientAuthType=federated-jwt && spire.enabled=false — the commit message is accurate
Default masking ✓ chart default is spire.enabled: true (values.yaml:471); the explicit set is robust to a future default flip
Value safety ✓ WITH_SPIRE is a clean bash true/false (init false, set true by --with-spire) — safe to interpolate
No key collision ✓ top-level spire.enabled (kagenti chart) is distinct from components.spire.enabled at ~L744 (deps chart) — two different helm invocations, both legitimate

Follow-up feedback resolution

  • nit — explicit spire.enabled → ✅ addressed by 33bdb6c
  • suggestion — title overstated a "guide" → ✅ title trimmed to Feat(scripts): add --enable-spiffe-auth flag
  • suggestion — operator path is a no-op until a new OCI release → ✅ acknowledged; fixed on the next operator tag

CI: all green except "Deploy & Test", which is re-running on the new commit — and per my prior review that job fails on an unrelated cross-repo Python dependency conflict in kagenti-extensions@main, not this PR (which only edits a shell script).

Verdict: APPROVE — every point from my earlier review is now resolved. Nice and tidy.

Areas reviewed (delta): Shell, Helm value wiring (cross-repo verified). New commits: 1, signed-off (DCO green).

Alan-Cha added 3 commits July 13, 2026 15:37
…and SPIRE guard

- --enable-agent-spiffe-auth: sets authBridge.clientAuthType=federated-jwt
  so agent/tool workloads authenticate to Keycloak via SPIFFE JWT-SVID
  instead of pre-provisioned client secrets
- --enable-spiffe-auth: convenience shorthand that enables both operator
  and agent SPIFFE auth in one flag
- Guard: --enable-operator-spiffe-auth and --enable-agent-spiffe-auth both
  now fail immediately with a clear error if --with-spire is not set,
  rather than letting the bootstrap job fail silently at runtime

Signed-off-by: Alan Cha <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
…subchart

When --enable-operator-spiffe-auth is set:
- spiffe.enabled must also be set (the sidecar template requires both
  spiffe.enabled AND spiffe.operatorAuth.enabled)
- keycloak.publicUrl must be passed to the subchart explicitly (Helm
  subcharts do not inherit parent chart values; the subchart template uses
  it to derive the JWT audience for spiffe-helper)

Signed-off-by: Alan Cha <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
The _helpers.tpl guard fails the chart render when
authBridge.clientAuthType=federated-jwt but spire.enabled=false. Today
this is satisfied by the chart default (spire.enabled=true), but the
script never set it explicitly — a future default change would break
silently. Make the dependency self-documenting.

Signed-off-by: Alan Cha <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
@Alan-Cha
Alan-Cha force-pushed the feat/spiffe-auth-full branch from 33bdb6c to afb3b28 Compare July 13, 2026 19:37

@mrsabath mrsabath left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the shell changes to scripts/kind/setup-kagenti.sh (26 additions, 1 deletion). Small, well-gated, backward-compatible.

Verified against main in both repos:

  • All three new --set key paths resolve to real chart values: authBridge.clientAuthType (umbrella kagenti chart, consumed at values.yaml:320), kagenti-operator-chart.spiffe.enabled and kagenti-operator-chart.keycloak.publicUrl (operator chart values.yaml:204/:113), and top-level spire.enabled (umbrella values.yaml:470).
  • WITH_SPIRE guards run after arg-parse; the $(bool && echo … || echo …) ternary is set -e-safe in both branches.
  • bash -n clean; Shell Script Lint and all lint/chart/test checks pass; 3 commits, all signed-off.

Note: Deploy & Test is red, but the cause is unrelated to this PR — a Python dependency conflict in the weather example (langchain-core==1.4.8 → ResolutionImpossible, "AuthBridge Weather (advanced) E2E failed"). This PR touches no Python/requirements files. Worth resolving separately if that check is required for merge.

LGTM.

@Alan-Cha
Alan-Cha enabled auto-merge July 13, 2026 20:07
@Alan-Cha
Alan-Cha disabled auto-merge July 13, 2026 20:08
@Alan-Cha
Alan-Cha merged commit 6ba7a7b into main Jul 13, 2026
21 of 22 checks passed
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Jul 13, 2026
Alan-Cha added a commit that referenced this pull request Jul 15, 2026
Signed-off-by: Alan Cha <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready for Review! ready-for-ai-review Request automated AI code review from clawgenti

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants