Skip to content

feat(pruner): add default resource limits to controller and webhook - #4066

Open
infernus01 wants to merge 1 commit into
tektoncd:mainfrom
infernus01:fix/pruner-limits
Open

infernus01 wants to merge 1 commit into
tektoncd:mainfrom
infernus01:fix/pruner-limits

Conversation

@infernus01

@infernus01 infernus01 commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds default resource requests and limits for tekton-pruner-controller and tekton-pruner-webhook deployments in the operator.

Changes

Modified pkg/reconciler/kubernetes/tektonpruner/transform.go to include a new addDefaultResourceLimits() transformer that injects default
resource specifications:

tekton-pruner-controller

resources:
  requests:
    cpu: 100m
    memory: 256Mi
  limits:
    cpu: 500m
    memory: 2Gi

tekton-pruner-webhook

  resources:
    requests:
      cpu: 50m
      memory: 64Mi
    limits:
      cpu: 250m
      memory: 128Mi

Rationale

Benchmark data: Testing showed the pruner controller uses 846-1126 MB heap memory when tracking 26k-38k resident PipelineRuns in its informer cache.

Override Mechanism

These defaults can be overridden via TektonConfig or TektonPruner CR:

  apiVersion: operator.tekton.dev/v1alpha1
  kind: TektonConfig
  spec:
    pruner:
      options:
        deployments:
        - name: tekton-pruner-controller
          spec:
            template:
              spec:
                containers:
                - name: controller
                  resources:
                    limits:
                      memory: 4Gi  # Override default

The transformer runs before the options transformer, so user-specified values take precedence.

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide for more details.

Release Notes

Operator now applies default resource limits to tekton-pruner-controller (2Gi memory) and tekton-pruner-webhook (512Mi memory) based on benchmark data. CPU limits omitted to avoid throttling. Override via TektonConfig.spec.tektonpruner.options.deployments if needed.

@tekton-robot tekton-robot added the release-note-none Denotes a PR that doesnt merit a release note. label Sep 9, 2026
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 9, 2026
@codecov

codecov Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 27.75%. Comparing base (408ade4) to head (5c94388).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4066      +/-   ##
==========================================
- Coverage   27.79%   27.75%   -0.04%     
==========================================
  Files         477      478       +1     
  Lines       25691    25727      +36     
==========================================
  Hits         7140     7140              
- Misses      17822    17858      +36     
  Partials      729      729              
Flag Coverage Δ
unit-tests 27.75% <ø> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread pkg/reconciler/kubernetes/tektonpruner/transform.go Outdated
Comment thread pkg/reconciler/kubernetes/tektonpruner/transform.go Outdated
Comment thread pkg/reconciler/kubernetes/tektonpruner/transform.go Outdated
@pratap0007

Copy link
Copy Markdown
Contributor

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 15, 2026
@jkhelil

jkhelil commented Sep 16, 2026

Copy link
Copy Markdown
Member

@infernus01 Please addd release note

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesnt merit a release note. labels Sep 18, 2026
@pratap0007

Copy link
Copy Markdown
Contributor

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 21, 2026
Comment thread pkg/reconciler/kubernetes/tektonpruner/transform.go Outdated
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Sep 29, 2026
@tekton-robot

Copy link
Copy Markdown
Contributor

New changes are detected. LGTM label has been removed.

@jkhelil

jkhelil commented Sep 30, 2026

Copy link
Copy Markdown
Member

/approve

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 30, 2026
)

// addDefaultResourceLimits injects pruner-specific resource limits.
func addDefaultResourceLimits() mf.Transformer {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please Move injection into common.AddDefaultResourceRequirements(map[string]ResourceRequirements) and keep values in pruner defaults.go

@jkhelil

jkhelil commented Oct 1, 2026

Copy link
Copy Markdown
Member

/approve cancel

@tekton-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please ask for approval from pratap0007 after the PR has been reviewed.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 1, 2026
Comment thread pkg/reconciler/kubernetes/tektonpruner/transform.go Outdated
Comment thread pkg/reconciler/kubernetes/tektonpruner/defaults.go Outdated
Signed-off-by: Shubham Bhardwaj <shubbhar@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants