diff --git a/pkg/apis/core/types.go b/pkg/apis/core/types.go index 24d4f808c81..04dafb5f999 100644 --- a/pkg/apis/core/types.go +++ b/pkg/apis/core/types.go @@ -2304,6 +2304,7 @@ const ( PodFailed PodPhase = "Failed" // PodUnknown means that for some reason the state of the pod could not be obtained, typically due // to an error in communicating with the host of the pod. + // Deprecated in v1.21: It isn't being set since 2015 (74da3b14b0c0f658b3bb8d2def5094686d0e9095) PodUnknown PodPhase = "Unknown" ) diff --git a/pkg/controller/deployment/recreate.go b/pkg/controller/deployment/recreate.go index 7ac5b2c4519..071f5344fd0 100644 --- a/pkg/controller/deployment/recreate.go +++ b/pkg/controller/deployment/recreate.go @@ -18,7 +18,7 @@ package deployment import ( apps "k8s.io/api/apps/v1" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/kubernetes/pkg/controller" "k8s.io/kubernetes/pkg/controller/deployment/util" @@ -110,7 +110,9 @@ func oldPodsRunning(newRS *apps.ReplicaSet, oldRSs []*apps.ReplicaSet, podMap ma // Don't count pods in terminal state. continue case v1.PodUnknown: - // This happens in situation like when the node is temporarily disconnected from the cluster. + // v1.PodUnknown is a deprecated status. + // This logic is kept for backward compatibility. + // This used to happen in situation like when the node is temporarily disconnected from the cluster. // If we can't be sure that the pod is not running, we have to count it. return true default: diff --git a/staging/src/k8s.io/api/core/v1/types.go b/staging/src/k8s.io/api/core/v1/types.go index 3eadb45674c..64c0e31275b 100644 --- a/staging/src/k8s.io/api/core/v1/types.go +++ b/staging/src/k8s.io/api/core/v1/types.go @@ -2522,6 +2522,7 @@ const ( PodFailed PodPhase = "Failed" // PodUnknown means that for some reason the state of the pod could not be obtained, typically due // to an error in communicating with the host of the pod. + // Deprecated: It isn't being set since 2015 (74da3b14b0c0f658b3bb8d2def5094686d0e9095) PodUnknown PodPhase = "Unknown" ) diff --git a/test/e2e/common/node/container.go b/test/e2e/common/node/container.go index 89efb24ae4b..642bf5b3d89 100644 --- a/test/e2e/common/node/container.go +++ b/test/e2e/common/node/container.go @@ -91,7 +91,8 @@ func (cc *ConformanceContainer) IsReady() (bool, error) { func (cc *ConformanceContainer) GetPhase() (v1.PodPhase, error) { pod, err := cc.PodClient.Get(context.TODO(), cc.podName, metav1.GetOptions{}) if err != nil { - return v1.PodUnknown, err + // it doesn't matter what phase to return as error would not be nil + return v1.PodSucceeded, err } return pod.Status.Phase, nil } diff --git a/test/e2e/storage/persistent_volumes-local.go b/test/e2e/storage/persistent_volumes-local.go index 61a0202d5fc..afb94a53742 100644 --- a/test/e2e/storage/persistent_volumes-local.go +++ b/test/e2e/storage/persistent_volumes-local.go @@ -605,8 +605,7 @@ var _ = utils.SIGDescribe("PersistentVolumes-local ", func() { defer podsLock.Unlock() for _, pod := range podsList.Items { - switch pod.Status.Phase { - case v1.PodSucceeded: + if pod.Status.Phase == v1.PodSucceeded { // Delete pod and its PVCs if err := deletePodAndPVCs(config, &pod); err != nil { return false, err @@ -614,9 +613,6 @@ var _ = utils.SIGDescribe("PersistentVolumes-local ", func() { delete(pods, pod.Name) numFinished++ framework.Logf("%v/%v pods finished", numFinished, totalPods) - case v1.PodUnknown: - return false, fmt.Errorf("pod %v is in %v phase", pod.Name, pod.Status.Phase) - case v1.PodFailed: } }