fix readiness flake in UnhealthyPodEvictionPolicy

This commit is contained in:
Filip Křepinský 2024-07-02 00:15:59 +02:00
parent 79fee524e6
commit 3f8d799c9f

View File

@ -474,7 +474,7 @@ var _ = SIGDescribe("DisruptionController", func() {
rs.Labels["name"] = rsName
initialDelaySeconds := framework.PodStartTimeout.Seconds() + 30
if tc.podsShouldBecomeReadyFirst {
initialDelaySeconds = 0
initialDelaySeconds = 20
}
rs.Spec.Template.Spec.Containers[0].ReadinessProbe = &v1.Probe{
ProbeHandler: v1.ProbeHandler{
@ -511,6 +511,9 @@ var _ = SIGDescribe("DisruptionController", func() {
Namespace: ns,
},
}
// New pods can be created between the evictions by a replica set controller.
// This can affect the PDB, and pods could potentially be evicted that shouldn't be.
// To prevent this, there should always be a sufficient pod readiness delay (see initialDelaySeconds).
err = cs.CoreV1().Pods(ns).EvictV1(ctx, e)
if err == nil {
evictedPods.Insert(pod.Name)