diff --git a/charts/common/templates/_configmap.yaml b/charts/common/templates/_configmap.yaml index babfd71..6b06160 100644 --- a/charts/common/templates/_configmap.yaml +++ b/charts/common/templates/_configmap.yaml @@ -1,5 +1,6 @@ {{- define "common.configmap.tpl" -}} {{- if .Values.vars }} +--- apiVersion: v1 kind: ConfigMap metadata: diff --git a/charts/common/templates/_customFileConfigmap.yaml b/charts/common/templates/_customFileConfigmap.yaml index 00256de..2ca2369 100644 --- a/charts/common/templates/_customFileConfigmap.yaml +++ b/charts/common/templates/_customFileConfigmap.yaml @@ -1,11 +1,11 @@ {{- define "common.customFileConfigmap.tpl" -}} {{- range .Values.volumes }} {{- if .fileName }} - +--- apiVersion: v1 kind: ConfigMap metadata: - name: {{ template "common.robustName" .fileName }} + name: {{ template "common.robustName" (printf "%s-%s" $.Release.Name .name) }} namespace: {{ $.Release.Namespace }} data: {{ .fileName }}: | diff --git a/charts/common/templates/_volumesRef.yaml b/charts/common/templates/_volumesRef.yaml index a1b08aa..122cde5 100644 --- a/charts/common/templates/_volumesRef.yaml +++ b/charts/common/templates/_volumesRef.yaml @@ -10,7 +10,7 @@ volumes: name: {{ .existingConfigMap }} {{- else if .fileName }} configMap: - name: {{ template "common.robustName" .fileName }} + name: {{ template "common.robustName" (printf "%s-%s" $.Release.Name .name) }} {{- else if .hostPath }} hostPath: path: {{ .hostPath.path }} diff --git a/charts/cron-job/templates/cronJob.yaml b/charts/cron-job/templates/cronJob.yaml index 4916979..2e7357d 100644 --- a/charts/cron-job/templates/cronJob.yaml +++ b/charts/cron-job/templates/cronJob.yaml @@ -25,10 +25,12 @@ spec: {{- if .Values.vars }} imagePullPolicy: {{ .Values.image.pullPolicy }} {{- end }} + {{- if .Values.overrideCommand }} command: - {{ .Values.shell }} - -c - {{ .Values.command | quote }} + {{- end }} {{- include "common.envFromRef.tpl" . | nindent 14 }} {{- include "common.volumeMountsRef.tpl" . | nindent 14 }} resources: diff --git a/charts/cron-job/templates/custom-file-configmap.yaml b/charts/cron-job/templates/custom-file-configmap.yaml new file mode 100644 index 0000000..040eb27 --- /dev/null +++ b/charts/cron-job/templates/custom-file-configmap.yaml @@ -0,0 +1 @@ +{{- include "common.customFileConfigmap.tpl" . -}} diff --git a/charts/cron-job/values.yaml b/charts/cron-job/values.yaml index f0bca92..8c80992 100644 --- a/charts/cron-job/values.yaml +++ b/charts/cron-job/values.yaml @@ -5,6 +5,7 @@ image: schedule: "*/1 * * * *" command: | echo "I'm alive" +overrideCommand: true shell: "/bin/sh" nameOverride: "" diff --git a/charts/onechart/tests/deployment_volumes_test.yaml b/charts/onechart/tests/deployment_volumes_test.yaml index dd655b4..a6b63cc 100644 --- a/charts/onechart/tests/deployment_volumes_test.yaml +++ b/charts/onechart/tests/deployment_volumes_test.yaml @@ -169,7 +169,7 @@ tests: value: - name: volume-name configMap: - name: myfile-conf + name: release-name-volume-name - equal: path: spec.template.spec.containers[0].volumeMounts value: