From 6e4d3620dacbabaaca479ce03bece3e2d0e3fd8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Blondel?= Date: Wed, 31 Jul 2024 15:31:59 +0200 Subject: [PATCH] fix: broken "| default" logic for automountServiceAccountToken (#665) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When setting (.Values.serviceAccount.operator).automountServiceAccountToken to boolean false, the "| default" part kicks in. Fix is strongly inspired from https://github.com/helm/helm/issues/12080#issuecomment-1555147255 Signed-off-by: François Blondel Co-authored-by: François Blondel --- keda/templates/manager/deployment.yaml | 2 +- keda/templates/manager/serviceaccount.yaml | 2 +- keda/templates/metrics-server/deployment.yaml | 2 +- keda/templates/metrics-server/serviceaccount.yaml | 2 +- keda/templates/webhooks/deployment.yaml | 2 +- keda/templates/webhooks/serviceaccount.yaml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/keda/templates/manager/deployment.yaml b/keda/templates/manager/deployment.yaml index 7751fef1..91821bb2 100644 --- a/keda/templates/manager/deployment.yaml +++ b/keda/templates/manager/deployment.yaml @@ -53,7 +53,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ (.Values.serviceAccount.operator).name | default .Values.serviceAccount.name }} - automountServiceAccountToken: {{ (.Values.serviceAccount.operator).automountServiceAccountToken | default .Values.serviceAccount.automountServiceAccountToken }} + automountServiceAccountToken: {{ kindIs "invalid" (.Values.serviceAccount.operator).automountServiceAccountToken | ternary .Values.serviceAccount.automountServiceAccountToken (.Values.serviceAccount.operator).automountServiceAccountToken }} securityContext: {{- if .Values.podSecurityContext.operator }} {{- toYaml .Values.podSecurityContext.operator | nindent 8 }} diff --git a/keda/templates/manager/serviceaccount.yaml b/keda/templates/manager/serviceaccount.yaml index 00888198..6449adaf 100644 --- a/keda/templates/manager/serviceaccount.yaml +++ b/keda/templates/manager/serviceaccount.yaml @@ -45,5 +45,5 @@ metadata: {{- end }} name: {{ (.Values.serviceAccount.operator).name | default .Values.serviceAccount.name }} namespace: {{ .Release.Namespace }} -automountServiceAccountToken: {{ (.Values.serviceAccount.operator).automountServiceAccountToken | default .Values.serviceAccount.automountServiceAccountToken }} +automountServiceAccountToken: {{ kindIs "invalid" (.Values.serviceAccount.operator).automountServiceAccountToken | ternary .Values.serviceAccount.automountServiceAccountToken (.Values.serviceAccount.operator).automountServiceAccountToken }} {{- end -}} diff --git a/keda/templates/metrics-server/deployment.yaml b/keda/templates/metrics-server/deployment.yaml index 91628b26..919eed14 100644 --- a/keda/templates/metrics-server/deployment.yaml +++ b/keda/templates/metrics-server/deployment.yaml @@ -52,7 +52,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ (.Values.serviceAccount.metricServer).name | default .Values.serviceAccount.name }} - automountServiceAccountToken: {{ (.Values.serviceAccount.metricServer).automountServiceAccountToken | default .Values.serviceAccount.automountServiceAccountToken }} + automountServiceAccountToken: {{ kindIs "invalid" (.Values.serviceAccount.metricServer).automountServiceAccountToken | ternary .Values.serviceAccount.automountServiceAccountToken (.Values.serviceAccount.metricServer).automountServiceAccountToken }} securityContext: {{- if .Values.podSecurityContext.metricServer }} {{- toYaml .Values.podSecurityContext.metricServer | nindent 8 }} diff --git a/keda/templates/metrics-server/serviceaccount.yaml b/keda/templates/metrics-server/serviceaccount.yaml index 7227699a..67e3b67b 100644 --- a/keda/templates/metrics-server/serviceaccount.yaml +++ b/keda/templates/metrics-server/serviceaccount.yaml @@ -14,5 +14,5 @@ metadata: {{- end }} name: {{ (.Values.serviceAccount.metricServer).name | default .Values.serviceAccount.name }} namespace: {{ .Release.Namespace }} -automountServiceAccountToken: {{ (.Values.serviceAccount.metricServer).automountServiceAccountToken | default .Values.serviceAccount.automountServiceAccountToken }} +automountServiceAccountToken: {{ kindIs "invalid" (.Values.serviceAccount.metricServer).automountServiceAccountToken | ternary .Values.serviceAccount.automountServiceAccountToken (.Values.serviceAccount.metricServer).automountServiceAccountToken }} {{- end -}} diff --git a/keda/templates/webhooks/deployment.yaml b/keda/templates/webhooks/deployment.yaml index 680401a5..b5b5e0f6 100644 --- a/keda/templates/webhooks/deployment.yaml +++ b/keda/templates/webhooks/deployment.yaml @@ -51,7 +51,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ (.Values.serviceAccount.webhooks).name | default .Values.serviceAccount.name }} - automountServiceAccountToken: {{ (.Values.serviceAccount.webhooks).automountServiceAccountToken | default .Values.serviceAccount.automountServiceAccountToken }} + automountServiceAccountToken: {{ kindIs "invalid" (.Values.serviceAccount.webhooks).automountServiceAccountToken | ternary .Values.serviceAccount.automountServiceAccountToken (.Values.serviceAccount.webhooks).automountServiceAccountToken }} securityContext: {{- if .Values.podSecurityContext.webhooks }} {{- toYaml .Values.podSecurityContext.webhooks | nindent 8 }} diff --git a/keda/templates/webhooks/serviceaccount.yaml b/keda/templates/webhooks/serviceaccount.yaml index da5a83a2..32189023 100644 --- a/keda/templates/webhooks/serviceaccount.yaml +++ b/keda/templates/webhooks/serviceaccount.yaml @@ -14,5 +14,5 @@ metadata: {{- end }} name: {{ (.Values.serviceAccount.webhooks).name | default .Values.serviceAccount.name }} namespace: {{ .Release.Namespace }} -automountServiceAccountToken: {{ (.Values.serviceAccount.webhooks).automountServiceAccountToken | default .Values.serviceAccount.automountServiceAccountToken }} +automountServiceAccountToken: {{ kindIs "invalid" (.Values.serviceAccount.webhooks).automountServiceAccountToken | ternary .Values.serviceAccount.automountServiceAccountToken (.Values.serviceAccount.webhooks).automountServiceAccountToken }} {{- end -}}