mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #92991 from hasheddan/disrupt-dt
Make sure pod tested for eviction with PDB is not scheduled for deletion
This commit is contained in:
commit
60b8693121
@ -276,10 +276,10 @@ var _ = SIGDescribe("DisruptionController", func() {
|
|||||||
createReplicaSetOrDie(cs, ns, 3, false)
|
createReplicaSetOrDie(cs, ns, 3, false)
|
||||||
|
|
||||||
ginkgo.By("First trying to evict a pod which shouldn't be evictable")
|
ginkgo.By("First trying to evict a pod which shouldn't be evictable")
|
||||||
|
waitForPodsOrDie(cs, ns, 3) // make sure that they are running and so would be evictable with a different pdb
|
||||||
|
|
||||||
pod, err := locateRunningPod(cs, ns)
|
pod, err := locateRunningPod(cs, ns)
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
|
|
||||||
waitForPodsOrDie(cs, ns, 3) // make sure that they are running and so would be evictable with a different pdb
|
|
||||||
e := &policyv1beta1.Eviction{
|
e := &policyv1beta1.Eviction{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: pod.Name,
|
Name: pod.Name,
|
||||||
@ -314,9 +314,9 @@ var _ = SIGDescribe("DisruptionController", func() {
|
|||||||
return jsonpatch.CreateMergePatch(oldData, newData)
|
return jsonpatch.CreateMergePatch(oldData, newData)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
waitForPodsOrDie(cs, ns, 3)
|
||||||
pod, err = locateRunningPod(cs, ns) // locate a new running pod
|
pod, err = locateRunningPod(cs, ns) // locate a new running pod
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
waitForPodsOrDie(cs, ns, 3)
|
|
||||||
e = &policyv1beta1.Eviction{
|
e = &policyv1beta1.Eviction{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: pod.Name,
|
Name: pod.Name,
|
||||||
@ -491,7 +491,7 @@ func waitForPodsOrDie(cs kubernetes.Interface, ns string, n int) {
|
|||||||
ready := 0
|
ready := 0
|
||||||
for i := range pods.Items {
|
for i := range pods.Items {
|
||||||
pod := pods.Items[i]
|
pod := pods.Items[i]
|
||||||
if podutil.IsPodReady(&pod) {
|
if podutil.IsPodReady(&pod) && pod.ObjectMeta.DeletionTimestamp.IsZero() {
|
||||||
ready++
|
ready++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -550,7 +550,7 @@ func locateRunningPod(cs kubernetes.Interface, ns string) (pod *v1.Pod, err erro
|
|||||||
|
|
||||||
for i := range podList.Items {
|
for i := range podList.Items {
|
||||||
p := podList.Items[i]
|
p := podList.Items[i]
|
||||||
if podutil.IsPodReady(&p) {
|
if podutil.IsPodReady(&p) && p.ObjectMeta.DeletionTimestamp.IsZero() {
|
||||||
pod = &p
|
pod = &p
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user