Repository navigation
fix: move Keycloak admin secret to kagenti-system and remove client-registration sidecar references - #1422
Conversation
|
✅ Addressed feedback: 1. Made namespace configurableAdded 2. Clarified client registration flagsThe Helm chart already uses Changes in this PR:
See kagenti-operator#321 for the operator-side flag simplification. |
|
🔄 Simplified namespace configuration based on feedback. You're right - there's no need for a new Changed:
This is consistent with all other templates in the chart (api-oauth-secret, authbridge-template-configmaps, etc.) that use |
|
✅ Helm chart validation - tests pass successfully. Validation performed:
The chart templates correctly, creating the |
|
✅ Terminology consistency - changed 'operator-based' to 'operator-managed' Updated values.yaml comment to use consistent terminology with the operator codebase. |
|
@Alan-Cha needs rebase |
This commit addresses security issue rossoctl#320 by changing the client registration controller to read Keycloak admin credentials from the kagenti-system namespace instead of from each agent namespace. Security improvement: - Operator now reads keycloak-admin-secret from kagenti-system only - Agent namespaces no longer have access to Keycloak admin credentials - Prevents compromised agent namespace from gaining realm admin access Changes: - Add operatorNamespace constant set to "kagenti-system" - Update secret read to use operatorNamespace instead of agent namespace - Update comments to clarify secret location and security model The operator already has ClusterRole permissions for cluster-wide secret access, so no RBAC changes are needed. **Deployment sequence:** This PR should be merged AFTER rossoctl/rossoctl#1422 is merged and deployed to ensure the secret exists in kagenti-system before the operator tries to read it. Closes: rossoctl#320 Related: rossoctl/rossoctl#1422 Signed-off-by: Alan Cha <[email protected]>
…erator-managed client registration ## Problem kagenti-operator 0.2.0-alpha.36 (required by PR rossoctl#1507 for the per- plugin authbridge cutover) moved the ClientRegistrationReconciler to read keycloak-admin-secret from the OPERATOR namespace rather than from each agent namespace. Commit f5df832 in the operator repo was merged explicitly gated on this companion chart change — the commit message says: "This PR should be merged AFTER kagenti#1422 is merged and deployed to ensure the secret exists in kagenti-system before the operator tries to read it." kagenti#1422 is open, not merged. Without the admin secret in the operator namespace, the reconciler logs "waiting for keycloak-admin- secret" forever, never registers the Keycloak client for agent workloads, and envoy-proxy polls /shared/client-id.txt indefinitely. Every inbound request returns 503 with "identity not yet configured (credentials pending)". This is invisible on Kind because the advanced E2E weather workloads opt into the legacy sidecar path via kagenti.io/client-registration- inject=true — that path writes the credential files directly and bypasses the operator entirely. On HyperShift / OpenShift the baseline weather-service has no such label, so operator-managed registration is the only path, and it was stuck. ## Evidence (from CI run 25553345293) weather-service pod: 3/3 Running (agent + envoy-proxy + spiffe-helper, NO client-registration sidecar — correct, since label not set) envoy-proxy stderr: msg="credential file still not available" path=/shared/client-id.txt waited=11m0s msg="pipeline: plugin rejected request" plugin=jwt-validation status=503 reason="identity not yet configured (credentials pending)" operator log (repeats every reconcile): msg="waiting for keycloak-admin-secret" namespace=kagenti-system (← looks here, finds nothing) pod-mutator: "deliveryPaths":"skip","keycloakClientCredentialsSecretName":"", "injectClientRegistrationSidecar":false ## Fix Add a new template that creates keycloak-admin-secret in Release.Namespace (= kagenti-system in production installs). Sister to the existing per-agent-namespace secret in agent-namespaces.yaml. Both are needed today: the legacy sidecar path reads from the agent namespace; the operator-managed path reads from the operator namespace. Respects the existing keycloak.adminExistingSecret opt-out — when the operator provides a pre-created secret, we skip creating either. ## Why minimal vs. waiting for rossoctl#1422 rossoctl#1422 does a broader reshape (removes client-registration sidecar references, restructures agent-namespaces.yaml). That PR is open and unreviewed. This commit is the minimal change PR rossoctl#1507 needs to unblock operator-managed client registration; it cleanly stacks with rossoctl#1422 when that lands (both target the same file set but additive). Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
425d394 to
931b643
Compare
mrsabath
left a comment
There was a problem hiding this comment.
The security improvement (centralizing Keycloak admin credentials in the operator namespace) and flag consolidation (--enable-client-registration=true) are well done and match the agreed direction from prior review discussion. Documentation updates are thorough.
Blocking issue: The Deploy & Test CI is failing because the AuthBridge Weather E2E test (from kagenti-extensions) still checks for keycloak-admin-secret in the team1 agent namespace:
✗ Secret 'keycloak-admin-secret' not found in namespace 'team1'.
✗ The installer usually creates it in agent namespaces.
This test needs to be updated to either:
- Check for the secret in
kagenti-system(the release namespace) instead, or - Skip the secret existence check entirely (since the operator reads it internally), or
- Land a kagenti-extensions fix first that updates the E2E script.
The operator controller log also shows waiting for keycloak-admin-secret — confirm the operator image used in CI already has the OperatorNamespace support (reads from its own namespace rather than agent namespaces).
Areas reviewed: Helm/K8s, Docs, Security
Commits: 4 commits, all signed-off
CI status: Deploy & Test FAILING
cwiklik
left a comment
There was a problem hiding this comment.
Review Summary
Well-structured security improvement moving Keycloak admin credentials from agent namespaces to the operator namespace. The Helm template change is correct (uses .Release.Namespace), docs are thoroughly updated, and the operator on main already expects this layout (OperatorNamespace field reads secret from its own namespace).
Blocker: The "Deploy & Test" CI fails because the AuthBridge E2E test script checks for keycloak-admin-secret in team1 namespace. With this PR the secret only exists in kagenti-system. The test assertion needs updating.
Areas reviewed: Helm/K8s, YAML, Docs, CI failure analysis, security, commit conventions
Commits: 4, all signed-off
CI: Deploy & Test FAIL (outdated E2E assertion), all others pass
Nits (non-blocking):
--enable-client-registration=truein values.yaml is redundant — the operator onmaindefaults this totrue. Harmless but noisy.- PR body footer says "Generated with Claude Code" — repo convention is "Assisted-By: Claude Code"
…egistration sidecar references This commit addresses security issue kagenti-operator#320 by moving Keycloak admin credentials from agent namespaces to the kagenti-system namespace, preventing compromised agent namespaces from gaining full Keycloak realm admin access. Changes: - Create new keycloak-admin-secret template for kagenti-system namespace - Remove keycloak-admin-secret creation from agent namespaces - Remove client-registration sidecar image references (sidecar is sunset) - Update comments to reflect operator-based client registration - Update Ansible deployment comments The client-registration sidecar is being sunset. Client registration is now handled by the kagenti-operator controller, which will read the secret from kagenti-system after the corresponding operator PR is merged. Refs: kagenti-operator#320 Signed-off-by: Alan Cha <[email protected]>
…tation Updates documentation to reflect that Keycloak client registration is now handled by the kagenti-operator's ClientRegistrationReconciler controller rather than an injected sidecar. Changes: - docs/design-proposals/consolidated-compositional-agent-platform-design.md: Updated injected components table and sidecar consolidation section - docs/authbridge-combined-sidecar.md: Removed client-registration from legacy and combined modes, added note about operator-managed registration - docs/identity-guide.md: Replaced client registration flow diagrams with description of operator-managed approach, updated code examples - docs/components.md: Updated Auth Bridge components table and architecture diagram to show operator-managed registration Relates to kagenti-operator#320 Signed-off-by: Alan Cha <[email protected]>
Updates the AuthBridge Weather E2E test to look for keycloak-admin-secret in kagenti-system namespace (operator namespace) instead of team1 (agent namespace). This aligns with the security improvement where Keycloak admin credentials are centralized in the operator namespace. Also removes redundant --enable-client-registration=true flag since the operator defaults to true. Fixes CI failure in Deploy & Test workflow. Assisted-By: Claude Code Signed-off-by: Alan Cha <[email protected]>
E2E HyperShift Tests FailedCommit: To re-run tests after fixing issues, comment |
huang195
left a comment
There was a problem hiding this comment.
Summary
Solid security improvement — moving admin credentials out of agent namespaces and consolidating on the operator controller is the right direction, and pdettori's earlier RCA (operator needed rc.2) has been addressed.
Blocking for merge:
-
CI is red on HEAD.
Deploy & Testfails with:error mounting ".../kagenti-keycloak-client-credentials-<hash>/envoy-proxy/5" to rootfs at "/shared/client-secret.txt": make mountpoint "/shared/client-secret.txt": read-only file systemWeather-service pod never reaches Ready (0/1 replicas), three downstream E2E tests fail. Operator
rc.2is now being used, so this is a new failure mode specific to how the operator projects per-workload credentials into the pod's shared-data volume. Needs RCA before merge. -
Sandbox coverage gap (inline #1). Operator's
clientregistrationcontroller only watchesDeployments. Sandbox-based agents (the default write path for Sandbox manifests today) get silently skipped — no Keycloak client registered, no credentials delivered, envoy 503 on every request. This PR removes the fallback sidecar without a safety net for Sandboxes. -
Dangling references to the sunset sidecar in scripts/docs not touched by this PR — some are actively breaking CI (matches
error: container kagenti-client-registration is not valid for pod weather-service-...in the Deploy & Test log):.github/scripts/common/99-collect-logs.sh:30.github/scripts/hypershift/ci/85-collect-failure-info.sh:80.github/scripts/token-exchange/50-enable-kagenti-ns.sh:273-277(still createskeycloak-admin-secretin the target namespace).github/scripts/common/87-setup-test-credentials.sh:263-278(still probeskeycloak-admin-secretinteam1)docs/demos/demo-{file-organizer,generic,image,slack-research}-agent.md(staleDefaulted container ... kagenti-client-registrationoutput in example snippets)
Fine to split into a follow-up PR, but the CI-breaking ones (
99-collect-logs.sh,85-collect-failure-info.sh) should go here to keep CI signal intact.
Areas reviewed: Helm charts, CI scripts, docs, operator/sidecar version pins
Commits: 8 commits, all Signed-off-by: yes
CI status: failing (Deploy & Test + E2E HyperShift)
Assisted-By: Claude (Anthropic AI) [email protected]
Dismissing to re-submit — corrected factual error re: operator Sandbox coverage (rc.2 does watch Sandboxes).
huang195
left a comment
There was a problem hiding this comment.
(Re-submitting — my previous review incorrectly claimed operator-managed client registration doesn't cover Sandboxes. v0.2.0-rc.2 conditionally watches Sandboxes via clientregistration_controller.go:504 (if SandboxCRDExists ... b.Watches(sandboxObj, ...)). I was extrapolating from an alpha.36 cluster. Apologies for the noise.)
Summary
Solid security improvement — moving admin credentials out of agent namespaces and consolidating on the operator controller is the right direction, and pdettori's earlier RCA (operator needed rc.2) has been addressed.
Still blocking for merge:
-
CI is red on HEAD.
Deploy & Testfails with:error mounting ".../kagenti-keycloak-client-credentials-<hash>/envoy-proxy/5" to rootfs at "/shared/client-secret.txt": make mountpoint "/shared/client-secret.txt": read-only file systemWeather-service pod never reaches Ready (0/1 replicas); three downstream E2E tests fail. The failing workload is a Deployment (weather-service), so this isn't a Sandbox coverage issue — it's the operator projecting per-workload Keycloak credentials (
kagenti-keycloak-client-credentials-<hash>) into the pod's shared-data volume via subPath mount, and the subPath mountpoint is landing on a read-only filesystem. Needs RCA before merge — could be a volume-ordering issue betweenproxy-init,spiffe-helper, and the credentials projection. -
Dangling references to the sunset sidecar in scripts/docs not touched by this PR — some are actively breaking CI (matches
error: container kagenti-client-registration is not valid for pod weather-service-...in the Deploy & Test log):.github/scripts/common/99-collect-logs.sh:30.github/scripts/hypershift/ci/85-collect-failure-info.sh:80.github/scripts/token-exchange/50-enable-kagenti-ns.sh:273-277(still createskeycloak-admin-secretin the target namespace).github/scripts/common/87-setup-test-credentials.sh:263-278(still probeskeycloak-admin-secretinteam1)docs/demos/demo-{file-organizer,generic,image,slack-research}-agent.md(staleDefaulted container ... kagenti-client-registrationoutput in example snippets)
Fine to split into a follow-up PR, but the CI-breaking ones (
99-collect-logs.sh,85-collect-failure-info.sh) should go here to keep CI signal intact.
Areas reviewed: Helm charts, CI scripts, docs, operator/sidecar version pins
Commits: 8 commits, all Signed-off-by: yes
CI status: failing (Deploy & Test + E2E HyperShift)
Assisted-By: Claude (Anthropic AI) [email protected]
New Commits DetectedThe New HEAD: For maintainers: Please review the new changes and comment Security checklistBefore running E2E tests, verify the PR does NOT contain:
This is an automated security measure to prevent TOCTOU attacks |
Addressing huang195's Review Feedback✅ Script fixes committed in c8e4dab Fixed all 4 dangling sidecar references that were breaking CI:
Mount Error RCARegarding the blocking CI failure (mount error), I've completed a root cause analysis: The ErrorRoot CauseThis is a bug in operator v0.2.0-rc.2, not this PR: File: The envoy-proxy container mounts volumeMounts := []corev1.VolumeMount{
{
Name: "shared-data",
MountPath: "/shared",
ReadOnly: true, // ← PROBLEM
},
}But operator rc.2 added Kubernetes requires write access to the parent mount ( Evidence This PR's Changes Are CorrectThe operator logs show successful client registration: {"msg":"operator client registration applied",
"namespace":"team1",
"secret":"kagenti-keycloak-client-credentials-afc9214afa847a6e"}This proves:
Your PR's security fix works perfectly. The mount error is a separate operator bug. Affects Both Platforms
This is a code bug in the operator, not environment-specific. SolutionOperator team needs to fix - ReadOnly: true,
+ ReadOnly: false,This allows Kubernetes to create subPath mountpoint files. (envoy-proxy doesn't actually write to RecommendationI suggest merging this PR with a merge waiver for the CI failures because:
I can file an issue in kagenti-operator with the mount error RCA if helpful. Assisted-By: Claude Code |
Addresses huang195's review feedback - removes references to the sunset kagenti-client-registration sidecar that were breaking CI log collection. Changes: 1. 99-collect-logs.sh: Replace sidecar log collection with note 2. 85-collect-failure-info.sh: Same for HyperShift CI 3. 50-enable-kagenti-ns.sh: Remove keycloak-admin-secret creation in agent namespaces (now managed by operator in kagenti-system) 4. 87-setup-test-credentials.sh: Update secret probe to check kagenti-system instead of team1 Client registration is now handled by the operator controller, which reads keycloak-admin-secret from kagenti-system namespace (this PR's security improvement). Assisted-By: Claude Code Signed-off-by: Alan Cha <[email protected]>
c8e4dab to
424f1eb
Compare
1. Chart.yaml: Remove trailing blank line (YAML lint) 2. agent-namespaces.yaml: Add legacy context about sidecar credential replication (kagenti-operator#321 reference) 3. values.yaml: Fix sidecar version incompatibility - Change v0.5.0-rc.1 → v0.5.0-alpha.14 (26 commits ahead) - rc.1 missing per-plugin config support (extensions#378) - rc.1 missing keycloak_url/keycloak_realm (extensions#383) - Required for operator v0.2.0-rc.2 compatibility Note: OPERATOR_NAMESPACE already documented in 91-run-authbridge-weather-e2e.sh:22 Assisted-By: Claude Code Signed-off-by: Alan Cha <[email protected]>
1. Chart.yaml: Remove trailing blank line (YAML lint) 2. agent-namespaces.yaml: Add legacy context about sidecar credential replication (kagenti-operator#321 reference) 3. values.yaml: Fix sidecar version incompatibility - Change v0.5.0-rc.1 → v0.5.0-alpha.14 (26 commits ahead) - rc.1 missing per-plugin config support (extensions#378) - rc.1 missing keycloak_url/keycloak_realm (extensions#383) - Required for operator v0.2.0-rc.2 compatibility Note: OPERATOR_NAMESPACE already documented in 91-run-authbridge-weather-e2e.sh:22 Operator stays at v0.2.0-rc.2 (latest, 11 commits ahead of alpha.36). Assisted-By: Claude Code Signed-off-by: Alan Cha <[email protected]>
c0eee7c to
46fc20c
Compare
Update to latest releases: - Operator: v0.2.0-rc.2 → v0.2.0-rc.3 - Adds test fixes and audience mapper error propagation - 8 commits ahead (operator#350, #352) - Sidecars: v0.5.0-alpha.14 → v0.5.0-rc.2 - Latest release candidate with all required features - Includes per-plugin config and keycloak_url/keycloak_realm support These are the latest stable versions compatible with the keycloak-admin-secret namespace move in this PR. Assisted-By: Claude Code Signed-off-by: Alan Cha <[email protected]>
…ence - Rename section from 'Keycloak Admin Credentials for Agent Namespaces' to 'Keycloak Client Registration' to reflect the actual mechanism - Add mode comparison table: client secrets (default) vs SPIFFE auth (recommended) with link to spiffe-keycloak-auth.md - Remove stale reference to 'AuthBridge client-registration sidecar' (removed in #1422) - Replace generic security note with concrete SPIFFE recommendation Signed-off-by: Alan Cha <[email protected]> Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Alan Cha <[email protected]>
Summary
Addresses security issue in kagenti-operator#320 by:
Changes
Security Improvement
keycloak-admin-secretinkagenti-systemnamespace (operator namespace)keycloak-admin-secretfrom agent namespaces (team1, team2, etc.)Cleanup
clientRegistrationimage references from values.yaml (sidecar sunset)Impact
Related PRs
This PR must be merged and deployed BEFORE the operator PR:
Migration Instructions
After both PRs are merged and deployed:
# Manually clean up old secrets from agent namespaces kubectl delete secret keycloak-admin-secret -n team1 kubectl delete secret keycloak-admin-secret -n team2Testing
Related Issues
Assisted-By: Claude Code