From 797fe0a3698a9a27709a3f599425bd6a9f6ef422 Mon Sep 17 00:00:00 2001 From: reinvantveer Date: Mon, 19 Jul 2021 08:58:55 +0200 Subject: [PATCH] fix namespace range with additional check for either single namespace being false, or append to the workflow namespaces: the first non-null (coalesce) from the workflow namespace or the namespace Argo is being deployed to. Signed-off-by: reinvantveer --- charts/argo-workflows/templates/controller/workflow-rb.yaml | 2 +- charts/argo-workflows/templates/controller/workflow-role.yaml | 2 +- charts/argo-workflows/templates/controller/workflow-sa.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/argo-workflows/templates/controller/workflow-rb.yaml b/charts/argo-workflows/templates/controller/workflow-rb.yaml index c13f31f8..004d40d0 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 := .Values.singeNamespace | ternary (list "") (append .Values.controller.workflowNamespaces .Values.workflow.namespace | compact | uniq) }} + {{- range $namespace := or .Values.singeNamespace false | ternary (list "") (append .Values.controller.workflowNamespaces (coalesce .Values.workflow.namespace .Release.Namespace) | 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 39d759b3..4ca10e8e 100644 --- a/charts/argo-workflows/templates/controller/workflow-role.yaml +++ b/charts/argo-workflows/templates/controller/workflow-role.yaml @@ -1,5 +1,5 @@ {{- if .Values.workflow.rbac.create -}} - {{- range $namespace := .Values.singeNamespace | ternary (list "") (append .Values.controller.workflowNamespaces .Values.workflow.namespace | compact | uniq) }} + {{- range $namespace := or .Values.singeNamespace false | ternary (list "") (append .Values.controller.workflowNamespaces (coalesce .Values.workflow.namespace .Release.Namespace) | 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 3d4e7bdd..2226a631 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 := .Values.singeNamespace | ternary (list "") (append .Values.controller.workflowNamespaces .Values.workflow.namespace | compact | uniq) }} + {{- range $namespace := or .Values.singeNamespace false | ternary (list "") (append .Values.controller.workflowNamespaces (coalesce .Values.workflow.namespace .Release.Namespace) | uniq) }} --- apiVersion: v1 kind: ServiceAccount