From 42af0f9739de1be2223467817e84b8b4fcde0784 Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Mon, 25 Nov 2024 19:35:46 +0100 Subject: [PATCH] fix(serviceAccount): remove top level dict .spec --- .../serviceAccount.yaml | 19 +++++++++---------- unittests/serviceAccounts/serviceAccount.yaml | 12 ++++++------ 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/templates/prometheus-postgres-exporter/serviceAccount.yaml b/templates/prometheus-postgres-exporter/serviceAccount.yaml index a395fea..cbe6e90 100644 --- a/templates/prometheus-postgres-exporter/serviceAccount.yaml +++ b/templates/prometheus-postgres-exporter/serviceAccount.yaml @@ -13,14 +13,13 @@ metadata: {{- end }} name: {{ include "prometheus-postgres-exporter.fullname" . }} namespace: {{ .Release.Namespace }} -spec: - automountServiceAccountToken: {{ .Values.serviceAccount.new.automountServiceAccountToken }} - {{- with .Values.serviceAccount.new.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 4 }} - {{- end }} - {{- with .Values.serviceAccount.new.secrets }} - secrets: - {{- toYaml . | nindent 4 }} - {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.new.automountServiceAccountToken }} +{{- with .Values.serviceAccount.new.imagePullSecrets }} +imagePullSecrets: + {{- toYaml . | nindent 4 }} +{{- end }} +{{- with .Values.serviceAccount.new.secrets }} +secrets: + {{- toYaml . | nindent 4 }} +{{- end }} {{- end }} \ No newline at end of file diff --git a/unittests/serviceAccounts/serviceAccount.yaml b/unittests/serviceAccounts/serviceAccount.yaml index 5f1d4cf..94b9ea0 100644 --- a/unittests/serviceAccounts/serviceAccount.yaml +++ b/unittests/serviceAccounts/serviceAccount.yaml @@ -29,12 +29,12 @@ tests: - notExists: path: metadata.labels - equal: - path: spec.automountServiceAccountToken + path: automountServiceAccountToken value: true - notExists: - path: spec.imagePullSecrets + path: imagePullSecrets - notExists: - path: spec.secrets + path: secrets - it: Rendering serviceAccount with custom values. @@ -65,14 +65,14 @@ tests: path: metadata.name value: prometheus-postgres-exporter-unittest - equal: - path: spec.automountServiceAccountToken + path: automountServiceAccountToken value: false - equal: - path: spec.imagePullSecrets + path: imagePullSecrets value: - name: "my-pull-secret" - equal: - path: spec.secrets + path: secrets value: - name: "my-secret" namespace: "my-namespace"