From 2317af61d4bebe57b694ff88ec3b6ec3c87249df Mon Sep 17 00:00:00 2001 From: "Casper V. Kristensen" Date: Wed, 28 Jun 2023 14:14:50 +0200 Subject: [PATCH] feat(sql_export): [#48311] template environment variables directly 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] https://github.com/kubernetes/kubernetes/issues/22368 --- .../integrations/sql_export/config.yaml | 16 ---------------- .../integrations/sql_export/deployment.yaml | 8 +++++--- 2 files changed, 5 insertions(+), 19 deletions(-) delete mode 100644 os2mo/templates/integrations/sql_export/config.yaml diff --git a/os2mo/templates/integrations/sql_export/config.yaml b/os2mo/templates/integrations/sql_export/config.yaml deleted file mode 100644 index 891d101..0000000 --- a/os2mo/templates/integrations/sql_export/config.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# SPDX-FileCopyrightText: Magenta ApS -# -# SPDX-License-Identifier: MPL-2.0 ---- -{{- if .Values.sql_export.enabled }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: sql-export - {{- with .Values.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -data: -{{ toYaml .Values.sql_export.environment | indent 2 }} -{{- end }} diff --git a/os2mo/templates/integrations/sql_export/deployment.yaml b/os2mo/templates/integrations/sql_export/deployment.yaml index 412bbde..bcb7116 100644 --- a/os2mo/templates/integrations/sql_export/deployment.yaml +++ b/os2mo/templates/integrations/sql_export/deployment.yaml @@ -55,9 +55,11 @@ spec: name: {{ .Values.sql_export.historic_state_secret_name }} key: password {{- end }} - envFrom: - - configMapRef: - name: sql-export + + {{- range $name, $value := .Values.sql_export.environment }} + - name: {{ $name }} + value: {{ $value | quote }} + {{- end }} ports: - containerPort: 8000 resources: