Change:
https://k8s- Failed: [] Deployment overlapping deployment should not fight with each other {Kubernetes e2e suite}
https://k8s- Failed: [] Deployment overlapping deployment should not fight with each other {Kubernetes e2e suite}
https://k8s- Failed: [] Deployment overlapping deployment should not fight with each other {Kubernetes e2e suite} Happened on a presubmit run in .
[FLAKE-PING] This flaky-test issue would love to have more attention.
https://k8s- Failed: [] Deployment overlapping deployment should not fight with each other {Kubernetes e2e suite}
https://k8s- Failed: [] Deployment overlapping deployment should not fight with each other {Kubernetes e2e suite}
Looking
Flakes happened when stopping overlapping deployments at clean up step.
You probably need to move the check before the deletionTimestamp check. Just make sure that observedGeneration is updated for the first case.
Because the deployments are overlapping, when deleting one deployment and determining if its RSes are deleted, there might be a race when the other deployment creates an RS
[FLAKE-PING] This flaky-test issue would love to have more attention.

Discussion:
import ( "fmt" <ins> "strings" </ins> "time" . "github.com/onsi/ginkgo"

return deployment, newRS } <ins> func stopDeploymentOverlap(c *clientset.Clientset, oldC client.Interface, ns, deploymentName, overlapWith string) { stopDeploymentMaybeOverlap(c, oldC, ns, deploymentName, overlapWith) } </ins> func stopDeployment(c *clientset.Clientset, oldC client.Interface, ns, deploymentName string) { <ins> stopDeploymentMaybeOverlap(c, oldC, ns, deploymentName, "") } func stopDeploymentMaybeOverlap(c *clientset.Clientset, oldC client.Interface, ns, deploymentName, overlapWith string) { </ins> deployment, err := c.Extensions().Deployments(ns).Get(deploymentName) Expect(err).NotTo(HaveOccurred())

options := api.ListOptions{LabelSelector: selector} rss, err := c.Extensions().ReplicaSets(ns).List(options) Expect(err).NotTo(HaveOccurred()) <del> Expect(rss.Items).Should(HaveLen(0)) </del> <ins> // RSes may be created by overlapping deployments right after this deployment is deleted, ignore them if len(overlapWith) == 0 { Expect(rss.Items).Should(HaveLen(0)) } else { noOverlapRSes := []extensions.ReplicaSet{} for _, rs := range rss.Items { if !strings.HasPrefix(rs.Name, overlapWith) { noOverlapRSes = append(noOverlapRSes, rs) } } Expect(noOverlapRSes).Should(HaveLen(0)) } </ins> framework.Logf("Ensuring deployment %s's Pods were deleted", deploymentName) var pods *api.PodList if err := wait.PollImmediate(time.Second, timeout, func() (bool, error) {

if err != nil { return false, err } <del> if len(pods.Items) == 0 { </del> <ins> // Pods may be created by overlapping deployments right after this deployment is deleted, ignore them if len(overlapWith) == 0 && len(pods.Items) == 0 { </ins> return true, nil <ins> } else if len(overlapWith) != 0 { noOverlapPods := []api.Pod{} for _, pod := range pods.Items { if !strings.HasPrefix(pod.Name, overlapWith) { noOverlapPods = append(noOverlapPods, pod) } } if len(noOverlapPods) == 0 { return true, nil } </ins> } return false, nil }); err != nil {

Expect(rsList.Items[0].Spec.Template.Spec.Containers[0].Image).To(Equal(deploy.Spec.Template.Spec.Containers[0].Image)) By("Deleting the first deployment") <del> stopDeployment(c, f.Client, ns, deploy.Name) </del> <ins> stopDeploymentOverlap(c, f.Client, ns, deploy.Name, deployOverlapping.Name) </ins> // Wait for overlapping annotation cleared By("Waiting for the second deployment to clear overlapping annotation")