Repository navigation
Conversation
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]>
| image: quay.io/keycloak/keycloak:26.3.3 | ||
| image: quay.io/keycloak/keycloak:26.5.2 | ||
| args: ["start"] | ||
| env: | ||
| - name: KC_FEATURES | ||
| value: "client-auth-federated:v1,spiffe:v1" |
There was a problem hiding this comment.
Update Keycloak and enable features for federated auth
|
|
||
| v1 = client.CoreV1Api() | ||
|
|
||
| logger.info(f"Reading credentials from Secret: {KEYCLOAK_NAMESPACE}/{KEYCLOAK_ADMIN_SECRET_NAME}") |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High
|
|
||
| except ApiException as e: | ||
| logger.error(f"❌ Failed to read Secret: {e}") | ||
| logger.error(f"Ensure Secret exists: kubectl get secret -n {KEYCLOAK_NAMESPACE} {KEYCLOAK_ADMIN_SECRET_NAME}") |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: kagenti-webhook-config | ||
| namespace: {{ . }} | ||
| labels: | ||
| {{- include "kagenti.labels" $root | nindent 4 }} | ||
| data: | ||
| SPIRE_ENABLED: "{{ $root.Values.spire.enabled }}" | ||
| KEYCLOAK_URL: "{{ $root.Values.keycloak.url }}" | ||
| KEYCLOAK_REALM: "{{ $root.Values.keycloak.realm }}" | ||
| KEYCLOAK_NAMESPACE: "{{ $root.Values.keycloak.namespace }}" | ||
| KEYCLOAK_ADMIN_SECRET_NAME: "{{ $root.Values.keycloak.adminSecretName }}" | ||
| KEYCLOAK_ADMIN_USERNAME_KEY: "{{ $root.Values.keycloak.adminUsernameKey }}" | ||
| KEYCLOAK_ADMIN_PASSWORD_KEY: "{{ $root.Values.keycloak.adminPasswordKey }}" | ||
| CLIENT_AUTH_TYPE: "{{ $root.Values.authBridge.clientAuthType }}" | ||
| SPIFFE_IDP_ALIAS: "{{ $root.Values.authBridge.spiffeIdpAlias }}" | ||
| JWT_AUDIENCE: "{{ $root.Values.keycloak.publicUrl }}/realms/{{ $root.Values.keycloak.realm }}" |
There was a problem hiding this comment.
Configmap that stores various data for client auth in each agent namespace, which now also requires various new fields for federated auth.
This didn't exist before? This confuses me. How does AuthBridge work without this configmap being automatically created? For the GitHub demo, we do the following:
The old config doesn't have admin credentials. How is client auth getting these credentials then? It's getting the credentials from a secret?
TODO: Remove client admins from here
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: kagenti-webhook-config |
There was a problem hiding this comment.
I thought the metadata used to be environments? Did I rename it to kagenti-webhook-config? What is authbridge-config from https://github.com/kagenti/kagenti-extensions/blob/main/AuthBridge/demos/github-issue/k8s/configmaps.yaml
| jwt_svids = [{jwt_audience="kagenti", jwt_svid_file_name="/opt/jwt_svid.token"}] | ||
| # jwt_audience MUST match Keycloak's issuer URL exactly (use publicUrl, not internal url) | ||
| # The JWT-SVID's aud claim must match the "iss" claim in tokens issued by Keycloak | ||
| jwt_svids = [{jwt_audience="{{ $root.Values.keycloak.publicUrl }}/realms/{{ $root.Values.keycloak.realm }}", jwt_svid_file_name="/opt/jwt_svid.token"}] |
There was a problem hiding this comment.
The jwt_audience really matters now. It used to be an invalid value kagenti. If the jwt_audience doesn't match, federated auth will fail
| # CLIENT_AUTH_TYPE: Controls how Keycloak clients authenticate | ||
| # - "client-secret": Traditional client_secret authentication (default) | ||
| # - "federated-jwt": JWT-SVID authentication via SPIFFE identity provider | ||
| # For federated-jwt, you must configure a SPIFFE identity provider in Keycloak | ||
| clientAuthType: "client-secret" |
There was a problem hiding this comment.
What should the default clientAuthType be? Right now it's set to client-secret. I think this makes sense for now but how do we transition to federated-jwt?
| - name: Create RoleBinding for SPIFFE IdP setup (Keycloak secrets) | ||
| kubernetes.core.k8s: | ||
| state: present | ||
| definition: | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: RoleBinding | ||
| metadata: | ||
| name: kagenti-spiffe-idp-keycloak-reader | ||
| namespace: "{{ kagenti_deps_values.keycloak.namespace }}" | ||
| labels: | ||
| app.kubernetes.io/managed-by: ansible | ||
| app.kubernetes.io/part-of: kagenti | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: kagenti-spiffe-idp-setup | ||
| namespace: "{{ (charts['kagenti-deps'] | default({})).get('namespace', 'kagenti-system') }}" | ||
| roleRef: | ||
| kind: ClusterRole | ||
| name: kagenti-spiffe-idp-reader | ||
| apiGroup: rbac.authorization.k8s.io | ||
|
|
||
| - name: Create Role for SPIFFE IdP setup (SPIRE pod reading) | ||
| kubernetes.core.k8s: | ||
| state: present | ||
| definition: | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: Role | ||
| metadata: | ||
| name: kagenti-spiffe-idp-pod-reader | ||
| namespace: "{{ charts.spire.server_namespace }}" | ||
| labels: | ||
| app.kubernetes.io/managed-by: ansible | ||
| app.kubernetes.io/part-of: kagenti | ||
| rules: | ||
| - apiGroups: [""] | ||
| resources: ["pods"] | ||
| verbs: ["get", "list", "watch"] |
There was a problem hiding this comment.
Requires creating roles for checking the status of SPIFFE components and roles for reading Keycloak admin credential secrets
Signed-off-by: Alan Cha <[email protected]>
| logger.info(f"1. Set authBridge.clientAuthType: 'federated-jwt' in values.yaml") | ||
| logger.info(f"2. Deploy agents - they will automatically use JWT-SVID authentication") |
There was a problem hiding this comment.
These logs don't make any sense because nobody will see them and follow these instructions unless they're debugging.
| enabled: false | ||
| namespace: spire-mgmt | ||
| namespace: spire-mgmt # Helm release namespace | ||
| server_namespace: spire-server # Actual SPIRE server component namespace |
There was a problem hiding this comment.
The SPIRE namespace seems to be all over the place.
Should it be spire-server or should it be zero-trust-workload-identity-manager?
There was a problem hiding this comment.
Some context from Claude:
The namespace name comes from Red Hat OpenShift's ZTWIM (Zero Trust Workload Identity Manager) operator.
Key Historical Context:
October 2025 - Commit a314dd8 "split main kagenti chart in dependencies and kagenti chart"
Introduced spire.namespace: zero-trust-workload-identity-manager in kagenti-deps/values.yaml:160
November 2025 - Commit e9ddb67 "update kagenti chart to support ZTWIM operator in OCP"
Added support for OpenShift's ZTWIM operator which provides managed SPIRE installation
The operator is called openshift-zero-trust-workload-identity-manager
February 2026 - Commit d49ccd4 "Remove spire namespace to simply Tornjak support"
Removed namespace creation from kagenti-deps chart
The namespace is now owned and created by either:
OpenShift (OCP 4.19+): ZTWIM operator installs into zero-trust-workload-identity-manager
Kubernetes/older OpenShift: Upstream SPIRE Helm chart creates the namespace
Why This Namespace Name?
The namespace zero-trust-workload-identity-manager matches the OpenShift operator name openshift-zero-trust-workload-identity-manager. OpenShift's ZTWIM operator is Red Hat's enterprise-supported distribution of SPIRE for OpenShift 4.19+.
For consistency across OpenShift and Kubernetes deployments, the Kagenti team chose to use the same namespace name (zero-trust-workload-identity-manager) for both platforms, even though:
On Kubernetes: The upstream SPIRE Helm chart traditionally uses spire-server
On OpenShift 4.19+: The ZTWIM operator enforces zero-trust-workload-identity-manager
This ensures the same values files work for both platforms without namespace mismatches.
…admin username password Signed-off-by: Alan Cha <[email protected]>
agenti-webhook-config with environments configmap Signed-off-by: Alan Cha <[email protected]>
| @@ -0,0 +1,122 @@ | |||
| # SPIFFE Identity Provider Setup | |||
There was a problem hiding this comment.
TODO: Was this added accidentally?
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. If this PR is still relevant, please comment or remove the stale label. |
|
This pull request was closed because it has been stale for 14 days with no activity. Feel free to reopen if this is still relevant. |
Replace #769