Only cache pods and taskruns with the buildrun label #1869
+37
−11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
See the contributor guide
for details on coding conventions, github and prow interactions, and the code review process.
Release Notes