mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 02:09:56 +00:00
Merge pull request #90373 from fabiokung/updated-annotations-during-bind
kube-scheduler: compatibility with ServerSideApply
This commit is contained in:
commit
6107b140ae
@ -335,6 +335,9 @@ func (sched *Scheduler) skipPodUpdate(pod *v1.Pod) bool {
|
|||||||
// Annotations must be excluded for the reasons described in
|
// Annotations must be excluded for the reasons described in
|
||||||
// https://github.com/kubernetes/kubernetes/issues/52914.
|
// https://github.com/kubernetes/kubernetes/issues/52914.
|
||||||
p.Annotations = nil
|
p.Annotations = nil
|
||||||
|
// Same as above, when annotations are modified with ServerSideApply,
|
||||||
|
// ManagedFields may also change and must be excluded
|
||||||
|
p.ManagedFields = nil
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
assumedPodCopy, podCopy := f(assumedPod), f(pod)
|
assumedPodCopy, podCopy := f(assumedPod), f(pod)
|
||||||
|
@ -80,6 +80,85 @@ func TestSkipPodUpdate(t *testing.T) {
|
|||||||
},
|
},
|
||||||
expected: true,
|
expected: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "with ServerSideApply changes on Annotations",
|
||||||
|
pod: &v1.Pod{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: "pod-0",
|
||||||
|
Annotations: map[string]string{"a": "b"},
|
||||||
|
ResourceVersion: "0",
|
||||||
|
ManagedFields: []metav1.ManagedFieldsEntry{
|
||||||
|
{
|
||||||
|
Manager: "some-actor",
|
||||||
|
Operation: metav1.ManagedFieldsOperationApply,
|
||||||
|
APIVersion: "v1",
|
||||||
|
FieldsType: "FieldsV1",
|
||||||
|
FieldsV1: &metav1.FieldsV1{
|
||||||
|
Raw: []byte(`
|
||||||
|
"f:metadata": {
|
||||||
|
"f:annotations": {
|
||||||
|
"f:a: {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Spec: v1.PodSpec{
|
||||||
|
NodeName: "node-0",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
isAssumedPodFunc: func(*v1.Pod) bool {
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
getPodFunc: func(*v1.Pod) *v1.Pod {
|
||||||
|
return &v1.Pod{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: "pod-0",
|
||||||
|
Annotations: map[string]string{"a": "c", "d": "e"},
|
||||||
|
ResourceVersion: "1",
|
||||||
|
ManagedFields: []metav1.ManagedFieldsEntry{
|
||||||
|
{
|
||||||
|
Manager: "some-actor",
|
||||||
|
Operation: metav1.ManagedFieldsOperationApply,
|
||||||
|
APIVersion: "v1",
|
||||||
|
FieldsType: "FieldsV1",
|
||||||
|
FieldsV1: &metav1.FieldsV1{
|
||||||
|
Raw: []byte(`
|
||||||
|
"f:metadata": {
|
||||||
|
"f:annotations": {
|
||||||
|
"f:a: {}
|
||||||
|
"f:d: {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Manager: "some-actor",
|
||||||
|
Operation: metav1.ManagedFieldsOperationApply,
|
||||||
|
APIVersion: "v1",
|
||||||
|
FieldsType: "FieldsV1",
|
||||||
|
FieldsV1: &metav1.FieldsV1{
|
||||||
|
Raw: []byte(`
|
||||||
|
"f:metadata": {
|
||||||
|
"f:annotations": {
|
||||||
|
"f:a: {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Spec: v1.PodSpec{
|
||||||
|
NodeName: "node-1",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
expected: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "with changes on Labels",
|
name: "with changes on Labels",
|
||||||
pod: &v1.Pod{
|
pod: &v1.Pod{
|
||||||
|
Loading…
Reference in New Issue
Block a user