Skip to content

Commit

Permalink
Merge pull request #124517 from wojtek-t/automated-cherry-pick-of-#12…
Browse files Browse the repository at this point in the history
…4352-upstream-release-1.30

Automated cherry pick of #124352: Idempotent transformers in scheduler & kcm
  • Loading branch information
k8s-ci-robot committed Apr 25, 2024
2 parents e717865 + e159496 commit 43a0480
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion cmd/kube-controller-manager/app/controllermanager.go
Expand Up @@ -581,7 +581,9 @@ 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 {
accessor.SetManagedFields(nil)
if accessor.GetManagedFields() != nil {
accessor.SetManagedFields(nil)
}
}
return obj, nil
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/scheduler/scheduler.go
Expand Up @@ -549,7 +549,9 @@ 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 {
accessor.SetManagedFields(nil)
if accessor.GetManagedFields() != nil {
accessor.SetManagedFields(nil)
}
}
return obj, nil
}
Expand Down

0 comments on commit 43a0480

Please sign in to comment.