Skip to content

docs: symmetric authentication guide covering client-secrets and SPIFFE - #2211

Merged
Alan-Cha merged 2 commits into
mainfrom
docs/refactor-authentication
Jul 15, 2026
Merged

Alan-Cha merged 2 commits into
mainfrom
docs/refactor-authentication

Conversation

@Alan-Cha

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

Copy link
Copy Markdown
Member

Summary

  • New file docs/authentication.md — comprehensive guide covering both Keycloak auth modes with equal depth:

    • Client secrets (default): admin credential provisioning, how the bootstrap Job and operator reconciler work, break-glass sync procedure
    • SPIFFE auth (recommended): JWT-SVID/Keycloak mechanics (RFC 7523 / custom jwt-spiffe assertion type), operator bootstrap job flow with diagram, agent flow with diagram, prerequisites (--with-spire, keycloak.publicUrl), setup-kagenti.sh flags, Helm values
    • Verification commands for both modes (operator logs, agent ConfigMap, token-exchange test)
    • Troubleshooting for both modes
  • docs/install.md — replaced the verbose "Keycloak Admin Credentials for Agent Namespaces" section (which described the old stale-credential mechanism) with a brief two-sentence summary that links to authentication.md

  • scripts/ocp/setup-kagenti.sh — removed orphaned KC_ADMIN_FLAGS block (keycloak.adminUsername/keycloak.adminPassword chart values don't exist in templates; the bootstrap Job reads credentials directly from the keycloak-initial-admin Secret)

Supersedes / Closes

Doc testing

The token exchange command in docs/authentication.md was verified against a running Kind cluster:

HTTP:200 with access_token

All grep patterns (operator logs, agent ConfigMap, credential secret listing) were verified against actual cluster output.

Test plan

  • Read docs/authentication.md end-to-end — both sections have equivalent depth and no gaps
  • Verify install.md Keycloak section links correctly to authentication.md
  • Confirm scripts/ocp/setup-kagenti.sh helm upgrade still works (no orphaned flags)

Assisted-By: Claude Code

…n.md

- Create docs/authentication.md covering both auth modes with equal depth:
  - Client secrets (default): admin credential flow, provisioning,
    break-glass sync, how-it-works diagram
  - SPIFFE auth (recommended): JWT-SVID/Keycloak mechanics, operator
    bootstrap job flow, agent flow, prerequisites, Helm values
  - Shared sections: verification commands for both modes, troubleshooting

- Simplify docs/install.md: replace the verbose
  'Keycloak Admin Credentials for Agent Namespaces' section with a
  two-sentence summary that links to authentication.md

- scripts/ocp/setup-kagenti.sh: remove orphaned KC_ADMIN_FLAGS block
  (keycloak.adminUsername / keycloak.adminPassword chart values do not
  exist in templates; the bootstrap Job reads credentials directly from
  the keycloak-initial-admin Secret)

Supersedes PR #2155 and PR #2208.

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

@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.

Review

Verified every technical claim in docs/authentication.md against kagenti/kagenti@main and kagenti/kagenti-operator@main (chart values, the agent-oauth-secret-job template + its Python source, the setup-kagenti.sh flags, and the operator's client-registration code). Most of the doc is accurate. Two related claims about where keycloak-admin-secret comes from are wrong, and they undercut the PR's own goal — #2155 was literally "fix stale keycloak-admin-secret docs."

Verified accurate (no changes needed): the three setup-kagenti.sh flags + fail-without---with-spire behavior; keycloak.adminSecretName/adminUsernameKey/adminPasswordKey values exist; the operator's kagenti-keycloak-client-credentials-* naming used in the verification greps; and the removal of the non-existent keycloak.adminUsername/adminPassword/adminExistingSecret from install.md and the script is correct.

Areas reviewed: Docs (authentication.md, install.md), Shell (setup-kagenti.sh), cross-repo source verification.
Commits: 1 commit, signed-off: yes (DCO passing).
CI status: passing (Deploy & Test pending at review time).

Two must-fix accuracy issues inline. Fixes are small (2 paragraphs).

Minor (non-blocking, no inline): the body's Closes #2155/Closes #2208 reference already-closed PRs, not open issues, so they're no-ops — consider "Supersedes" wording only.

Comment thread docs/authentication.md Resolved
Comment thread docs/authentication.md Resolved
- Step 1: the agent-oauth-secret-job creates kagenti-keycloak-client-secret
  in each agent namespace, not keycloak-admin-secret in kagenti-system
- Step 2: operator reads keycloak-initial-admin directly, not via an
  intermediate secret
- Remove incorrect break-glass procedure (recreating keycloak-admin-secret
  and re-running helm upgrade had no effect on the data flow); replace with
  operator restart + log verification

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

Copy link
Copy Markdown
Member Author

Both must-fix comments addressed in c4f1e7d:

Comment 1 (line 20): Step 1 now correctly says the kagenti-agent-oauth-secret-job creates kagenti-keycloak-client-secret in each agent namespace. Step 2 clarifies the operator reads keycloak-initial-admin directly — there is no intermediate keycloak-admin-secret step.

Comment 2 (line 56): The break-glass section has been replaced with an operator restart + log verification. The incorrect kubectl create secret keycloak-admin-secret command and the false claim that a helm upgrade re-run triggers the job have both been removed.

On the minor note about Closes #2155/Closes #2208 in the body — agreed, those are no-ops since both PRs were already closed. Updated the wording to "Supersedes" in an earlier edit.

@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-review — both must-fix items addressed ✅

Commit c4f1e7d fixes both accuracy issues from my prior review, and I verified each fix against the actual code:

  1. Client-secrets "How it works" (step 1 & 2) — now correctly states the kagenti-agent-oauth-secret-job creates kagenti-keycloak-client-secret per agent namespace (matches kagenti/auth/agent-oauth-secret/agent_oauth_secret.py), and that the ClientRegistrationReconciler reads keycloak-initial-admin directly (matches kagenti-operator/internal/controller/clientregistration_controller.go:46,100). The stale keycloak-admin-secret in kagenti-system claim is gone.

  2. Break-glass — rewritten to kubectl rollout restart deployment/kagenti-controller-manager -n kagenti-system + a log-based verify, so it re-reads keycloak-initial-admin via the operator. Deployment name confirmed in operator manager.yaml (kagenti-controller-manager); correct data flow.

No new inaccuracies introduced; the rest of the PR is unchanged and was already verified accurate (setup-kagenti.sh SPIFFE flags, keycloak.adminSecretName/key values, operator kagenti-keycloak-client-credentials-* naming, and removal of the non-existent keycloak.adminUsername/adminPassword/adminExistingSecret).

CI: passing (Deploy & Test pending at review time). Commits: 2, signed-off (DCO passing). LGTM.

@Alan-Cha
Alan-Cha merged commit 0e82e45 into main Jul 15, 2026
24 checks passed
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Jul 15, 2026
@pdettori
pdettori deleted the docs/refactor-authentication branch July 15, 2026 15:31
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.

bug: keycloak-admin-secret in agent namespaces uses stale credentials after RHBK operator upgrade

2 participants