mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
Do not add unique label to DaemonSet
This commit is contained in:
parent
f43060ea41
commit
52a05d1632
@ -146,20 +146,6 @@ func (dsc *DaemonSetsController) constructHistory(ds *extensions.DaemonSet) (cur
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Label ds with current history's unique label as well
|
|
||||||
if ds.Labels[extensions.DefaultDaemonSetUniqueLabelKey] != cur.Labels[extensions.DefaultDaemonSetUniqueLabelKey] {
|
|
||||||
var clone interface{}
|
|
||||||
clone, err = api.Scheme.DeepCopy(ds)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nil, err
|
|
||||||
}
|
|
||||||
toUpdate := clone.(*extensions.DaemonSet)
|
|
||||||
if toUpdate.Labels == nil {
|
|
||||||
toUpdate.Labels = make(map[string]string)
|
|
||||||
}
|
|
||||||
toUpdate.Labels[extensions.DefaultDaemonSetUniqueLabelKey] = cur.Labels[extensions.DefaultDaemonSetUniqueLabelKey]
|
|
||||||
_, err = dsc.kubeClient.ExtensionsV1beta1().DaemonSets(ds.Namespace).UpdateStatus(toUpdate)
|
|
||||||
}
|
|
||||||
return cur, old, err
|
return cur, old, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,8 +269,7 @@ var _ = framework.KubeDescribe("Daemon set [Serial]", func() {
|
|||||||
ds, err = c.Extensions().DaemonSets(ns).Get(ds.Name, metav1.GetOptions{})
|
ds, err = c.Extensions().DaemonSets(ns).Get(ds.Name, metav1.GetOptions{})
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
first := curHistory(listDaemonHistories(c, ns, label), ds)
|
first := curHistory(listDaemonHistories(c, ns, label), ds)
|
||||||
firstHash := ds.Labels[extensions.DefaultDaemonSetUniqueLabelKey]
|
firstHash := first.Labels[extensions.DefaultDaemonSetUniqueLabelKey]
|
||||||
Expect(first.Labels[extensions.DefaultDaemonSetUniqueLabelKey]).To(Equal(firstHash))
|
|
||||||
Expect(first.Revision).To(Equal(int64(1)))
|
Expect(first.Revision).To(Equal(int64(1)))
|
||||||
checkDaemonSetPodsLabels(listDaemonPods(c, ns, label), firstHash, templateGeneration)
|
checkDaemonSetPodsLabels(listDaemonPods(c, ns, label), firstHash, templateGeneration)
|
||||||
|
|
||||||
@ -296,9 +295,8 @@ var _ = framework.KubeDescribe("Daemon set [Serial]", func() {
|
|||||||
ds, err = c.Extensions().DaemonSets(ns).Get(ds.Name, metav1.GetOptions{})
|
ds, err = c.Extensions().DaemonSets(ns).Get(ds.Name, metav1.GetOptions{})
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
cur := curHistory(listDaemonHistories(c, ns, label), ds)
|
cur := curHistory(listDaemonHistories(c, ns, label), ds)
|
||||||
curHash := ds.Labels[extensions.DefaultDaemonSetUniqueLabelKey]
|
|
||||||
Expect(cur.Labels[extensions.DefaultDaemonSetUniqueLabelKey]).To(Equal(curHash))
|
|
||||||
Expect(cur.Revision).To(Equal(int64(2)))
|
Expect(cur.Revision).To(Equal(int64(2)))
|
||||||
|
Expect(cur.Labels[extensions.DefaultDaemonSetUniqueLabelKey]).NotTo(Equal(firstHash))
|
||||||
checkDaemonSetPodsLabels(listDaemonPods(c, ns, label), firstHash, templateGeneration)
|
checkDaemonSetPodsLabels(listDaemonPods(c, ns, label), firstHash, templateGeneration)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -326,8 +324,7 @@ var _ = framework.KubeDescribe("Daemon set [Serial]", func() {
|
|||||||
ds, err = c.Extensions().DaemonSets(ns).Get(ds.Name, metav1.GetOptions{})
|
ds, err = c.Extensions().DaemonSets(ns).Get(ds.Name, metav1.GetOptions{})
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
cur := curHistory(listDaemonHistories(c, ns, label), ds)
|
cur := curHistory(listDaemonHistories(c, ns, label), ds)
|
||||||
hash := ds.Labels[extensions.DefaultDaemonSetUniqueLabelKey]
|
hash := cur.Labels[extensions.DefaultDaemonSetUniqueLabelKey]
|
||||||
Expect(cur.Labels[extensions.DefaultDaemonSetUniqueLabelKey]).To(Equal(hash))
|
|
||||||
Expect(cur.Revision).To(Equal(int64(1)))
|
Expect(cur.Revision).To(Equal(int64(1)))
|
||||||
checkDaemonSetPodsLabels(listDaemonPods(c, ns, label), hash, fmt.Sprint(templateGeneration))
|
checkDaemonSetPodsLabels(listDaemonPods(c, ns, label), hash, fmt.Sprint(templateGeneration))
|
||||||
|
|
||||||
@ -354,8 +351,7 @@ var _ = framework.KubeDescribe("Daemon set [Serial]", func() {
|
|||||||
ds, err = c.Extensions().DaemonSets(ns).Get(ds.Name, metav1.GetOptions{})
|
ds, err = c.Extensions().DaemonSets(ns).Get(ds.Name, metav1.GetOptions{})
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
cur = curHistory(listDaemonHistories(c, ns, label), ds)
|
cur = curHistory(listDaemonHistories(c, ns, label), ds)
|
||||||
hash = ds.Labels[extensions.DefaultDaemonSetUniqueLabelKey]
|
hash = cur.Labels[extensions.DefaultDaemonSetUniqueLabelKey]
|
||||||
Expect(cur.Labels[extensions.DefaultDaemonSetUniqueLabelKey]).To(Equal(hash))
|
|
||||||
Expect(cur.Revision).To(Equal(int64(2)))
|
Expect(cur.Revision).To(Equal(int64(2)))
|
||||||
checkDaemonSetPodsLabels(listDaemonPods(c, ns, label), hash, fmt.Sprint(templateGeneration))
|
checkDaemonSetPodsLabels(listDaemonPods(c, ns, label), hash, fmt.Sprint(templateGeneration))
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user