Skip to content

Commit

Permalink
Allow disabling HA with PAC_DISABLE_HA
Browse files Browse the repository at this point in the history
Since we move to our custom config in
29db090 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 <[email protected]>
  • Loading branch information
chmouel committed Nov 6, 2024
1 parent cf499ef commit 3e8567c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/pipelines-as-code-watcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"log"
"net/http"
"os"
"strings"
"time"

"github.com/openshift-pipelines/pipelines-as-code/pkg/reconciler"
Expand Down Expand Up @@ -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())
}

0 comments on commit 3e8567c

Please sign in to comment.