Skip to content

Commit

Permalink
Expose config for Watcher performance tuning
Browse files Browse the repository at this point in the history
This changes the watcher to start with a performance config. We expose
ThreadsPerController, QPS and Burst for performance tuning as we do for
pipelines controller.
  • Loading branch information
chmouel committed Nov 4, 2024
1 parent 7c3584b commit 29db090
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion cmd/pipelines-as-code-watcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import (
"time"

"github.com/openshift-pipelines/pipelines-as-code/pkg/reconciler"
"k8s.io/client-go/rest"
"knative.dev/pkg/injection"
"knative.dev/pkg/injection/sharedmain"
"knative.dev/pkg/signals"
)

const globalProbesPort = "8080"
Expand Down Expand Up @@ -44,5 +47,18 @@ func main() {
}()
<-c

sharedmain.Main("pac-watcher", reconciler.NewController())
// This parses flags.
cfg := injection.ParseAndGetRESTConfigOrDie()

if cfg.QPS == 0 {
cfg.QPS = 2 * rest.DefaultQPS
}
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()
sharedmain.MainWithConfig(ctx, "pac-watcher", cfg, reconciler.NewController())
}

0 comments on commit 29db090

Please sign in to comment.