-
Notifications
You must be signed in to change notification settings - Fork 128
[DNM] Release v0.39.6 #2730
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
theakshaypant
wants to merge
4
commits into
release-v0.39.x
Choose a base branch
from
release-v0.39.6
base: release-v0.39.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[DNM] Release v0.39.6 #2730
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ff5b628
chore(deps): update grpc to v1.79.3
theakshaypant 501cbd0
fix(deps): update go-jose to fix GHSA-78h2-9frx-2jm8
theakshaypant 636bae9
perf(informer): add TransformFuncs to reduce cache memory usage
theakshaypant 54cb7bf
chore(deps): bump tektoncd/pipeline to v1.6.2
theakshaypant File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| // Package transform provides cache transform functions for reducing memory | ||
| // usage in the PAC watcher informer caches. | ||
| // | ||
| // Transform functions are applied to objects before they are stored in the | ||
| // informer cache, allowing us to strip large, unnecessary fields while | ||
| // preserving the data needed for reconciliation. | ||
| // | ||
| // DEVELOPER WARNING: | ||
| // If you add new reconciliation logic that reads a field from cached objects | ||
| // (via listers), you MUST verify that field is not stripped by these transforms. | ||
| // Fields stripped from cached objects will be nil/empty even though they exist | ||
| // in etcd. If you need a stripped field, fetch the full object via the API | ||
| // client instead of the lister. | ||
| package transform | ||
|
|
||
| import ( | ||
| pacv1alpha1 "github.com/openshift-pipelines/pipelines-as-code/pkg/apis/pipelinesascode/v1alpha1" | ||
| tektonv1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1" | ||
| "k8s.io/client-go/tools/cache" | ||
| ) | ||
|
|
||
| // RepositoryForCache strips fields from Repository objects before they are | ||
| // stored in the informer cache to reduce memory usage. | ||
| // | ||
| // Fields stripped: | ||
| // - ManagedFields: written by the API server, not needed for reconciliation | ||
| // - Annotations: no reconciler logic reads Repository annotations from the | ||
| // lister; the largest annotation is kubectl.kubernetes.io/last-applied-configuration | ||
| // - Status: the reconciler always fetches Repository.Status via a direct API | ||
| // call before updating it; it is never read from the lister | ||
| func RepositoryForCache(obj any) (any, error) { | ||
| if tombstone, ok := obj.(cache.DeletedFinalStateUnknown); ok { | ||
| transformed, err := RepositoryForCache(tombstone.Obj) | ||
| if err != nil { | ||
| return obj, nil //nolint:nilerr // return original on error for graceful degradation | ||
| } | ||
| return cache.DeletedFinalStateUnknown{Key: tombstone.Key, Obj: transformed}, nil | ||
| } | ||
|
|
||
| repo, ok := obj.(*pacv1alpha1.Repository) | ||
| if !ok { | ||
| return obj, nil | ||
| } | ||
|
|
||
| repo.ManagedFields = nil | ||
| repo.Annotations = nil | ||
| repo.Status = nil | ||
|
|
||
| return repo, nil | ||
| } | ||
|
|
||
| // PipelineRunForCache strips fields from PipelineRun objects before they are | ||
| // stored in the informer cache to reduce memory usage. | ||
| // | ||
| // Fields the PAC watcher reads from cached PipelineRuns: | ||
| // - ObjectMeta: name, namespace, labels, annotations (PAC state/repo keys), | ||
| // finalizers, deletionTimestamp | ||
| // - Spec.Status: checked for PipelineRunSpecStatusPending | ||
| // - Status.Conditions: checked for completion state and reason | ||
| // - Status.StartTime, Status.CompletionTime: used for metrics | ||
| // | ||
| // All other Spec and Status fields are stripped. When the reconciler needs | ||
| // the full object (e.g. postFinalStatus, GetStatusFromTaskStatusOrFromAsking), | ||
| // it fetches it directly from the API server. | ||
| func PipelineRunForCache(obj any) (any, error) { | ||
| if tombstone, ok := obj.(cache.DeletedFinalStateUnknown); ok { | ||
| transformed, err := PipelineRunForCache(tombstone.Obj) | ||
| if err != nil { | ||
| return obj, nil //nolint:nilerr // return original on error for graceful degradation | ||
| } | ||
| return cache.DeletedFinalStateUnknown{Key: tombstone.Key, Obj: transformed}, nil | ||
| } | ||
|
|
||
| pr, ok := obj.(*tektonv1.PipelineRun) | ||
| if !ok { | ||
| return obj, nil | ||
| } | ||
|
|
||
| pr.ManagedFields = nil | ||
|
|
||
| // Strip large Spec fields β watcher only checks Spec.Status (pending state) | ||
| pr.Spec.PipelineRef = nil | ||
| pr.Spec.PipelineSpec = nil | ||
| pr.Spec.Params = nil | ||
| pr.Spec.Workspaces = nil | ||
| pr.Spec.TaskRunSpecs = nil | ||
| pr.Spec.TaskRunTemplate = tektonv1.PipelineTaskRunTemplate{} | ||
| pr.Spec.Timeouts = nil | ||
|
|
||
| // Strip large Status fields β watcher only reads Conditions, StartTime, CompletionTime | ||
| pr.Status.PipelineSpec = nil | ||
| pr.Status.ChildReferences = nil | ||
| pr.Status.Provenance = nil | ||
| pr.Status.SpanContext = nil | ||
|
|
||
| return pr, nil | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Tekton
v1,PipelineRunSpec.TaskRunTemplateis a pointer (*PipelineTaskRunTemplate). Assigning a zero-value struct (tektonv1.PipelineTaskRunTemplate{}) will cause a compilation error as you cannot assign a struct to a pointer field. It should be set tonilto maintain consistency with the other stripped pointer fields in this function. This in-place modification is the accepted pattern for informer TransformFuncs in this repository.References