refactor: manage Keycloak setup credentials via Kubernetes Secrets - #121
Merged
AhmedSeemalK merged 1 commit intoAug 4, 2026
Merged
Conversation
Move the Keycloak realm setup Jobs off inline credential templating and onto standard Kubernetes Secret handling. Previously the admin user, password and client id were rendered directly into the Job container args, and the resulting OIDC client secret was passed back to Ansible by parsing it out of the Job's stdout. This couples the deployment to log formatting and stores configuration values in places that are awkward to rotate or manage. Changes: - Store admin user, password and client id in a Kubernetes Secret (keycloak-admin-credentials-env) and inject them into the Job with envFrom, so the Job spec no longer carries the values. The readiness check reads them from the environment and uses --data-urlencode for correct encoding. - keycloak-realmcreation.sh now writes the client secret to a Kubernetes Secret (keycloak-client-secret) through the API server using the pod ServiceAccount, instead of emitting it on stdout. Positional arguments are still accepted as a fallback so standalone and documented usage is unchanged. - Playbooks read the client secret with k8s_info. Retrieval uses failed_when: false to preserve the previous non-fatal behaviour when the secret is unavailable. - Add a keycloak-realm-setup ServiceAccount with a namespaced Role/RoleBinding scoped to get/create/update/patch on secrets, and set serviceAccountName on both Jobs. - Mark credential-handling tasks no_log: true to keep values out of Ansible output. No configuration changes are required: the same inference-config.cfg variables are consumed, and client_secret continues to be passed to the model Helm releases as before. Signed-off-by: S, Gurunath <gurunath.s@intel.com>
AhmedSeemalK
approved these changes
Aug 3, 2026
AhmedSeemalK
left a comment
Collaborator
There was a problem hiding this comment.
LGTM this is required change
mdfaheem-intel
approved these changes
Aug 4, 2026
sandeshk-intel
approved these changes
Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Move the Keycloak realm setup Jobs off inline credential templating and onto standard Kubernetes Secret handling.
Previously the admin user, password and client id were rendered directly into the Job container args, and the resulting OIDC client secret was passed back to Ansible by parsing it out of the Job's stdout. This couples the deployment to log formatting and stores configuration values in places that are awkward to rotate or manage.
Changes:
No configuration changes are required: the same inference-config.cfg variables are consumed, and client_secret continues to be passed to the model Helm releases as before.