From dc452bd7d152252517c0ce9cc899d62c66e5bcba Mon Sep 17 00:00:00 2001 From: Trevor Whitney Date: Fri, 21 Oct 2022 10:45:16 -0600 Subject: [PATCH] [helm] Mimic loki service account with canary account (#7236) **What this PR does / why we need it**: Bring the Loki Canary service account in line with the Loki service account, removing the post install hook, and sharing the top level properties for `automountServiceAccountToken` and `imagePullSecrets`. I'm open to creating canary specific values for these setting if needed, but want to start by sharing the top level values to reduce config if possible. Also default canary to Appversion to be in sync with default Loki version **Which issue(s) this PR fixes**: Fixes two issues raised in comments from @towolf (thanks!) on this [PR](https://github.com/grafana/loki/pull/7173#issuecomment-1256410181). Fixes #7237 --- production/helm/loki/templates/loki-canary/_helpers.tpl | 2 +- .../helm/loki/templates/loki-canary/serviceaccount.yaml | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/production/helm/loki/templates/loki-canary/_helpers.tpl b/production/helm/loki/templates/loki-canary/_helpers.tpl index f4cddcac1dcb5..6ef5064c3cf8a 100644 --- a/production/helm/loki/templates/loki-canary/_helpers.tpl +++ b/production/helm/loki/templates/loki-canary/_helpers.tpl @@ -25,7 +25,7 @@ app.kubernetes.io/component: canary Docker image name for loki-canary */}} {{- define "loki-canary.image" -}} -{{- $dict := dict "service" .Values.monitoring.selfMonitoring.lokiCanary.image "global" .Values.global.image "defaultVersion" "latest" -}} +{{- $dict := dict "service" .Values.monitoring.selfMonitoring.lokiCanary.image "global" .Values.global.image "defaultVersion" .Chart.AppVersion -}} {{- include "loki.baseImage" $dict -}} {{- end -}} diff --git a/production/helm/loki/templates/loki-canary/serviceaccount.yaml b/production/helm/loki/templates/loki-canary/serviceaccount.yaml index 6bba15ffb12fe..4c19925161275 100644 --- a/production/helm/loki/templates/loki-canary/serviceaccount.yaml +++ b/production/helm/loki/templates/loki-canary/serviceaccount.yaml @@ -7,8 +7,12 @@ metadata: labels: {{- include "loki-canary.labels" . | nindent 4 }} annotations: - "helm.sh/hook": post-install {{- with .Values.monitoring.selfMonitoring.lokiCanary.annotations }} {{- toYaml . | nindent 4 }} {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }} +{{- with .Values.serviceAccount.imagePullSecrets }} +imagePullSecrets: + {{- toYaml . | nindent 2 }} +{{- end }} {{- end }}