tektoncd/pipeline
perf: strip ManagedFields from PipelineRun and TaskRun informer caches
Ouverte
#9 573 ouverte le 15 mars 2026
good first issuekind/feature
Métriques du dépôt
- Stars
- (9 013 étoiles)
- Métriques de merge PR
- (Merge moyen 9j 3h) (137 PRs mergées en 30 j)
Description
Feature request
Add SetTransform on PipelineRun and TaskRun shared informers to strip metadata.managedFields on cache insert.
Kubernetes objects carry managedFields which can be 30-70% of the object's serialized size. The Tekton controller never reads managedFields, but every DeepCopy (3-4 per reconcile cycle via the Knative reconciler framework) copies them in full.
Where to add the transform
- PipelineRun informer:
pkg/reconciler/pipelinerun/controller.go(afterNewImpl, beforeAddEventHandler) - TaskRun informer:
pkg/reconciler/taskrun/controller.go(same location)
Implementation
stripManagedFields := func(obj interface{}) (interface{}, error) {
if accessor, ok := obj.(metav1.ObjectMetaAccessor); ok {
accessor.GetObjectMeta().SetManagedFields(nil)
}
return obj, nil
}
if err := pipelineRunInformer.Informer().SetTransform(stripManagedFields); err != nil {
logging.FromContext(ctx).Warnf("Failed to set informer transform: %v", err)
}
Use case
- Reduces memory footprint of the controller's informer caches
- Reduces CPU time spent on
DeepCopyoperations during reconciliation - This pattern is established in the Kubernetes ecosystem (e.g., kube-controller-manager added ManagedFields stripping in k8s 1.27)
SetTransformis available in client-go'sshared_informer.go