From d75f6c82a9fa3c21ef89f0cf0261eb4200425e4d Mon Sep 17 00:00:00 2001 From: Jontze <42588836+jontze@users.noreply.github.com> Date: Sat, 6 Apr 2024 12:39:35 +0200 Subject: [PATCH] chore(helm): Fix crash due to empty env vars --- helm/cadency/Chart.yaml | 2 +- helm/cadency/templates/deployment.yaml | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/helm/cadency/Chart.yaml b/helm/cadency/Chart.yaml index 963298d..da29bce 100644 --- a/helm/cadency/Chart.yaml +++ b/helm/cadency/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: cadency description: Helm chart to deploy the cadency discord bot. -version: 0.2.0 +version: 0.2.1 appVersion: "0.5.1" type: application maintainers: diff --git a/helm/cadency/templates/deployment.yaml b/helm/cadency/templates/deployment.yaml index 0128355..bb14af9 100644 --- a/helm/cadency/templates/deployment.yaml +++ b/helm/cadency/templates/deployment.yaml @@ -48,24 +48,31 @@ spec: image: "{{ .Values.image.name }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: + {{- $configMapName := include "cadency.fullname" . -}} + {{- with .Values.cadency.config }} - name: "RUST_LOG" valueFrom: configMapKeyRef: - name: {{ include "cadency.fullname" . }} + name: {{ $configMapName }} key: logLevel optional: true + {{- if .playlistSongLimit }} - name: "CADENCY_PLAYLIST_SONG_LIMIT" valueFrom: configMapKeyRef: - name: {{ include "cadency.fullname" . }} + name: {{ $configMapName }} key: playlistSongLimit optional: true + {{- end }} + {{- if .songLengthLimit }} - name: "CADENCY_SONG_LENGTH_LIMIT" valueFrom: configMapKeyRef: - name: {{ include "cadency.fullname" . }} + name: {{ $configMapName }} key: songLengthLimit optional: true + {{- end }} + {{- end }} {{- $createdSecretName := include "cadency.fullname" . -}} {{- with .Values.cadency.discordToken }} - name: DISCORD_TOKEN