Skip to content

Commit

Permalink
feat(keycloak builder): [#48311] template environment variables directly
Browse files Browse the repository at this point in the history
Previously, environment variables were templated into a ConfigMap which
was referenced through an `envFrom` in the deployment. Unfortunately,
Kubernetes does not restart deployments on changes to their referenced
ConfigMaps[1], so this indirection means that deployments have to be
restarted manually every time a change is made - something that is very
easy to forget in an otherwise GitOpsy workflow.

[1] kubernetes/kubernetes#22368
  • Loading branch information
caspervk committed Jun 28, 2023
1 parent d010734 commit 4cc7dc0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
14 changes: 0 additions & 14 deletions os2mo/templates/keycloak/realm-builder-config.yaml

This file was deleted.

7 changes: 4 additions & 3 deletions os2mo/templates/mo/deployment.yaml
Expand Up @@ -235,9 +235,6 @@ spec:

- name: keycloak-realm-builder
image: "{{ .Values.keycloak.builder.image.registry }}/{{ .Values.keycloak.builder.image.repository }}:{{ .Values.keycloak.builder.image.tag }}"
envFrom:
- configMapRef:
name: keycloak-gen-config
env:
{{ include "os2mo.keycloak_terraform_db_connection" . | nindent 12 }}
- name: TF_VAR_KEYCLOAK_ADMIN_USERNAME
Expand All @@ -262,6 +259,10 @@ spec:
secretKeyRef:
name: keycloak-dipex-secret
key: client_secret
{{- range $name, $value := .Values.keycloak.builder.environment }}
- name: {{ $name }}
value: {{ $value | quote }}
{{- end }}
resources:
{{- toYaml .Values.initContainers.resources | nindent 12 }}
restartPolicy: Always

0 comments on commit 4cc7dc0

Please sign in to comment.