Skip to content

Commit

Permalink
Do not generate empty ConfigMap
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianeicher committed Dec 6, 2021
1 parent 4c11c94 commit fcb0d7e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions charts/generic-service/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.config }}
apiVersion: v1
kind: ConfigMap
metadata:
Expand All @@ -6,3 +7,4 @@ metadata:

data:
data.yaml: {{ .Values.config | toJson | quote }}
{{- end }}
10 changes: 7 additions & 3 deletions charts/generic-service/templates/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ spec:
{{- if .Values.tracing.enabled }}
traffic.sidecar.istio.io/excludeOutboundPorts: '5778,9411,14268,14250' # Jaeger ports
{{- end }}
{{- if .Values.config }}
checksum/config: {{ .Values.config | toJson | sha256sum }}
{{- end }}
{{- if .Values.secrets }}
checksum/secrets: {{ .Values.secrets | toJson | sha256sum }}
{{- end }}
Expand All @@ -65,9 +67,11 @@ spec:
persistentVolumeClaim:
claimName: {{ include "generic-service.fullname" . }}
{{- end }}
{{- if .Values.config }}
- name: config
configMap:
name: {{ include "generic-service.fullname" . }}
{{- end }}
{{- range .Values.additionalConfigs }}
- name: config-{{ . }}
configMap:
Expand Down Expand Up @@ -129,9 +133,11 @@ spec:
- name: {{ if eq .Values.controller "StatefulSet" }}{{ include "generic-service.fullname" . }}{{ else }}persistence{{ end }}
mountPath: {{ required "Must specify persistence.mountPath when persistence.enabled" .Values.persistence.mountPath }}
{{- end }}
{{- if .Values.config }}
- name: config
subPath: data.yaml
mountPath: {{ .Values.configMountPath }}
{{- end }}
{{- range .Values.additionalConfigs }}
- name: config-{{ . }}
subPath: data.yaml
Expand All @@ -149,9 +155,7 @@ spec:
{{- if .Values.ingress.enabled }}
- name: '{{ .Values.ingress.protocol }}-ingress'
containerPort: {{ .Values.ingress.port }}

{{- end }}

{{- if .Values.monitoring.enabled }}
- name: http-monitoring
containerPort: {{ .Values.monitoring.port }}
Expand Down Expand Up @@ -219,7 +223,7 @@ spec:
value: "6831"
{{- end }}
- name: CONFIG_FILE
value: {{ .Values.configMountPath }}{{ range .Values.additionalConfigs }}:/additional-configs/{{ . }}/data.yaml{{ end }}
value: '{{ if .Values.config }}{{ .Values.configMountPath }}{{ end }}{{ range .Values.additionalConfigs }}:/additional-configs/{{ . }}/data.yaml{{ end }}'
{{- range $key, $val := .Values.env }}
- name: {{ $key | quote }}
value: {{ $val | quote }}
Expand Down

0 comments on commit fcb0d7e

Please sign in to comment.