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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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
Copy link
Contributor

openshift-ci bot commented Apr 17, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign heavywombat for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@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 2 times, most recently from 72b4908 to 84df79b Compare April 17, 2025 19:23
Co-authored-by: Benjamin Isinger <benjamin.isinger@ibm.com>
Signed-off-by: Sascha Schwarze <schwarzs@de.ibm.com>
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. 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: Todo
Development

Successfully merging this pull request may close these issues.

2 participants