helm: omit annotation section when empty (#10388)

This is a small, nit-picky stylistic change to the helm chart. When
there are no annotations for a template, this omits the `annotations`
key, rather than having an empty `annotations` section in the rendered
template.
pull/10412/head^2
Trevor Whitney 2 years ago committed by GitHub
parent 9e275792e3
commit 60f57607b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      production/helm/loki/templates/backend/statefulset-backend.yaml
  2. 2
      production/helm/loki/templates/gateway/deployment-gateway.yaml
  3. 4
      production/helm/loki/templates/loki-canary/daemonset.yaml
  4. 2
      production/helm/loki/templates/loki-canary/serviceaccount.yaml
  5. 2
      production/helm/loki/templates/read/deployment-read.yaml
  6. 2
      production/helm/loki/templates/single-binary/statefulset.yaml
  7. 2
      production/helm/loki/templates/write/statefulset-write.yaml

@ -9,6 +9,7 @@ metadata:
labels:
{{- include "loki.backendLabels" . | nindent 4 }}
app.kubernetes.io/part-of: memberlist
{{- if or (not (empty .Values.loki.annotations)) (not (empty .Values.backend.annotations))}}
annotations:
{{- with .Values.loki.annotations }}
{{- toYaml . | nindent 4 }}
@ -16,6 +17,7 @@ metadata:
{{- with .Values.backend.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
spec:
{{- if not .Values.backend.autoscaling.enabled }}
replicas: {{ .Values.backend.replicas }}

@ -6,6 +6,7 @@ metadata:
namespace: {{ $.Release.Namespace }}
labels:
{{- include "loki.gatewayLabels" . | nindent 4 }}
{{- if or (not (empty .Values.loki.annotations)) (not (empty .Values.backend.annotations))}}
annotations:
{{- with .Values.loki.annotations }}
{{- toYaml . | nindent 4 }}
@ -13,6 +14,7 @@ metadata:
{{- with .Values.gateway.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
spec:
{{- if not .Values.gateway.autoscaling.enabled }}
replicas: {{ .Values.gateway.replicas }}

@ -18,10 +18,10 @@ spec:
{{- end }}
template:
metadata:
{{- with .annotations }}
annotations:
{{- with .annotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
labels:
{{- include "loki-canary.selectorLabels" $ | nindent 8 }}
{{- with .podLabels }}

@ -8,8 +8,8 @@ metadata:
namespace: {{ $.Release.Namespace }}
labels:
{{- include "loki-canary.labels" $ | nindent 4 }}
annotations:
{{- with .annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ $.Values.serviceAccount.automountServiceAccountToken }}

@ -9,6 +9,7 @@ metadata:
labels:
app.kubernetes.io/part-of: memberlist
{{- include "loki.readLabels" . | nindent 4 }}
{{- if or (not (empty .Values.loki.annotations)) (not (empty .Values.backend.annotations))}}
annotations:
{{- with .Values.loki.annotations }}
{{- toYaml . | nindent 4 }}
@ -16,6 +17,7 @@ metadata:
{{- with .Values.read.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
spec:
{{- if not .Values.read.autoscaling.enabled }}
replicas: {{ .Values.read.replicas }}

@ -9,6 +9,7 @@ metadata:
labels:
{{- include "loki.singleBinaryLabels" . | nindent 4 }}
app.kubernetes.io/part-of: memberlist
{{- if or (not (empty .Values.loki.annotations)) (not (empty .Values.backend.annotations))}}
annotations:
{{- with .Values.loki.annotations }}
{{- toYaml . | nindent 4 }}
@ -16,6 +17,7 @@ metadata:
{{- with .Values.singleBinary.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
spec:
replicas: {{ include "loki.singleBinaryReplicas" . }}
podManagementPolicy: Parallel

@ -8,6 +8,7 @@ metadata:
labels:
{{- include "loki.writeLabels" . | nindent 4 }}
app.kubernetes.io/part-of: memberlist
{{- if or (not (empty .Values.loki.annotations)) (not (empty .Values.backend.annotations))}}
annotations:
{{- with .Values.loki.annotations }}
{{- toYaml . | nindent 4 }}
@ -15,6 +16,7 @@ metadata:
{{- with .Values.write.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
spec:
{{- if not .Values.write.autoscaling.enabled }}
replicas: {{ .Values.write.replicas }}

Loading…
Cancel
Save