Using helper for secret name in multiple places

This commit is contained in:
Andy Feller 2020-07-01 22:20:16 -04:00
parent 6a001fe940
commit 1818256cda
3 changed files with 9 additions and 2 deletions

View file

@ -92,3 +92,10 @@ Create the name of the bot service account to use
{{ default "default" .Values.bots.slack.serviceAccount.name }} {{ default "default" .Values.bots.slack.serviceAccount.name }}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{/*
Create the name of the secret to use
*/}}
{{- define "argocd-notifications.secretName" -}}
{{- printf "%s-secret" (include "argocd-notifications.name" .) -}}
{{- end -}}

View file

@ -18,7 +18,7 @@ rules:
- apiGroups: - apiGroups:
- "" - ""
resourceNames: resourceNames:
- argocd-notifications-secret - {{ include "argocd-notifications.secretName" . }}
resources: resources:
- secrets - secrets
verbs: verbs:

View file

@ -2,7 +2,7 @@
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
name: {{ include "argocd-notifications.name" . }}-secret name: {{ include "argocd-notifications.secretName" . }}
labels: labels:
{{- include "argocd-notifications.labels" . | nindent 4 }} {{- include "argocd-notifications.labels" . | nindent 4 }}
type: Opaque type: Opaque