From 1818256cdafadfe0c59c1100b1167086bc7ccd14 Mon Sep 17 00:00:00 2001 From: Andy Feller Date: Wed, 1 Jul 2020 22:20:16 -0400 Subject: [PATCH] Using helper for secret name in multiple places --- charts/argocd-notifications/templates/_helpers.tpl | 7 +++++++ charts/argocd-notifications/templates/bots/slack/role.yaml | 2 +- charts/argocd-notifications/templates/secret.yaml | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/charts/argocd-notifications/templates/_helpers.tpl b/charts/argocd-notifications/templates/_helpers.tpl index 18235d26..a4734f71 100644 --- a/charts/argocd-notifications/templates/_helpers.tpl +++ b/charts/argocd-notifications/templates/_helpers.tpl @@ -92,3 +92,10 @@ Create the name of the bot service account to use {{ default "default" .Values.bots.slack.serviceAccount.name }} {{- end -}} {{- end -}} + +{{/* +Create the name of the secret to use +*/}} +{{- define "argocd-notifications.secretName" -}} +{{- printf "%s-secret" (include "argocd-notifications.name" .) -}} +{{- end -}} diff --git a/charts/argocd-notifications/templates/bots/slack/role.yaml b/charts/argocd-notifications/templates/bots/slack/role.yaml index 9055b003..c8cfc58f 100644 --- a/charts/argocd-notifications/templates/bots/slack/role.yaml +++ b/charts/argocd-notifications/templates/bots/slack/role.yaml @@ -18,7 +18,7 @@ rules: - apiGroups: - "" resourceNames: - - argocd-notifications-secret + - {{ include "argocd-notifications.secretName" . }} resources: - secrets verbs: diff --git a/charts/argocd-notifications/templates/secret.yaml b/charts/argocd-notifications/templates/secret.yaml index 359fcc7f..83b5ea59 100644 --- a/charts/argocd-notifications/templates/secret.yaml +++ b/charts/argocd-notifications/templates/secret.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Secret metadata: - name: {{ include "argocd-notifications.name" . }}-secret + name: {{ include "argocd-notifications.secretName" . }} labels: {{- include "argocd-notifications.labels" . | nindent 4 }} type: Opaque