Skip to content

Commit

Permalink
feat(os2mo): [#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.

The `environment_containing_json` does not seem to serve any purpose,
but was probably copied from an old method of templating the ConfigMap
using a for-loop instead of `toYaml`.

[1] kubernetes/kubernetes#22368
  • Loading branch information
caspervk committed Jun 28, 2023
1 parent dc79a1a commit d010734
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 39 deletions.
16 changes: 0 additions & 16 deletions os2mo/templates/mo/configmap.yaml

This file was deleted.

25 changes: 16 additions & 9 deletions os2mo/templates/mo/deployment.yaml
Expand Up @@ -104,12 +104,14 @@ spec:
- name: CONFDB_SHOW_ORG_UNIT_BUTTON
value: {{ .Values.sdtool.enabled | quote }}

envFrom:
- configMapRef:
name: mo-config
- configMapRef:
name: mo-json-config

{{- range $name, $value := .Values.os2mo.environment }}
- name: {{ $name }}
value: {{ $value | quote }}
{{- end }}
{{- range $name, $value := .Values.os2mo.environment_containing_json }}
- name: {{ $name }}
value: {{ $value | quote }}
{{- end }}
ports:
- containerPort: 5000
resources:
Expand Down Expand Up @@ -220,9 +222,14 @@ spec:
secretKeyRef:
name: {{ .Values.database.mox.secret }}
key: db_password
envFrom:
- configMapRef:
name: mo-config
{{- range $name, $value := .Values.os2mo.environment }}
- name: {{ $name }}
value: {{ $value | quote }}
{{- end }}
{{- range $name, $value := .Values.os2mo.environment_containing_json }}
- name: {{ $name }}
value: {{ $value | quote }}
{{- end }}
resources:
{{- toYaml .Values.os2mo.resources | nindent 12 }}

Expand Down
14 changes: 0 additions & 14 deletions os2mo/templates/mo/json-config.yaml

This file was deleted.

0 comments on commit d010734

Please sign in to comment.