From d13a42b6c9a95f42a87b8c4a434c443956f70184 Mon Sep 17 00:00:00 2001 From: Joao Morais Date: Thu, 31 Aug 2023 21:12:43 -0300 Subject: [PATCH] use of automount service account on v1.22 and newer (#75) --- haproxy-ingress/templates/_podtemplate.yaml | 2 ++ haproxy-ingress/templates/serviceaccount.yaml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/haproxy-ingress/templates/_podtemplate.yaml b/haproxy-ingress/templates/_podtemplate.yaml index ea691e0..5b65ef1 100644 --- a/haproxy-ingress/templates/_podtemplate.yaml +++ b/haproxy-ingress/templates/_podtemplate.yaml @@ -18,7 +18,9 @@ spec: {{- toYaml .Values.controller.podAffinity | nindent 4 }} {{- end }} serviceAccountName: {{ include "haproxy-ingress.serviceAccountName" . }} +{{- if semverCompare ">= 1.22-0" .Capabilities.KubeVersion.Version }} automountServiceAccountToken: {{ .Values.controller.automountServiceAccountToken }} +{{- end }} {{- if or .Values.controller.haproxy.enabled .Values.controller.initContainers }} initContainers: {{- if .Values.controller.haproxy.enabled }} diff --git a/haproxy-ingress/templates/serviceaccount.yaml b/haproxy-ingress/templates/serviceaccount.yaml index d52a6c7..7824626 100644 --- a/haproxy-ingress/templates/serviceaccount.yaml +++ b/haproxy-ingress/templates/serviceaccount.yaml @@ -1,7 +1,9 @@ {{- if .Values.serviceAccount.create -}} apiVersion: v1 kind: ServiceAccount +{{- if semverCompare ">= 1.22-0" .Capabilities.KubeVersion.Version }} automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }} +{{- end }} metadata: labels: {{- include "haproxy-ingress.labels" . | nindent 4 }}