Skip to content

Commit

Permalink
Add the ability to inject environment variables from a non-helm manag…
Browse files Browse the repository at this point in the history
…ed configmap
  • Loading branch information
xvilo committed Jul 23, 2024
1 parent 63c3ac8 commit 9f9aa12
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 5 deletions.
6 changes: 3 additions & 3 deletions charts/symfony-app/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: symfony-app
description: A simple chart to deploy basic Symfony/PHP applications
type: application
version: 0.6.0
version: 0.6.1
appVersion: 'main'
keywords:
- php
Expand All @@ -16,5 +16,5 @@ maintainers:
annotations:
# Supported kind: added, changed, deprecated, removed, fixed and security
artifacthub.io/changes: |
- kind: removed
description: "Removed php-fpm specific image options, for now."
- kind: added
description: "Added the ability to inject environment variables from a non-helm managed configmap."
16 changes: 16 additions & 0 deletions charts/symfony-app/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ spec:
envFrom:
- configMapRef:
name: {{ include "symfony-app.fullname" . }}-environment
{{ range .Values.additionalEnvironmentConfigMaps -}}
- configMapRef:
name: {{ .name }}
{{- end }}
- name: {{ include "symfony-app.fullname" . }}-php
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
Expand All @@ -59,6 +63,10 @@ spec:
envFrom:
- configMapRef:
name: {{ include "symfony-app.fullname" . }}-environment
{{ range .Values.additionalEnvironmentConfigMaps -}}
- configMapRef:
name: {{ .name }}
{{- end }}
{{- if .Values.source.copyFromFpm }}
lifecycle:
postStart:
Expand Down Expand Up @@ -101,6 +109,10 @@ spec:
envFrom:
- configMapRef:
name: {{ include "symfony-app.fullname" . }}-environment
{{ range .Values.additionalEnvironmentConfigMaps -}}
- configMapRef:
name: {{ .name }}
{{- end }}
{{- end }}
{{- if .Values.composer.autoinstall }}
- name: dependencies-composer
Expand All @@ -116,6 +128,10 @@ spec:
envFrom:
- configMapRef:
name: {{ include "symfony-app.fullname" . }}-environment
{{ range .Values.additionalEnvironmentConfigMaps -}}
- configMapRef:
name: {{ .name }}
{{- end }}
{{- end }}
{{- range .Values.initContainers }}
- name: {{ .name }}
Expand Down
25 changes: 23 additions & 2 deletions charts/symfony-app/templates/messenger/consumer-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,14 @@ spec:
- name: init-fetch-code
image: {{ (printf "%s:%s" $context.Values.image.git.repository $context.Values.image.git.tag) | quote }}
workingDir: /app
env:
envFrom:
- configMapRef:
name: {{ include "symfony-app.fullname" $ }}-environment
{{ range $.Values.additionalEnvironmentConfigMaps -}}
- configMapRef:
name: {{ .name }}
{{- end }}
{{- include "symfony-app.env" $context | nindent 10 }}
volumeMounts:
- name: app-directory
mountPath: /app
Expand All @@ -48,6 +55,13 @@ spec:
- name: dependencies-composer
image: "{{ .Values.image.php.repository }}:{{ .Values.image.php.tag }}"
workingDir: /app
envFrom:
- configMapRef:
name: {{ include "symfony-app.fullname" $ }}-environment
{{ range $.Values.additionalEnvironmentConfigMaps -}}
- configMapRef:
name: {{ .name }}
{{- end }}
{{- include "symfony-app.env" $context | nindent 10 }}
volumeMounts:
- name: app-directory
Expand All @@ -60,7 +74,14 @@ spec:
- name: {{ .name }}
image: {{ .image | default (printf "%s:%s" $context.Values.image.php.repository $context.Values.image.php.tag) | quote }}
workingDir: /app
{{- include "symfony-app.env" $ | nindent 10 }}
envFrom:
- configMapRef:
name: {{ include "symfony-app.fullname" $ }}-environment
{{ range $.Values.additionalEnvironmentConfigMaps -}}
- configMapRef:
name: {{ .name }}
{{- end }}
{{- include "symfony-app.env" $context | nindent 10 }}
volumeMounts:
- name: app-directory
mountPath: /app
Expand Down
3 changes: 3 additions & 0 deletions charts/symfony-app/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ environment: |
APP_ENV: "prod"
APP_DEBUG: "0"
additionalEnvironmentConfigMaps: []
# - name: my-config-map

##
# Only https sources are supported
source:
Expand Down

0 comments on commit 9f9aa12

Please sign in to comment.