Merge pull request #124352 from wojtek-t/idempotent_transformer_func

Idempotent transformers in scheduler & kcm
This commit is contained in:
Kubernetes Prow Robot 2024-04-24 12:35:02 -07:00 committed by GitHub
commit bc05bef903
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -581,8 +581,10 @@ func CreateControllerContext(ctx context.Context, s *config.CompletedConfig, roo
// Informer transform to trim ManagedFields for memory efficiency.
trim := func(obj interface{}) (interface{}, error) {
if accessor, err := meta.Accessor(obj); err == nil {
if accessor.GetManagedFields() != nil {
accessor.SetManagedFields(nil)
}
}
return obj, nil
}

View File

@ -549,8 +549,10 @@ func newPodInformer(cs clientset.Interface, resyncPeriod time.Duration) cache.Sh
// The Extract workflow (i.e. `ExtractPod`) should be unused.
trim := func(obj interface{}) (interface{}, error) {
if accessor, err := meta.Accessor(obj); err == nil {
if accessor.GetManagedFields() != nil {
accessor.SetManagedFields(nil)
}
}
return obj, nil
}
informer.SetTransform(trim)