Commit 8a2c639b authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #36212 from foxish/fix-petset-flake

Automatic merge from submit-queue Set the annotation only if the test requires it. **What this PR does / why we need it**: Fixes StatefulSet flake **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes https://github.com/kubernetes/kubernetes/issues/36107 **Special notes for your reviewer**: We shouldn't be setting the debug annotation in all our tests, only the ones that bring statefulset pods up one after another. In the absence of the annotation, we have the new default behavior governed by https://github.com/kubernetes/kubernetes/pull/35739 **Release note**: ```release-note NONE ``` cc @kubernetes/sig-apps @bprashanth @calebamiles
parents fbe29f43 834c4fc1
...@@ -391,7 +391,6 @@ var _ = framework.KubeDescribe("Network Partition [Disruptive] [Slow]", func() { ...@@ -391,7 +391,6 @@ var _ = framework.KubeDescribe("Network Partition [Disruptive] [Slow]", func() {
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
pst := statefulSetTester{c: c} pst := statefulSetTester{c: c}
pst.saturate(ps)
nn := framework.TestContext.CloudConfig.NumNodes nn := framework.TestContext.CloudConfig.NumNodes
nodeNames, err := framework.CheckNodesReady(f.ClientSet, framework.NodeReadyInitialTimeout, nn) nodeNames, err := framework.CheckNodesReady(f.ClientSet, framework.NodeReadyInitialTimeout, nn)
......
...@@ -103,6 +103,8 @@ var _ = framework.KubeDescribe("StatefulSet [Slow] [Feature:PetSet]", func() { ...@@ -103,6 +103,8 @@ var _ = framework.KubeDescribe("StatefulSet [Slow] [Feature:PetSet]", func() {
petMounts := []api.VolumeMount{{Name: "datadir", MountPath: "/data/"}} petMounts := []api.VolumeMount{{Name: "datadir", MountPath: "/data/"}}
podMounts := []api.VolumeMount{{Name: "home", MountPath: "/home"}} podMounts := []api.VolumeMount{{Name: "home", MountPath: "/home"}}
ps := newStatefulSet(psName, ns, headlessSvcName, 3, petMounts, podMounts, labels) ps := newStatefulSet(psName, ns, headlessSvcName, 3, petMounts, podMounts, labels)
setInitializedAnnotation(ps, "false")
_, err := c.Apps().StatefulSets(ns).Create(ps) _, err := c.Apps().StatefulSets(ns).Create(ps)
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
...@@ -139,6 +141,7 @@ var _ = framework.KubeDescribe("StatefulSet [Slow] [Feature:PetSet]", func() { ...@@ -139,6 +141,7 @@ var _ = framework.KubeDescribe("StatefulSet [Slow] [Feature:PetSet]", func() {
petMounts := []api.VolumeMount{{Name: "datadir", MountPath: "/data/"}} petMounts := []api.VolumeMount{{Name: "datadir", MountPath: "/data/"}}
podMounts := []api.VolumeMount{{Name: "home", MountPath: "/home"}} podMounts := []api.VolumeMount{{Name: "home", MountPath: "/home"}}
ps := newStatefulSet(psName, ns, headlessSvcName, 2, petMounts, podMounts, labels) ps := newStatefulSet(psName, ns, headlessSvcName, 2, petMounts, podMounts, labels)
setInitializedAnnotation(ps, "false")
_, err := c.Apps().StatefulSets(ns).Create(ps) _, err := c.Apps().StatefulSets(ns).Create(ps)
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
...@@ -903,10 +906,8 @@ func newStatefulSet(name, ns, governingSvcName string, replicas int32, petMounts ...@@ -903,10 +906,8 @@ func newStatefulSet(name, ns, governingSvcName string, replicas int32, petMounts
Replicas: replicas, Replicas: replicas,
Template: api.PodTemplateSpec{ Template: api.PodTemplateSpec{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Labels: labels, Labels: labels,
Annotations: map[string]string{ Annotations: map[string]string{},
"pod.alpha.kubernetes.io/initialized": "false",
},
}, },
Spec: api.PodSpec{ Spec: api.PodSpec{
Containers: []api.Container{ Containers: []api.Container{
...@@ -924,3 +925,7 @@ func newStatefulSet(name, ns, governingSvcName string, replicas int32, petMounts ...@@ -924,3 +925,7 @@ func newStatefulSet(name, ns, governingSvcName string, replicas int32, petMounts
}, },
} }
} }
func setInitializedAnnotation(ss *apps.StatefulSet, value string) {
ss.Spec.Template.ObjectMeta.Annotations["pod.alpha.kubernetes.io/initialized"] = value
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment