Skip to content

Commit

Permalink
wip(charts): add an optional sufix to source volume name in envsubst …
Browse files Browse the repository at this point in the history
…templates.
  • Loading branch information
robinbourianes-kalisio committed Feb 4, 2022
1 parent bc760fa commit dc80254
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions charts/common/templates/_envsubstConfig.tpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{{/*
Builds an initContainer definition to perform envsubst on a configMap and store the result to some other volume.
@param .context The caller's context
@param .args.env An object with key-value pairs to define environment variables
@param .args.targetVolumeName The target volume where to copy the configMap content
@param .context The caller's context
@param .args.env An object with key-value pairs to define environment variables
@param .args.targetVolumeName The target volume where to copy the configMap content
@param .args.sourceVolumeNameSuffix A suffix to add to the source volume name, when requiring more than one
*/}}
{{- define "common.envsubstConfig.renderInitContainer" -}}
- name: envsubst-config
Expand Down Expand Up @@ -31,19 +32,20 @@ Builds an initContainer definition to perform envsubst on a configMap and store
{{- include "common.environment.render" (dict "env" .args.env "context" .context) | indent 4 }}
volumeMounts:
- mountPath: /source
name: envsubst-config-source-config
name: envsubst-config-source-config{{ default "" .args.sourceVolumeNameSuffix }}
readOnly: true
- mountPath: /target
name: {{ .args.targetVolumeName }}
{{- end -}}

{{/*
Builds a volume definition that should be used with common.envsubstConfig.renderInitContainer
@param .context The caller's context
@param .args.configMapName The configMap to use as source for the copy
@param .context The caller's context
@param .args.configMapName The configMap to use as source for the copy
@param .args.sourceVolumeNameSuffix A suffix to add to the source volume name, when requiring more than one
*/}}
{{- define "common.envsubstConfig.renderVolume" -}}
- name: envsubst-config-source-config
- name: envsubst-config-source-config{{ default "" .args.sourceVolumeNameSuffix }}
configMap:
name: {{ include "common.tplvalues.render" ( dict "value" .args.configMapName "context" .context ) }}
{{- end -}}

0 comments on commit dc80254

Please sign in to comment.