Skip to content

Feat/keycloak official image - #1671

Draft
omrishiv wants to merge 2 commits into
agentic-community:mainfrom
omrishiv:feat/keycloak-official-image
Draft

Feat/keycloak official image#1671
omrishiv wants to merge 2 commits into
agentic-community:mainfrom
omrishiv:feat/keycloak-official-image

Conversation

@omrishiv

Copy link
Copy Markdown
Contributor

Issue #, if available:

Description of changes:

For #993 to work with Keycloak, we need a newer Keycloak image and to enable CIMD as a feature in keycloak. This PR switches from the Bitnami chart to the official Keycloak image and Postgres image while adding the changes needed to enable CIMD.

NOTE!!!

Deploying this chart will removed the old Postgres and Keycloak deployments; this is not a true upgrade. There is a best-effort attempt at dumping and restoring the postgres database, but it is recommended that you also dump the database. The contents of the database should only be manual changes made to keycloak unless the database was being used for something outside this project. The contents should be DCR client registrations, which are recreated transparently, and any manual changes to the realm/users. If you manually added users or made other changes, you may want to save them; otherwise, the initial bootstrap will recreate resources as normal.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Retire the deprecated Bitnami keycloak subchart (and its bundled Bitnami
postgres) for a hand-rolled charts/keycloak subchart on the official
quay.io/keycloak/keycloak (26.6, CIMD-capable) and official postgres images.

charts/keycloak (new):
- Keycloak as a Deployment (stateless; state in postgres) + an official
  postgres StatefulSet, preserving the load-bearing contract other components
  depend on: the <release>-keycloak-headless:8080 service (internal
  KEYCLOAK_URL) and <release>-keycloak:80.
- Upgrade-safe from a Bitnami-backed release: Keycloak switches STS->Deployment
  (clean delete/create, no immutable-field conflict); postgres uses a new STS
  name + fresh PVC; same-name/same-type services update in place.
- One-time data migration (default on, auto-detecting): a pre-upgrade Job
  pg_dumps the legacy Bitnami DB and the new postgres restores it on first
  init, normalized to a plain keycloak/keycloak DB (no bitnami/bn names). No
  legacy source -> no-op; a genuine dump failure aborts the upgrade (fail-safe),
  so a forgotten flag can't drop a database.
- Realm SSL-disable init preserved via a postStart hook using kcadm (the
  official image has no curl). KC_FEATURES configurable ("cimd" enables CIMD).

Stack wiring:
- Chart.yaml: keycloak dependency bitnamicharts -> file://../keycloak.
- values.yaml: new keycloak block (official image, features "cimd",
  postgres.migrateFromBitnami default true).

CIMD (Client ID Metadata Documents):
- keycloak-configure Job and keycloak/setup/init-keycloak.sh: new
  configure_cimd_client_policy provisions a Keycloak client policy (a
  client-id-uri condition + a client-id-metadata-document executor with a
  trusted-domains allowlist) so MCP clients whose client_id is an https URL
  (VS Code, Claude Code) authenticate by publishing their own metadata
  document -- no pre-registration. Gated by ENABLE_CIMD_CONFIG / cimd.enabled;
  trusted domains configurable (must cover each client's client_id host,
  loopback redirect hosts, and CDN/logo hosts).

Verified: helm template + lint clean; embedded script.sh and init-keycloak.sh
pass bash -n; full helm unittest suite (41) green. Proven end-to-end on a live
Keycloak: bitnami->official upgrade preserved all realm data, and a
VS Code-style CIMD client_id drove Keycloak fetch/validate -> token ->
authorized MCP initialize.
…tack

Signed-off-by: omrishiv <327609+omrishiv@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant