This commit is contained in:
Guilhem Lavaux 2024-11-14 08:25:23 +01:00
parent c9139aa850
commit 8faeee5594
2 changed files with 59 additions and 0 deletions

View File

@ -24,6 +24,35 @@ spec:
volumeMounts:
- name: data
mountPath: /data
env:
{{- with .Values.env.plain }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- range .Values.env.configMapKeys }}
- name: {{ .name }}
valueFrom:
configMapKeyRef:
name: {{ .configMapName }}
key: {{ .key }}
{{- end }}
{{- range .Values.env.secretKeys }}
- name: {{ .name }}
valueFrom:
secretKeyRef:
name: {{ .secretName }}
key: {{ .key }}
{{- end }}
envFrom:
{{- range .Values.env.configMapRefs }}
- configMapRef:
name: {{ .name }}
optional: {{ .optional | default false }}
{{- end }}
{{- range .Values.env.secretRefs }}
- secretRef:
name: {{ .name }}
optional: {{ .optional | default false }}
{{- end }}
volumes:
- name: data
persistentVolumeClaim:

View File

@ -35,3 +35,33 @@ ingress:
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
# cert-manager.io/cluster-issuer: "letsencrypt-prod"
# Environment variables to be passed to the container
env:
# Direct environment variables
plain:
- name: APP_NAME
value: "my-app"
- name: PORT
value: "8080"
# Environment variables from ConfigMaps
configMapRefs:
- name: app-config # Reference an existing ConfigMap
optional: true # Make it optional
configMapKeys:
- name: CONFIG_KEY
configMapName: app-config
key: config.key
# Environment variables from Secrets
secretRefs:
- name: app-secrets # Reference an existing Secret
optional: true # Make it optional
secretKeys:
- name: API_KEY
secretName: app-secrets
key: api.key