Skip to content

feat: add rh-keycloak wrapper chart with PostSync cleanup for one-shot ExternalSecrets#137

Open
minmzzhang wants to merge 1 commit into
validatedpatterns:mainfrom
minmzzhang:one-shot-keycloak-users
Open

feat: add rh-keycloak wrapper chart with PostSync cleanup for one-shot ExternalSecrets#137
minmzzhang wants to merge 1 commit into
validatedpatterns:mainfrom
minmzzhang:one-shot-keycloak-users

Conversation

@minmzzhang
Copy link
Copy Markdown
Collaborator

@minmzzhang minmzzhang commented May 21, 2026

Summary

  • Add a wrapper chart (charts/rh-keycloak) that consumes the rhbk chart as a dependency and adds a PostSync cleanup job for one-shot ExternalSecret provisioning
  • Switch values-hub.yaml from the remote rhbk chart to the local rh-keycloak wrapper chart path
  • Update commented-out overrides with rhbk. prefix to match the wrapper chart structure

How it works

When externalSecrets.oneShot is enabled (set by the wrapper chart), the keycloak-users ExternalSecret uses BeforeHookCreation and sets deletionPolicy: Retain. The PostSync job then:

  1. Waits for labeled ExternalSecrets to reach Ready
  2. Deletes them with --cascade=orphan (Secrets survive because Kubernetes GC is told to orphan dependents)
  3. Cleans up ephemeral Secrets labeled ztvp.io/cleanup=delete (the keycloak-users Secret)

This prevents ESO from continuously overwriting the keycloak-users Secret after Keycloak has consumed it during realm import.

Dependencies

  • Depends on rhbk-chart PR #14 — the wrapper chart requires rhbk >= 0.0.9 with externalSecrets.oneShot support. That PR must be merged and published before this one can be deployed.

Add a wrapper chart (charts/rh-keycloak) that consumes the rhbk
chart as a dependency and adds a PostSync cleanup job for
one-shot ExternalSecret provisioning.

The PostSync job:
1. Waits for labeled ExternalSecrets to sync
2. Deletes them with --cascade=orphan (Secrets survive)
3. Cleans up ephemeral Secrets labeled for deletion (keycloak-users)

Switch values-hub.yaml from the remote rhbk chart to the local
rh-keycloak wrapper chart path. Requires rhbk-chart >= 0.0.9
with externalSecrets.oneShot support. Commented-out overrides
updated with rhbk. prefix to match the wrapper chart structure.

Signed-off-by: Min Zhang <minzhang@redhat.com>
@minmzzhang minmzzhang requested review from mlorenzofr, p-rog and sabre1041 and removed request for sabre1041 May 21, 2026 22:09
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