Skip to content

Commit

Permalink
fix: empty annotation lists could result in invalid yaml
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Strebinger <[email protected]>
  • Loading branch information
ComputerBaer authored and mrueg committed Apr 20, 2022
1 parent 925ca63 commit 99d04f7
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 16 deletions.
12 changes: 8 additions & 4 deletions charts/coredns/templates/configmap-autoscaler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ metadata:
{{- if .Values.customLabels }}
{{- toYaml .Values.customLabels | nindent 4 }}
{{- end }}
{{ if or .Values.autoscaler.configmap.annotations .Values.customAnnotations }}
{{- if or .Values.autoscaler.configmap.annotations .Values.customAnnotations }}
annotations:
{{ toYaml .Values.customAnnotations | indent 4 }}
{{- toYaml .Values.autoscaler.configmap.annotations | nindent 4 }}
{{- end }}
{{- if .Values.customAnnotations }}
{{- toYaml .Values.customAnnotations | nindent 4 }}
{{- end }}
{{- if .Values.autoscaler.configmap.annotations -}}
{{ toYaml .Values.autoscaler.configmap.annotations | nindent 4 }}
{{- end }}
{{- end }}
data:
# When cluster is using large nodes(with more cores), "coresPerReplica" should dominate.
# If using small nodes, "nodesPerReplica" should dominate.
Expand Down
12 changes: 8 additions & 4 deletions charts/coredns/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ metadata:
{{- if .Values.customLabels }}
{{ toYaml .Values.customLabels | indent 4 }}
{{- end }}
{{ if or .Values.deployment.annotations .Values.customAnnotations }}
{{- if or .Values.deployment.annotations .Values.customAnnotations }}
annotations:
{{ toYaml .Values.customAnnotations | indent 4 }}
{{ toYaml .Values.deployment.annotations | indent 4 }}
{{- end }}
{{- if .Values.customAnnotations }}
{{- toYaml .Values.customAnnotations | nindent 4 }}
{{- end }}
{{- if .Values.deployment.annotations }}
{{- toYaml .Values.deployment.annotations | nindent 4 }}
{{- end }}
{{- end }}
spec:
{{- if not .Values.autoscaler.enabled }}
replicas: {{ .Values.replicaCount }}
Expand Down
6 changes: 6 additions & 0 deletions charts/coredns/templates/service-metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,18 @@ metadata:
{{- if .Values.customLabels }}
{{ toYaml .Values.customLabels | indent 4 }}
{{- end }}
{{- if or .Values.prometheus.service.annotations .Values.service.annotations .Values.customAnnotations }}
annotations:
{{- if .Values.prometheus.service.annotations }}
{{ toYaml .Values.prometheus.service.annotations | indent 4 }}
{{- end }}
{{- if .Values.service.annotations }}
{{ toYaml .Values.service.annotations | indent 4 }}
{{- end }}
{{- if .Values.customAnnotations }}
{{ toYaml .Values.customAnnotations | indent 4 }}
{{- end }}
{{- end }}
spec:
selector:
app.kubernetes.io/instance: {{ .Release.Name | quote }}
Expand Down
12 changes: 8 additions & 4 deletions charts/coredns/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@ metadata:
{{- if .Values.customLabels }}
{{ toYaml .Values.customLabels | indent 4 }}
{{- end }}
{{- if or .Values.service.annotations .Values.customAnnotations }}
annotations:
{{ toYaml .Values.service.annotations | indent 4 }}
{{- if .Values.customAnnotations }}
{{ toYaml .Values.customAnnotations | indent 4 }}
{{- end }}
{{- if .Values.service.annotations }}
{{- toYaml .Values.service.annotations | nindent 4 }}
{{- end }}
{{- if .Values.customAnnotations }}
{{- toYaml .Values.customAnnotations | nindent 4 }}
{{- end }}
{{- end }}
spec:
selector:
app.kubernetes.io/instance: {{ .Release.Name | quote }}
Expand Down
12 changes: 8 additions & 4 deletions charts/coredns/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ metadata:
kubernetes.io/name: "CoreDNS"
{{- end }}
app.kubernetes.io/name: {{ template "coredns.name" . }}
{{ if or .Values.serviceAccount.annotations .Values.customAnnotations }}
{{- if or .Values.serviceAccount.annotations .Values.customAnnotations }}
annotations:
{{ toYaml .Values.customAnnotations | indent 4 }}
{{ toYaml .Values.serviceAccount.annotations | indent 4 }}
{{- end }}
{{- if .Values.customAnnotations }}
{{- toYaml .Values.customAnnotations | nindent 4 }}
{{- end }}
{{- if .Values.serviceAccount.annotations }}
{{- toYaml .Values.serviceAccount.annotations | nindent 4 }}
{{- end }}
{{- end }}
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.pullSecrets }}
Expand Down

0 comments on commit 99d04f7

Please sign in to comment.