Repository navigation
Spiffe keycloak consolidation - #966
Conversation
6b8a792 to
64281ae
Compare
mrsabath
left a comment
There was a problem hiding this comment.
Review Summary
Large feature PR adding SPIFFE-based federated JWT authentication with Keycloak. Well-structured with proper credential handling (reads from K8s Secrets), retry logic, and backward compatibility (default remains client-secret). All CI checks pass including Deploy & Test.
Key concerns: SPIFFE_IDP_FIXES.md is a development artifact that should not be committed at the repo root, Dockerfile should use a non-root user, and the new kagenti-webhook-config ConfigMap should be coordinated with the ConfigMap consolidation in kagenti-extensions PR #233.
Areas reviewed: Python, Helm/K8s, Ansible, Dockerfile, CI, Docs, Security
Commits: 14 commits, all signed-off: yes
CI status: all checks passing (Deploy & Test included)
🤖 Reviewed with Claude Code
163007a to
01dbd89
Compare
| @@ -0,0 +1,22 @@ | |||
| # Dockerfile for SPIFFE Identity Provider Setup Job | |||
| FROM python:3.12-slim | |||
Check warning
Code scanning / Scorecard
Pinned-Dependencies Medium
|
|
||
| # Copy requirements and install dependencies | ||
| COPY requirements.txt . | ||
| RUN pip install --no-cache-dir -r requirements.txt |
Check warning
Code scanning / Scorecard
Pinned-Dependencies Medium
|
@Alan-Cha do you think you can rebase this PR? I am testing it on OpenShift and trying to do the required adaptations so it works ouf of the box, but I am not succeeding yet. Maybe a rebase could help. |
01dbd89 to
d143fd7
Compare
|
@akram I was able to rebase the PR. Could you review for me again? I've also tested it and it works on my end. |
91446e6 to
4951209
Compare
maia-iyer
left a comment
There was a problem hiding this comment.
Some preliminary comments. Also it appears there are merge conflicts currently?
maia-iyer
left a comment
There was a problem hiding this comment.
Additional comments from Claude
maia-iyer
left a comment
There was a problem hiding this comment.
I have tested this and it works for configuring keycloak to trust spire
I have also tested a deployment that authenticates to keycloak with SPIRE credentials, adn that works.
What remains is to test with AuthBridge
|
@Alan-Cha @maia-iyer - seems all comments are addressed - do you recommend the testing with AuthBridge before merging or this can be merged (still needs rebase though) |
|
I will rebase. I think we can merge. These features are disabled by default anyway. |
Signed-off-by: Alan Cha <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
…admin username password Signed-off-by: Alan Cha <[email protected]>
agenti-webhook-config with environments configmap Signed-off-by: Alan Cha <[email protected]>
- Update Keycloak version from 26.3.3 to 26.5.2 - Enable KC_FEATURES: client-auth-federated:v1,spiffe:v1 - Update preload-images.txt for faster Kind startup This restores the missing changes from commit ed04fdd that were lost during the rebase. Keycloak 26.5.2 includes native SPIFFE support via federated-jwt authentication. Signed-off-by: Alan Cha <[email protected]>
The SPIFFE IdP setup job's init container needs permission to list pods in the Keycloak namespace to wait for Keycloak to be ready. This adds a Role and RoleBinding in the Keycloak namespace to grant the kagenti-spiffe-idp-setup ServiceAccount read access to pods. Without this RBAC, the init container fails with: Error from server (Forbidden): pods is forbidden: User "system:serviceaccount:kagenti-system:kagenti-spiffe-idp-setup" cannot list resource "pods" in API group "" in the namespace "keycloak" Related: Existing RBAC already grants access to SPIRE namespace pods. Signed-off-by: Alan Cha <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
- Delete charts/kagenti-deps/templates/spiffe-idp-setup-job.yaml.disabled This template was disabled because Ansible now handles SPIFFE IdP setup directly (avoiding race conditions). Keeping disabled templates causes confusion for maintainers. - Remove PR rossoctl#233 reference from agent-namespaces.yaml comment Internal PR references don't belong in template comments. Both changes improve code clarity without affecting functionality. Signed-off-by: Alan Cha <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
Break long logger.error line to comply with line length limits. Signed-off-by: Alan Cha <[email protected]>
Update requests from 2.32.5 to 2.33.0 to fix GHSA-gc5v-m9x4-r6x2 (Insecure Temp File Reuse in extract_zipped_paths() utility function). Addresses dependency-review-action moderate severity finding. Signed-off-by: Alan Cha <[email protected]>
43b9ca2 to
bcf6db9
Compare
Signed-off-by: Alan Cha <[email protected]>
maia-iyer
left a comment
There was a problem hiding this comment.
re-approving after rebase; all features are default off
Configure SPIRE and Keycloak for Federated JWT Authentication
Fixes #106
Replaces #769
This PR configures the Kagenti platform to support SPIFFE-based federated JWT authentication with Keycloak, enabling workload identity without client secrets.
This PR should maintain the original behavior of using client secrets. Federated client authentication can be enabled if desired.
Changes
SPIRE Configuration
JWT TTL set to 5 minutes for Keycloak compatibility
spire-server.controllerManager.identities.clusterSPIFFEIDs.default.jwtTTLSPIFFE OIDC Discovery Provider configured with
set_key_use: trueKeycloak Integration
spire-spiffe(configurable viaauthBridge.spiffeIdpAlias)ConfigMap Architecture
Added
kagenti-webhook-configConfigMap to agent namespacesCLIENT_AUTH_TYPE: Controls authentication mode (client-secretorfederated-jwt)SPIFFE_IDP_ALIAS: Keycloak IdP alias for SPIFFE validationJWT_AUDIENCE: Expected audience for JWT-SVID validationConsolidated Keycloak connection config in
environmentsConfigMapKEYCLOAK_URLandKEYCLOAK_REALMmoved from webhook configHelm Chart Updates
agent-namespaces.yamltemplate updated with new ConfigMapsauthBridge.clientAuthType,authBridge.spiffeIdpAliasclient-secretfor backward compatibilityConfiguration
To enable federated JWT authentication, set in
values.yaml: