implement GetResetFieldsFilter

GetResetFieldsFilter returns a set of fields filter reset
by pod resize strategy. This is needed to make server-side apply
work correctly.
This commit is contained in:
Anish Shah
2024-11-01 12:48:01 -07:00
parent 0a80c5ecb7
commit 4c69bf2496

View File

@@ -321,6 +321,17 @@ func (podResizeStrategy) WarningsOnUpdate(ctx context.Context, obj, old runtime.
return nil return nil
} }
// GetResetFieldsFilter returns a set of fields filter reset by the strategy
// and should not be modified by the user.
func (podResizeStrategy) GetResetFieldsFilter() map[fieldpath.APIVersion]fieldpath.Filter {
return map[fieldpath.APIVersion]fieldpath.Filter{
"v1": fieldpath.NewIncludeMatcherFilter(
fieldpath.MakePrefixMatcherOrDie("spec", "containers", fieldpath.MatchAnyPathElement(), "resources"),
fieldpath.MakePrefixMatcherOrDie("spec", "containers", fieldpath.MatchAnyPathElement(), "resizePolicy"),
),
}
}
// dropPodUpdates drops any changes in the pod. // dropPodUpdates drops any changes in the pod.
func dropPodUpdates(newPod, oldPod *api.Pod) *api.Pod { func dropPodUpdates(newPod, oldPod *api.Pod) *api.Pod {
pod := oldPod.DeepCopy() pod := oldPod.DeepCopy()