From e68ccf3a78e47d3a4acd5b4eb524eea6f41a63c5 Mon Sep 17 00:00:00 2001 From: Om More <51229945+thisisommore@users.noreply.github.com> Date: Thu, 3 Nov 2022 14:00:16 +0530 Subject: [PATCH] deployment: Mount env-file only if defined --- charts/deployment/Chart.yaml | 2 +- charts/deployment/templates/deployment.yaml | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/charts/deployment/Chart.yaml b/charts/deployment/Chart.yaml index 4c8e089..2dabfb6 100644 --- a/charts/deployment/Chart.yaml +++ b/charts/deployment/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.5 +version: 0.1.6 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/deployment/templates/deployment.yaml b/charts/deployment/templates/deployment.yaml index 02181a3..62f69c1 100644 --- a/charts/deployment/templates/deployment.yaml +++ b/charts/deployment/templates/deployment.yaml @@ -21,15 +21,18 @@ spec: cpu: "100m" ports: - containerPort: {{.Values.port }} + env: + - name: "APP_PORT" + value: "{{.Values.port }}" +{{ if .Values.env_secret_name }} volumeMounts: - mountPath: "/app/.env" subPath: ".env" name: env-file readOnly: true - env: - - name: "APP_PORT" - value: "{{.Values.port }}" + volumes: - name: env-file secret: - secretName: {{.Values.env_secret_name}} \ No newline at end of file + secretName: {{.Values.env_secret_name}} +{{ end }} \ No newline at end of file