inline "define" templates with simple values now that controller.workflowNamespaces and workflow.namespace are unified into a single "range" iteration

Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl>
This commit is contained in:
reinvantveer 2021-07-12 14:33:35 +02:00
parent 1105f81d96
commit 5bcdab7c22

View file

@ -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 }}