Skip to content

Commit efb43f6

Browse files
jsell-rhclaude
andcommitted
feat(manifests): switch control-plane auth from static token to OIDC client credentials
Replace AMBIENT_API_TOKEN (static bearer token) with OIDC client credentials (client_credentials grant) for control-plane → api-server authentication. The control-plane exchanges a Keycloak client-id and client-secret for short-lived JWTs, validated by the same JWKS path the api-server already uses for user tokens. - Update SaaS template: replace AMBIENT_API_TOKEN with OIDC_TOKEN_URL, OIDC_CLIENT_ID, OIDC_CLIENT_SECRET from ambient-control-plane-oidc secret - Remove AMBIENT_API_TOKEN from api-server env (no longer needed) - Update hcmais overlay with concrete Keycloak token URL - Add deployment prerequisites section to manifests README Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 3acdd02 commit efb43f6

3 files changed

Lines changed: 46 additions & 11 deletions

File tree

components/manifests/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,32 @@ Components are opt-in kustomize modules included via the `components:` block in
124124
| `ambient-api-server-db` | Same RHEL patch for the ambient-api-server's dedicated DB | `production`, `local-dev` |
125125
| `postgresql-init-scripts` | ConfigMap + volume for DB init SQL (vanilla postgres only) | `kind`, `e2e` |
126126

127+
## Prerequisites for New Deployments
128+
129+
Before deploying, create these secrets in the target namespace:
130+
131+
### Control-plane OIDC credentials
132+
133+
The control-plane authenticates to the api-server using Keycloak client credentials (OAuth2 `client_credentials` grant). Create a **confidential** Keycloak client with only the **Service accounts roles** flow enabled, then:
134+
135+
```bash
136+
oc create secret generic ambient-control-plane-oidc \
137+
-n <namespace> \
138+
--from-literal=client-id=<keycloak-client-id> \
139+
--from-literal=client-secret=<keycloak-client-secret>
140+
```
141+
142+
### API server auth ConfigMap
143+
144+
The api-server validates JWTs using keys from the Keycloak JWKS endpoint (configured via `--jwk-cert-url`). A local fallback is also loaded from a ConfigMap:
145+
146+
```bash
147+
oc create configmap ambient-api-server-auth \
148+
-n <namespace> \
149+
--from-file=jwks.json=<(curl -s <KEYCLOAK_REALM_URL>/protocol/openid-connect/certs) \
150+
--from-file=acl.yml=<(echo '- claim: email\n pattern: ^.*$')
151+
```
152+
127153
## Building and Validating
128154

129155
```bash

components/manifests/overlays/hcmais/control-plane-env-patch.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,15 @@ spec:
1616
value: "false"
1717
- name: CP_TOKEN_URL
1818
value: "http://ambient-control-plane.ambient-api.svc:8080/token"
19-
- name: AMBIENT_API_TOKEN
19+
- name: OIDC_TOKEN_URL
20+
value: "https://keycloak-ambient-keycloak.apps.rosa.hcmais01ue1.s9m2.p3.openshiftapps.com/realms/ambient-code/protocol/openid-connect/token"
21+
- name: OIDC_CLIENT_ID
2022
valueFrom:
2123
secretKeyRef:
22-
name: ambient-control-plane-token
23-
key: token
24+
name: ambient-control-plane-oidc
25+
key: client-id
26+
- name: OIDC_CLIENT_SECRET
27+
valueFrom:
28+
secretKeyRef:
29+
name: ambient-control-plane-oidc
30+
key: client-secret

components/manifests/templates/template-services.yaml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,6 @@ objects:
202202
env:
203203
- name: AMBIENT_ENV
204204
value: production
205-
- name: AMBIENT_API_TOKEN
206-
valueFrom:
207-
secretKeyRef:
208-
name: ambient-control-plane-token
209-
key: token
210205
- name: CREDENTIAL_ENCRYPTION_KEYRING
211206
valueFrom:
212207
secretKeyRef:
@@ -375,11 +370,18 @@ objects:
375370
value: standard
376371
- name: LOG_LEVEL
377372
value: info
378-
- name: AMBIENT_API_TOKEN
373+
- name: OIDC_TOKEN_URL
374+
value: "${KEYCLOAK_REALM_URL}/protocol/openid-connect/token"
375+
- name: OIDC_CLIENT_ID
376+
valueFrom:
377+
secretKeyRef:
378+
name: ambient-control-plane-oidc
379+
key: client-id
380+
- name: OIDC_CLIENT_SECRET
379381
valueFrom:
380382
secretKeyRef:
381-
name: ambient-control-plane-token
382-
key: token
383+
name: ambient-control-plane-oidc
384+
key: client-secret
383385
- name: AMBIENT_API_SERVER_URL
384386
value: "http://ambient-api-server.${NAMESPACE}.svc:8000"
385387
- name: AMBIENT_GRPC_SERVER_ADDR

0 commit comments

Comments
 (0)