Skip to content

chore(injector): remove unused JWTAudience field#373

Merged
huang195 merged 1 commit into
rossoctl:mainfrom
huang195:chore/remove-unused-jwt-audience
May 23, 2026
Merged

chore(injector): remove unused JWTAudience field#373
huang195 merged 1 commit into
rossoctl:mainfrom
huang195:chore/remove-unused-jwt-audience

Conversation

@huang195

Copy link
Copy Markdown
Member

Companion to kagenti-extensions#432 and kagenti#1653.

What

Remove the JWTAudience field from the webhook injector's NamespaceConfig and ResolvedConfig structs, and the line that read JWT_AUDIENCE from the authbridge-config ConfigMap. Pure dead-code removal:

  • cfg.JWTAudience = cm.Data["JWT_AUDIENCE"] was the only writer
  • A grep for \.JWTAudience returns zero readers — the value was parsed and never used

Why

The JWT_AUDIENCE env var was a vestige from when the legacy in-pod client-registration sidecar may have consumed it; that sidecar has long since been replaced by the operator's ClientRegistrationReconciler (which doesn't read it). The companion kagenti PR drops the env var from the chart's authbridge-config ConfigMap. After both PRs land, the env var is gone end-to-end.

The JWT-SVID client-assertion audience used by authbridge's tokenexchange plugin is now sourced per-tokenexchange-instance from the in-process SPIFFE provider config (kagenti-extensions#432's redesign), not via a cluster-wide env var.

Sequencing

This PR is fully orthogonal to the other two. It can land in any order:

  • Before kagenti#1653 (chart still sets JWT_AUDIENCE): operator stops reading a key that's still set. Harmless — empty struct field, nothing reads it.
  • After kagenti#1653 (chart no longer sets it): operator stops trying to read a key that's no longer set. cfg.JWTAudience becomes empty string regardless. Same outcome.
  • Independent of kagenti-extensions#432: this PR doesn't touch any volume mount, env var injection, or pod-spec modification. The new authbridge image reads SVIDs via the SPIRE agent socket (already mounted by volume_builder.go:38 at /spiffe-workload-api/spire-agent.sock) — no operator change needed for that.

What this PR does NOT touch (intentional)

  • spiffe-helper-config ConfigMap volume mount remains. Old authbridge images still consume it (helper.conf). New images ignore it. Cleanup eligible after all old-image deployments are gone.
  • SpiffeHelperConfigMapName constant + SpiffeHelperConf field remain — same backward-compat reason.
  • E2E fixtures (jwt_audience="kagenti" inside helper.conf TOML strings) remain.

Test plan

  • go build ./... clean (verified)
  • go test ./... — all 12 unit-test packages pass (E2E fails environmentally, looking for a Kind cluster named kind; same on main)
  • grep confirms zero remaining JWTAudience references in the codebase post-merge

Assisted-By: Claude Code

cfg.JWTAudience was parsed from authbridge-config ConfigMap's
JWT_AUDIENCE key but never read by anything else in the operator.
Pure dead code traced via grep — only writes (namespace_config.go,
resolved_config.go), zero reads.

The chart will stop emitting JWT_AUDIENCE in a companion PR; the
JWT-SVID assertion audience used by authbridge's token-exchange
plugin is now sourced per-tokenexchange-instance from the in-process
SPIFFE provider config, not a cluster-wide env var.

Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>
Signed-off-by: Hai Huang <huang195@gmail.com>

@pdettori pdettori 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 dead-code removal — verified via GitHub code search that JWTAudience has zero readers in the codebase (only the 4 lines being deleted). Companion PR sequencing is well-documented and orthogonal.

Areas reviewed: Go structs, config reading logic
CI: All 16 checks passing (E2E, unit, integration, lint, security)
Commit: Signed-off, good message explaining the rationale

@huang195
huang195 merged commit c90ef89 into rossoctl:main May 23, 2026
16 checks passed
@huang195
huang195 deleted the chore/remove-unused-jwt-audience branch May 23, 2026 12:05
@github-project-automation github-project-automation Bot moved this from New /:ToDo to Done in Kagenti Issue Prioritization May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants