Commit ab200721 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #37203 from Random-Liu/fix-restart-test

Automatic merge from submit-queue Filter out non-RestartAlways mirror pod in restart test. Fixes #37202. > A quick fix is to filter out non-RestartAlways pods. Because either RestartNever and RestartOnFailure pods could succeed, and we can not deal with terminated mirror pods very well now. @yujuhong @gmarek /cc @kubernetes/sig-node
parents 27a0a862 d9d148f4
...@@ -32,17 +32,17 @@ import ( ...@@ -32,17 +32,17 @@ import (
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
) )
func isRestartNeverMirrorPod(p *api.Pod) bool { func isNotRestartAlwaysMirrorPod(p *api.Pod) bool {
if !kubepod.IsMirrorPod(p) { if !kubepod.IsMirrorPod(p) {
return false return false
} }
return p.Spec.RestartPolicy == api.RestartPolicyNever return p.Spec.RestartPolicy != api.RestartPolicyAlways
} }
func filterIrrelevantPods(pods []*api.Pod) []*api.Pod { func filterIrrelevantPods(pods []*api.Pod) []*api.Pod {
var results []*api.Pod var results []*api.Pod
for _, p := range pods { for _, p := range pods {
if isRestartNeverMirrorPod(p) { if isNotRestartAlwaysMirrorPod(p) {
// Mirror pods with restart policy == Never will not get // Mirror pods with restart policy == Never will not get
// recreated if they are deleted after the pods have // recreated if they are deleted after the pods have
// terminated. For now, we discount such pods. // terminated. For now, we discount such pods.
......
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