Skip to content

Only cache pods and taskruns with the buildrun label #1869

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

SaschaSchwarze0
Copy link
Member

@SaschaSchwarze0 SaschaSchwarze0 commented Apr 17, 2025

Changes

When we create a TaskRun for a BuildRun, then we always add the buildrun.shipwright.io/name label. Tekton also applies this to the pod it creates.

This change configures the cache of our manager to only cache TaskRuns and Pods that have this label. This should bring down the memory usage of our controller a lot, especially when it runs in a cluster that is used for not just Shipwright and has many pods and maybe also taskruns which are not applicable. It may also improve startup time. In my local home cluster, "just" 391 pods and 258 taskruns in total where for each only 25 are BuildRun-related, the memory usage after startup went down from 33 MB to 20 MB.

I had to move up the scheme registration to before initializing the manager to pass it in as the manager needs it for the cache configuration.

Submitter Checklist

  • Includes tests if functionality changed/was added
  • Includes docs if changes are user-facing
  • Set a kind label on this PR
  • Release notes block has been filled in, or marked NONE

See the contributor guide
for details on coding conventions, github and prow interactions, and the code review process.

Release Notes

Improve resource consumption by only caching shipwright-related taskruns and pods

@SaschaSchwarze0 SaschaSchwarze0 added the kind/feature Categorizes issue or PR as related to a new feature. label Apr 17, 2025
@SaschaSchwarze0 SaschaSchwarze0 added this to the release-v0.16.0 milestone Apr 17, 2025
@openshift-ci openshift-ci bot added the release-note Label for when a PR has specified a release note label Apr 17, 2025
@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 17, 2025
@openshift-ci openshift-ci bot requested review from adambkaplan and dorzel April 17, 2025 07:52
@SaschaSchwarze0 SaschaSchwarze0 force-pushed the sascha-configure-cache branch from 75d7377 to c017474 Compare April 17, 2025 19:12
@pull-request-size pull-request-size bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 17, 2025
@SaschaSchwarze0 SaschaSchwarze0 force-pushed the sascha-configure-cache branch 3 times, most recently from 84df79b to 12cbd8b Compare April 17, 2025 19:24
Copy link
Contributor

@dorzel dorzel left a comment

Choose a reason for hiding this comment

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

This LGTM - I'm assuming the cache behavior before was to cache all pods and TaskRuns on the cluster? If so, it makes sense to only cache what we care about for the controller.

Co-authored-by: Benjamin Isinger <[email protected]>
Signed-off-by: Sascha Schwarze <[email protected]>
@SaschaSchwarze0 SaschaSchwarze0 force-pushed the sascha-configure-cache branch from 12cbd8b to 4c70d2c Compare May 15, 2025 12:35
@qu1queee qu1queee requested review from qu1queee and removed request for adambkaplan and karanibm6 May 19, 2025 08:59
Copy link
Contributor

@qu1queee qu1queee left a comment

Choose a reason for hiding this comment

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

/approve
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label May 19, 2025
Copy link
Contributor

openshift-ci bot commented May 19, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: qu1queee

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

The pull request process is described here

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 19, 2025
@openshift-merge-bot openshift-merge-bot bot merged commit 2359c11 into shipwright-io:main May 19, 2025
41 of 45 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Shipwright Overview May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Label for when a PR has specified a release note size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants