Skip to content

Commit

Permalink
Update the ConfigMapFiles template
Browse files Browse the repository at this point in the history
  • Loading branch information
vhs-spoton committed Apr 1, 2021
1 parent a509a0e commit 933e976
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
12 changes: 6 additions & 6 deletions monochart/templates/configmapfile.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{{/*
This template will allow create a configmap from a file.
*/}}

{{- $root := . -}}
{{- if .Values.configmapfiles.enabled }}
{{- range $CMF := .Values.configmapfiles.cmf }}
{{- if .Values.cmf }}
{{- range $configMapName, $configMap := .Values.cmf }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ $CMF.name }}
name: {{ $configMapName }}
labels:
{{- include "common.labels.standard" $root | nindent 4 }}
data:
{{ $CMF.name }}: |-
{{ $CMF.filepath }}
{{ $configMapName | indent 2}}: |-
{{ $configMap.data | indent 4}}
{{- end }}
{{- end }}

19 changes: 9 additions & 10 deletions monochart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -521,16 +521,15 @@ securityContext:
fsGroup: 999


# This will load a loca file inside of a ENV variable.
# NOTE: Rememeber to add the cmf.name to "envFrom.configMaps"
configmapfiles:
enabled: false
cmf:
- name: someName
filepath: /path/to/yourfile.json
- name: anotherCMF
filepath: ../second/path

# Helm charts don't allow include a file outside from the chart directory.
# To workaround this, we can use the "set-file" parameters to include a file inside
# of a Values and after this, put this Value inside an ConfigMapfile (cmf)
# You need to follow this exact syntax in your helmfile
# set:
# - name: cmf.The_Name_of_the_Resource.data
# file: /path/relative/to/manifest
#
# NOTE: Rememeber to add the cmf.name to "envFrom.configMaps" to have it inside of container.

## Security context
DataDogDefaultEnv:
Expand Down

0 comments on commit 933e976

Please sign in to comment.