From d81cd3855530c7fafa7257c9507ab4e7caa220ca Mon Sep 17 00:00:00 2001 From: Chris Werner Rau Date: Wed, 13 Nov 2024 12:27:31 +0100 Subject: [PATCH] fix(base-cluster): only `toYaml` if field exists (#1226) otherwise `{}` will be inserted, breaking everything --- charts/base-cluster/templates/_helmRelease.yaml | 4 +--- .../templates/cert-manager/rules/certificate-expiration.yaml | 2 +- charts/base-cluster/templates/flux/podMonitor.yaml | 2 +- charts/base-cluster/templates/flux/rules/flux-status.yaml | 2 +- charts/base-cluster/templates/global/namespaces.yaml | 4 +--- .../templates/nfs-server-provisioner/rules/storage-size.yaml | 2 +- 6 files changed, 6 insertions(+), 10 deletions(-) diff --git a/charts/base-cluster/templates/_helmRelease.yaml b/charts/base-cluster/templates/_helmRelease.yaml index f23556428..f545ef477 100644 --- a/charts/base-cluster/templates/_helmRelease.yaml +++ b/charts/base-cluster/templates/_helmRelease.yaml @@ -6,9 +6,7 @@ metadata: name: {{ .name }} namespace: {{ .namespace | default .Release.Namespace }} labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- with .additionalLabels }} - {{- toYaml . | nindent 4 }} - {{- end }} + {{- with .additionalLabels }}{{- toYaml . | nindent 4 }}{{- end }} spec: chart: spec: {{- include "base-cluster.helm.chartSpec" (dict "repo" "cetic" "chart" "static" "context" .context) | nindent 6 }} diff --git a/charts/base-cluster/templates/cert-manager/rules/certificate-expiration.yaml b/charts/base-cluster/templates/cert-manager/rules/certificate-expiration.yaml index a1e9ac4cb..c2c5264a4 100644 --- a/charts/base-cluster/templates/cert-manager/rules/certificate-expiration.yaml +++ b/charts/base-cluster/templates/cert-manager/rules/certificate-expiration.yaml @@ -9,7 +9,7 @@ metadata: name: certificate-expiration namespace: cert-manager labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- toYaml .Values.monitoring.labels | nindent 4 }} + {{- with .Values.monitoring.labels }}{{ toYaml . | nindent 4 }}{{- end }} app.kubernetes.io/component: prometheus app.kubernetes.io/part-of: cert-manager spec: diff --git a/charts/base-cluster/templates/flux/podMonitor.yaml b/charts/base-cluster/templates/flux/podMonitor.yaml index 3f9c40df8..66e9a7344 100644 --- a/charts/base-cluster/templates/flux/podMonitor.yaml +++ b/charts/base-cluster/templates/flux/podMonitor.yaml @@ -9,7 +9,7 @@ metadata: name: flux namespace: {{ .Release.Namespace }} labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- toYaml .Values.monitoring.labels | nindent 4 }} + {{- with .Values.monitoring.labels }}{{- toYaml . | nindent 4 }}{{- end }} app.kubernetes.io/component: prometheus app.kubernetes.io/part-of: flux spec: diff --git a/charts/base-cluster/templates/flux/rules/flux-status.yaml b/charts/base-cluster/templates/flux/rules/flux-status.yaml index 3e43a7e30..c22134b19 100644 --- a/charts/base-cluster/templates/flux/rules/flux-status.yaml +++ b/charts/base-cluster/templates/flux/rules/flux-status.yaml @@ -9,7 +9,7 @@ metadata: name: flux-status namespace: {{ .Release.Namespace }} labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- toYaml .Values.monitoring.labels | nindent 4 }} + {{- with .Values.monitoring.labels }}{{- toYaml . | nindent 4 }}{{- end }} app.kubernetes.io/component: prometheus app.kubernetes.io/part-of: flux spec: diff --git a/charts/base-cluster/templates/global/namespaces.yaml b/charts/base-cluster/templates/global/namespaces.yaml index a7cb4f0a8..894ace98b 100644 --- a/charts/base-cluster/templates/global/namespaces.yaml +++ b/charts/base-cluster/templates/global/namespaces.yaml @@ -4,9 +4,7 @@ kind: Namespace metadata: name: {{ $name }} labels: {{- include "common.labels.standard" $ | nindent 4 -}} - {{- with $namespace.additionalLabels -}} - {{- toYaml . | nindent 4 -}} - {{- end }} + {{- with $namespace.additionalLabels -}}{{- toYaml . | nindent 4 -}}{{- end }} --- apiVersion: v1 kind: LimitRange diff --git a/charts/base-cluster/templates/nfs-server-provisioner/rules/storage-size.yaml b/charts/base-cluster/templates/nfs-server-provisioner/rules/storage-size.yaml index d31939892..724db16b9 100644 --- a/charts/base-cluster/templates/nfs-server-provisioner/rules/storage-size.yaml +++ b/charts/base-cluster/templates/nfs-server-provisioner/rules/storage-size.yaml @@ -9,7 +9,7 @@ metadata: name: storage-size namespace: nfs-server-provisioner labels: {{- include "common.labels.standard" $ | nindent 4 }} - {{- toYaml .Values.monitoring.labels | nindent 4 }} + {{- with .Values.monitoring.labels }}{{- toYaml . | nindent 4 }}{{- end }} app.kubernetes.io/component: prometheus app.kubernetes.io/part-of: nfs-server-provisioner spec: