File tree Expand file tree Collapse file tree 2 files changed +82
-0
lines changed Expand file tree Collapse file tree 2 files changed +82
-0
lines changed Original file line number Diff line number Diff line change @@ -335,6 +335,9 @@ func (sched *Scheduler) skipPodUpdate(pod *v1.Pod) bool {
335
335
// Annotations must be excluded for the reasons described in
336
336
// https://github.com/kubernetes/kubernetes/issues/52914.
337
337
p .Annotations = nil
338
+ // Same as above, when annotations are modified with ServerSideApply,
339
+ // ManagedFields may also change and must be excluded
340
+ p .ManagedFields = nil
338
341
return p
339
342
}
340
343
assumedPodCopy , podCopy := f (assumedPod ), f (pod )
Original file line number Diff line number Diff line change @@ -80,6 +80,85 @@ func TestSkipPodUpdate(t *testing.T) {
80
80
},
81
81
expected : true ,
82
82
},
83
+ {
84
+ name : "with ServerSideApply changes on Annotations" ,
85
+ pod : & v1.Pod {
86
+ ObjectMeta : metav1.ObjectMeta {
87
+ Name : "pod-0" ,
88
+ Annotations : map [string ]string {"a" : "b" },
89
+ ResourceVersion : "0" ,
90
+ ManagedFields : []metav1.ManagedFieldsEntry {
91
+ {
92
+ Manager : "some-actor" ,
93
+ Operation : metav1 .ManagedFieldsOperationApply ,
94
+ APIVersion : "v1" ,
95
+ FieldsType : "FieldsV1" ,
96
+ FieldsV1 : & metav1.FieldsV1 {
97
+ Raw : []byte (`
98
+ "f:metadata": {
99
+ "f:annotations": {
100
+ "f:a: {}
101
+ }
102
+ }
103
+ ` ),
104
+ },
105
+ },
106
+ },
107
+ },
108
+ Spec : v1.PodSpec {
109
+ NodeName : "node-0" ,
110
+ },
111
+ },
112
+ isAssumedPodFunc : func (* v1.Pod ) bool {
113
+ return true
114
+ },
115
+ getPodFunc : func (* v1.Pod ) * v1.Pod {
116
+ return & v1.Pod {
117
+ ObjectMeta : metav1.ObjectMeta {
118
+ Name : "pod-0" ,
119
+ Annotations : map [string ]string {"a" : "c" , "d" : "e" },
120
+ ResourceVersion : "1" ,
121
+ ManagedFields : []metav1.ManagedFieldsEntry {
122
+ {
123
+ Manager : "some-actor" ,
124
+ Operation : metav1 .ManagedFieldsOperationApply ,
125
+ APIVersion : "v1" ,
126
+ FieldsType : "FieldsV1" ,
127
+ FieldsV1 : & metav1.FieldsV1 {
128
+ Raw : []byte (`
129
+ "f:metadata": {
130
+ "f:annotations": {
131
+ "f:a: {}
132
+ "f:d: {}
133
+ }
134
+ }
135
+ ` ),
136
+ },
137
+ },
138
+ {
139
+ Manager : "some-actor" ,
140
+ Operation : metav1 .ManagedFieldsOperationApply ,
141
+ APIVersion : "v1" ,
142
+ FieldsType : "FieldsV1" ,
143
+ FieldsV1 : & metav1.FieldsV1 {
144
+ Raw : []byte (`
145
+ "f:metadata": {
146
+ "f:annotations": {
147
+ "f:a: {}
148
+ }
149
+ }
150
+ ` ),
151
+ },
152
+ },
153
+ },
154
+ },
155
+ Spec : v1.PodSpec {
156
+ NodeName : "node-1" ,
157
+ },
158
+ }
159
+ },
160
+ expected : true ,
161
+ },
83
162
{
84
163
name : "with changes on Labels" ,
85
164
pod : & v1.Pod {
You can’t perform that action at this time.
0 commit comments