From 3e8567cec13d657fc5077c2b03a612c43099e257 Mon Sep 17 00:00:00 2001 From: Chmouel Boudjnah Date: Wed, 6 Nov 2024 11:09:20 +0100 Subject: [PATCH] Allow disabling HA with PAC_DISABLE_HA Since we move to our custom config in 29db09019a160372f24e7cf40c30a211207faf89 we lost the flag --disable-ha but since it's deprecated we just use our own variable PAC_DISABLE_HA This is useful for testing and debugging to not have the lease getting stuck on multiple watcher. Signed-off-by: Chmouel Boudjnah --- cmd/pipelines-as-code-watcher/main.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/pipelines-as-code-watcher/main.go b/cmd/pipelines-as-code-watcher/main.go index b150e1751..5257bf4bb 100644 --- a/cmd/pipelines-as-code-watcher/main.go +++ b/cmd/pipelines-as-code-watcher/main.go @@ -5,6 +5,7 @@ import ( "log" "net/http" "os" + "strings" "time" "github.com/openshift-pipelines/pipelines-as-code/pkg/reconciler" @@ -56,9 +57,16 @@ func main() { if cfg.Burst == 0 { cfg.Burst = rest.DefaultBurst } + // multiply by no of controllers being created cfg.QPS = 5 * cfg.QPS cfg.Burst = 5 * cfg.Burst ctx := signals.NewContext() + if val, ok := os.LookupEnv("PAC_DISABLE_HA"); ok { + if strings.ToLower(val) == "true" { + ctx = sharedmain.WithHADisabled(ctx) + } + } + sharedmain.MainWithConfig(ctx, "pac-watcher", cfg, reconciler.NewController()) }