From 1105f81d96a668e3ce12a01af4e656f2f32dfa52 Mon Sep 17 00:00:00 2001 From: reinvantveer Date: Mon, 12 Jul 2021 14:31:47 +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-role.yaml | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/charts/argo-workflows/templates/controller/workflow-role.yaml b/charts/argo-workflows/templates/controller/workflow-role.yaml index 906d7e2f..af1b4cf5 100644 --- a/charts/argo-workflows/templates/controller/workflow-role.yaml +++ b/charts/argo-workflows/templates/controller/workflow-role.yaml @@ -1,13 +1,12 @@ -{{- define "workflow-role-base" }} +{{- if .Values.workflow.rbac.create -}} + + {{- range $namespace := append .Values.controller.workflowNamespaces .Values.workflow.namespace | compact | uniq }} --- apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: -{{- end }} - -{{/* workflow-role-rules are defined separately so they can be inserted after templating the metadata */}} - -{{- define "workflow-role-rules" }} + name: {{ template "argo-workflows.fullname" $ }}-workflow + namespace: {{ $namespace }} rules: - apiGroups: - "" @@ -24,15 +23,6 @@ rules: verbs: - get - watch -{{- end }} - -{{- if .Values.workflow.rbac.create -}} - - {{- range $namespace := append .Values.controller.workflowNamespaces .Values.workflow.namespace | compact | uniq }} - {{- include "workflow-role-base" . }} - name: {{ template "argo-workflows.fullname" $ }}-workflow - namespace: {{ $namespace }} - {{- include "workflow-role-rules" . }} {{- end }} {{- end }}