diff --git a/.github/workflows/kind-e2e.yaml b/.github/workflows/kind-e2e.yaml index 60bf099f4a..67f5202fe1 100644 --- a/.github/workflows/kind-e2e.yaml +++ b/.github/workflows/kind-e2e.yaml @@ -32,7 +32,6 @@ jobs: fail-fast: false # Keep running if one leg fails. matrix: pipelines-release: - - v0.41.3 # LTS - v0.44.4 # LTS - v0.47.3 # LTS - v0.50.1 # LTS diff --git a/cmd/controller/main.go b/cmd/controller/main.go index d8541a617f..8d99aa482b 100644 --- a/cmd/controller/main.go +++ b/cmd/controller/main.go @@ -18,6 +18,10 @@ import ( "github.com/tektoncd/chains/pkg/reconciler/pipelinerun" "github.com/tektoncd/chains/pkg/reconciler/taskrun" + + "k8s.io/client-go/rest" + + "knative.dev/pkg/controller" "knative.dev/pkg/injection" "knative.dev/pkg/injection/sharedmain" "knative.dev/pkg/signals" @@ -35,11 +39,22 @@ import ( _ "github.com/sigstore/sigstore/pkg/signature/kms/hashivault" ) -var namespace = flag.String("namespace", "", "Namespace to restrict informer to. Optional, defaults to all namespaces.") - func main() { + flag.IntVar(&controller.DefaultThreadsPerController, "threads-per-controller", controller.DefaultThreadsPerController, "Threads (goroutines) to create per controller") + namespace := flag.String("namespace", "", "Namespace to restrict informer to. Optional, defaults to all namespaces.") + + // This also calls flag.Parse(). + cfg := injection.ParseAndGetRESTConfigOrDie() + + if cfg.QPS == 0 { + cfg.QPS = 2 * rest.DefaultQPS + } + if cfg.Burst == 0 { + cfg.Burst = rest.DefaultBurst + } + flag.Parse() ctx := injection.WithNamespaceScope(signals.NewContext(), *namespace) - sharedmain.MainWithContext(ctx, "watcher", taskrun.NewController, pipelinerun.NewController) + sharedmain.MainWithConfig(ctx, "watcher", cfg, taskrun.NewController, pipelinerun.NewController) } diff --git a/docs/performance.md b/docs/performance.md new file mode 100644 index 0000000000..0043a96520 --- /dev/null +++ b/docs/performance.md @@ -0,0 +1,27 @@ +# Performance + +Tekton Chains exposes a few parameters that can be used to fine tune the controllers execution to +improve its performance as needed. + +The controller accepts the following parameters: + +`--threads-per-controller` controls the number of concurrent threads the Chains controller +processes. The default value is 2. + +`--kube-api-burst` controle the maximum burst for throttle. The default value is 10. + +`--kube-api-qps` controles the maximum QPS to the server from the client. The default value is 5. + +Modify the `Deployment` to use those parameters, for example: + +```yaml +spec: + template: + spec: + containers: + - image: gcr.io/tekton-releases/github.com/tektoncd/chains/cmd/controller:v0.20.0 + args: + - --threads-per-controller=32 + - --kube-api-burst=2 + - --kube-api-qps=3 +```