Code change:
Expect(err).ToNot(HaveOccurred()) podZone := node.Labels[apis.LabelZoneFailureDomain] <del> // TODO (verult) Consider using node taints to simulate zonal failure instead. By("deleting instance group belonging to pod's zone") // Asynchronously detect a pod reschedule is triggered during/after instance group deletion. waitStatus := make(chan error) go func() { waitStatus <- waitForStatefulSetReplicasNotReady(statefulSet.Name, ns, c) }() cloud, err := gce.GetGCECloud() if err != nil { Expect(err).NotTo(HaveOccurred()) } instanceGroupName := framework.TestContext.CloudConfig.NodeInstanceGroup instanceGroup, err := cloud.GetInstanceGroup(instanceGroupName, podZone) Expect(err).NotTo(HaveOccurred(), "Error getting instance group %s in zone %s", instanceGroupName, podZone) templateName, err := framework.GetManagedInstanceGroupTemplateName(podZone) Expect(err).NotTo(HaveOccurred(), "Error getting instance group template in zone %s", podZone) err = framework.DeleteManagedInstanceGroup(podZone) Expect(err).NotTo(HaveOccurred(), "Error deleting instance group in zone %s", podZone) </del> <ins> By("tainting nodes in the zone the pod is scheduled in") selector := labels.SelectorFromSet(labels.Set(map[string]string{apis.LabelZoneFailureDomain: podZone})) nodesInZone, err := c.CoreV1().Nodes().List(metav1.ListOptions{LabelSelector: selector.String()}) Expect(err).ToNot(HaveOccurred()) removeTaintFunc := addTaint(c, ns, nodesInZone.Items, podZone) </ins> defer func() { <del> framework.Logf("recreating instance group %s", instanceGroup.Name) framework.ExpectNoError(framework.CreateManagedInstanceGroup(instanceGroup.Size, podZone, templateName), "Error recreating instance group %s in zone %s", instanceGroup.Name, podZone) framework.ExpectNoError(framework.WaitForReadyNodes(c, nodeCount, framework.RestartNodeReadyAgainTimeout), "Error waiting for nodes from the new instance group to become ready.") </del> <ins> framework.Logf("removing previously added node taints") removeTaintFunc() </ins> }() <del> err = <-waitStatus Expect(err).ToNot(HaveOccurred(), "Error waiting for replica to be deleted during failover: %v", err) </del> <ins> By("deleting StatefulSet pod") err = c.CoreV1().Pods(ns).Delete(pod.Name, &metav1.DeleteOptions{}) // Verify the pod is scheduled in the other zone. By("verifying the pod is scheduled in a different zone.") var otherZone string if cloudZones[0] == podZone { otherZone = cloudZones[1] } else { otherZone = cloudZones[0] } err = wait.PollImmediate(framework.Poll, statefulSetReadyTimeout, func() (bool, error) { framework.Logf("checking whether new pod is scheduled in zone %q", otherZone) pod = getPod(c, ns, regionalPDLabels) nodeName = pod.Spec.NodeName node, err = c.CoreV1().Nodes().Get(nodeName, metav1.GetOptions{}) if err != nil { return false, nil } newPodZone := node.Labels[apis.LabelZoneFailureDomain] return newPodZone == otherZone, nil }) Expect(err).NotTo(HaveOccurred(), "Error waiting for pod to be scheduled in a different zone (%q): %v", otherZone, err) </ins> err = framework.WaitForStatefulSetReplicasReady(statefulSet.Name, ns, c, 3*time.Second, framework.RestartPodReadyAgainTimeout) if err != nil {

Related discussion:
text: <!-- This form is for bug reports and feature requests ONLY! If you're looking for help check and the . If the matter is security related, please disclose it privately via --Is this a BUG REPORT or FEATURE REQUEST?: What happened: Testgrid: https://k8s-
/assign
The test's assumption about test parameter is wrong. Previously it assumed the group name is the same across all zones, but they are different in regional clusters. Looking into using node taints as the permanent fix, as suggested by the TODO comment in the test.
Hm I think taint based evictions is still an alpha feature.
OK. I propose the following solution: Get the zone of Schedule the StatefulSet pod to that zone using node affinity; wait for the pod to run Remove the node affinity from StatefulSet Delete
Can it be simplified? Schedule the pod Figure out which zone that pod got scheduled in Delete the instance group of that zone
Unfortunately I don't know of a good way to look up the instance group given the zone, since there could be instance groups from multiple clusters in the same project
How about: Schedule the pod Figure out the zone Taint all the nodes in the zone Kill the pod
Taint with NoSchedule? yeah that sounds good