From 5bcdab7c2276b2bc8dfee78aef316ff541baf486 Mon Sep 17 00:00:00 2001 From: reinvantveer Date: Mon, 12 Jul 2021 14:33:35 +0200 Subject: [PATCH] inline "define" templates with simple values now that controller.workflowNamespaces and workflow.namespace are unified into a single "range" iteration Signed-off-by: reinvantveer --- .../templates/controller/workflow-rb.yaml | 26 ++++--------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/charts/argo-workflows/templates/controller/workflow-rb.yaml b/charts/argo-workflows/templates/controller/workflow-rb.yaml index a474692c..9846a5f0 100644 --- a/charts/argo-workflows/templates/controller/workflow-rb.yaml +++ b/charts/argo-workflows/templates/controller/workflow-rb.yaml @@ -1,34 +1,18 @@ -{{- define "workflow-rb-base" }} +{{- if .Values.workflow.rbac.create -}} + {{- range $namespace := append .Values.controller.workflowNamespaces .Values.workflow.namespace | compact | uniq }} --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: -{{- end }} - -{{- define "workflow-rb-roleref" }} + name: {{ template "argo-workflows.fullname" }}-workflow + namespace: {{ $namespace }} roleRef: apiGroup: rbac.authorization.k8s.io kind: Role -{{- end }} - -{{- define "workflow-rb-subjects" }} + name: {{ template "argo-workflows.fullname" $ }}-workflow subjects: - kind: ServiceAccount -{{- end }} - -{{- if .Values.workflow.rbac.create -}} - {{- range $namespace := append .Values.controller.workflowNamespaces .Values.workflow.namespace | compact | uniq }} - - {{ include "workflow-rb-base" . }} - name: {{ template "argo-workflows.fullname" }}-workflow - namespace: {{ $namespace }} - - {{- include "workflow-rb-roleref" . }} - name: {{ template "argo-workflows.fullname" $ }}-workflow - - {{- include "workflow-rb-subjects" . }} name: {{ $.Values.workflow.serviceAccount.name }} namespace: {{ $namespace }} {{- end }} - {{- end }}