From 05e5c3699aa735550a16e5357ecdcf7d9ea53540 Mon Sep 17 00:00:00 2001 From: Paolo Quadri Date: Mon, 5 Feb 2024 10:01:59 +0100 Subject: [PATCH] fix: controller option to not watch configmap Signed-off-by: Paolo Quadri --- .spelling | 2 ++ docs/environment-variables.md | 1 + workflow/controller/controller.go | 6 +++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.spelling b/.spelling index 31ce1f68aed4..c35ea586f638 100644 --- a/.spelling +++ b/.spelling @@ -38,6 +38,8 @@ CloudSQL ClusterRoleBinding ClusterRoles Codespaces +ConfigMap +ConfigMaps Couler CronWorkflow CronWorkflows diff --git a/docs/environment-variables.md b/docs/environment-variables.md index 67e3f5fc9783..f0d2b8829ba3 100644 --- a/docs/environment-variables.md +++ b/docs/environment-variables.md @@ -53,6 +53,7 @@ This document outlines environment variables that can be used to customize behav | `WF_DEL_PROPAGATION_POLICY` | `string` | `""` | The deletion propagation policy for workflows. | | `WORKFLOW_GC_PERIOD` | `time.Duration` | `5m` | The periodicity for GC of workflows. | | `SEMAPHORE_NOTIFY_DELAY` | `time.Duration` | `1s` | Tuning Delay when notifying semaphore waiters about availability in the semaphore | +| `WATCH_CONFIGMAPS` | `bool` | `true` | Whether to watch the Controller's ConfigMap and semaphore ConfigMaps for run-time changes. When disabled, the Controller will only read ConfigMaps once and will have to be manually restarted to pick up new changes. | CLI parameters of the Controller can be specified as environment variables with the `ARGO_` prefix. For example: diff --git a/workflow/controller/controller.go b/workflow/controller/controller.go index 56a08fe560df..028c394db739 100644 --- a/workflow/controller/controller.go +++ b/workflow/controller/controller.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "os" "strconv" "strings" gosync "sync" @@ -308,7 +309,10 @@ func (wfc *WorkflowController) Run(ctx context.Context, wfWorkers, workflowTTLWo log.Fatal(err) } - go wfc.runConfigMapWatcher(ctx.Done()) + if os.Getenv("WATCH_CONFIGMAPS") != "false" { + go wfc.runConfigMapWatcher(ctx.Done()) + } + go wfc.wfInformer.Run(ctx.Done()) go wfc.wftmplInformer.Informer().Run(ctx.Done()) go wfc.podInformer.Run(ctx.Done())