@@ -28,6 +28,7 @@ import (
28
28
"k8s.io/apimachinery/pkg/api/equality"
29
29
"k8s.io/apimachinery/pkg/api/meta"
30
30
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
31
+ "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
31
32
"k8s.io/apimachinery/pkg/conversion"
32
33
"k8s.io/apimachinery/pkg/runtime"
33
34
"k8s.io/apiserver/pkg/endpoints/metrics"
@@ -152,14 +153,20 @@ func IgnoreManagedFieldsTimestampsTransformer(
152
153
return newObj , nil
153
154
}
154
155
156
+ eqFn := equalities .DeepEqual
157
+ if _ , ok := newObj .(* unstructured.Unstructured ); ok {
158
+ // Use strict equality with unstructured
159
+ eqFn = equalities .DeepEqualWithNilDifferentFromEmpty
160
+ }
161
+
155
162
// This condition ensures the managed fields are always compared first. If
156
163
// this check fails, the if statement will short circuit. If the check
157
164
// succeeds the slow path is taken which compares entire objects.
158
- if ! equalities . DeepEqualWithNilDifferentFromEmpty (oldManagedFields , newManagedFields ) {
165
+ if ! eqFn (oldManagedFields , newManagedFields ) {
159
166
return newObj , nil
160
167
}
161
168
162
- if equalities . DeepEqualWithNilDifferentFromEmpty (newObj , oldObj ) {
169
+ if eqFn (newObj , oldObj ) {
163
170
// Remove any changed timestamps, so that timestamp is not the only
164
171
// change seen by etcd.
165
172
//
0 commit comments