From 094cd02860911da4e31e0c4f62f964d2f89dbe91 Mon Sep 17 00:00:00 2001 From: reinvantveer Date: Wed, 14 Jul 2021 19:00:24 +0200 Subject: [PATCH] include case for single namespaces with default ("") namespace, otherwise (ternary) combine the workflow namespace and workflowNamespaces from the controller settings into a list to iterate over Signed-off-by: reinvantveer --- charts/argo-workflows/templates/controller/workflow-rb.yaml | 2 +- charts/argo-workflows/templates/controller/workflow-role.yaml | 3 +-- charts/argo-workflows/templates/controller/workflow-sa.yaml | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/charts/argo-workflows/templates/controller/workflow-rb.yaml b/charts/argo-workflows/templates/controller/workflow-rb.yaml index f23675ed..4c72d27c 100644 --- a/charts/argo-workflows/templates/controller/workflow-rb.yaml +++ b/charts/argo-workflows/templates/controller/workflow-rb.yaml @@ -1,5 +1,5 @@ {{- if .Values.workflow.rbac.create -}} - {{- range $namespace := append .Values.controller.workflowNamespaces .Values.workflow.namespace | compact | uniq }} + {{- range $namespace := .Values.singeNamespace | ternary (list "") (concat .Values.workflow.namespace .Values.controller.workflowNamespaces | compact | uniq) }} --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding diff --git a/charts/argo-workflows/templates/controller/workflow-role.yaml b/charts/argo-workflows/templates/controller/workflow-role.yaml index af1b4cf5..bfe63af1 100644 --- a/charts/argo-workflows/templates/controller/workflow-role.yaml +++ b/charts/argo-workflows/templates/controller/workflow-role.yaml @@ -1,6 +1,5 @@ {{- if .Values.workflow.rbac.create -}} - - {{- range $namespace := append .Values.controller.workflowNamespaces .Values.workflow.namespace | compact | uniq }} + {{- range $namespace := .Values.singeNamespace | ternary (list "") (concat .Values.workflow.namespace .Values.controller.workflowNamespaces | compact | uniq) }} --- apiVersion: rbac.authorization.k8s.io/v1 kind: Role diff --git a/charts/argo-workflows/templates/controller/workflow-sa.yaml b/charts/argo-workflows/templates/controller/workflow-sa.yaml index f88d01dd..d910ec16 100644 --- a/charts/argo-workflows/templates/controller/workflow-sa.yaml +++ b/charts/argo-workflows/templates/controller/workflow-sa.yaml @@ -1,5 +1,5 @@ {{- if .Values.workflow.serviceAccount.create -}} - {{ range $namespace := append .Values.controller.workflowNamespaces .Values.workflow.namespace | compact | uniq }} + {{ range $namespace := .Values.singeNamespace | ternary (list "") (concat .Values.workflow.namespace .Values.controller.workflowNamespaces | compact | uniq) }} --- apiVersion: v1 kind: ServiceAccount