Partial fix for issue #14263
This commit is contained in:
parent
8dff00a94a
commit
32f56619a7
@ -400,6 +400,7 @@ func updateAnnotations(existing, ref *api.Pod) {
|
|||||||
|
|
||||||
func podsDifferSemantically(existing, ref *api.Pod) bool {
|
func podsDifferSemantically(existing, ref *api.Pod) bool {
|
||||||
if reflect.DeepEqual(existing.Spec, ref.Spec) &&
|
if reflect.DeepEqual(existing.Spec, ref.Spec) &&
|
||||||
|
reflect.DeepEqual(existing.Labels, ref.Labels) &&
|
||||||
reflect.DeepEqual(existing.DeletionTimestamp, ref.DeletionTimestamp) &&
|
reflect.DeepEqual(existing.DeletionTimestamp, ref.DeletionTimestamp) &&
|
||||||
reflect.DeepEqual(existing.DeletionGracePeriodSeconds, ref.DeletionGracePeriodSeconds) &&
|
reflect.DeepEqual(existing.DeletionGracePeriodSeconds, ref.DeletionGracePeriodSeconds) &&
|
||||||
isAnnotationMapEqual(existing.Annotations, ref.Annotations) {
|
isAnnotationMapEqual(existing.Annotations, ref.Annotations) {
|
||||||
@ -423,6 +424,7 @@ func checkAndUpdatePod(existing, ref *api.Pod) bool {
|
|||||||
ref.Annotations[kubelet.ConfigFirstSeenAnnotationKey] = existing.Annotations[kubelet.ConfigFirstSeenAnnotationKey]
|
ref.Annotations[kubelet.ConfigFirstSeenAnnotationKey] = existing.Annotations[kubelet.ConfigFirstSeenAnnotationKey]
|
||||||
|
|
||||||
existing.Spec = ref.Spec
|
existing.Spec = ref.Spec
|
||||||
|
existing.Labels = ref.Labels
|
||||||
existing.DeletionTimestamp = ref.DeletionTimestamp
|
existing.DeletionTimestamp = ref.DeletionTimestamp
|
||||||
existing.DeletionGracePeriodSeconds = ref.DeletionGracePeriodSeconds
|
existing.DeletionGracePeriodSeconds = ref.DeletionGracePeriodSeconds
|
||||||
updateAnnotations(existing, ref)
|
updateAnnotations(existing, ref)
|
||||||
|
@ -298,3 +298,26 @@ func TestPodUpdateAnnotations(t *testing.T) {
|
|||||||
channel <- podUpdate
|
channel <- podUpdate
|
||||||
expectPodUpdate(t, ch, CreatePodUpdate(kubelet.UPDATE, TestSource, pod))
|
expectPodUpdate(t, ch, CreatePodUpdate(kubelet.UPDATE, TestSource, pod))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestPodUpdateLables(t *testing.T) {
|
||||||
|
channel, ch, _ := createPodConfigTester(PodConfigNotificationIncremental)
|
||||||
|
|
||||||
|
pod := CreateValidPod("foo2", "new")
|
||||||
|
pod.Labels = make(map[string]string, 0)
|
||||||
|
pod.Labels["key"] = "value"
|
||||||
|
|
||||||
|
clone, err := conversion.NewCloner().DeepCopy(pod)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("%v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
podUpdate := CreatePodUpdate(kubelet.SET, TestSource, clone.(*api.Pod))
|
||||||
|
channel <- podUpdate
|
||||||
|
expectPodUpdate(t, ch, CreatePodUpdate(kubelet.ADD, TestSource, pod))
|
||||||
|
|
||||||
|
pod.Labels["key"] = "newValue"
|
||||||
|
podUpdate = CreatePodUpdate(kubelet.SET, TestSource, pod)
|
||||||
|
channel <- podUpdate
|
||||||
|
expectPodUpdate(t, ch, CreatePodUpdate(kubelet.UPDATE, TestSource, pod))
|
||||||
|
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user