mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +00:00
Merge pull request #22570 from janetkuo/inactive-pods-not-available
Auto commit by PR queue bot
This commit is contained in:
commit
d9d0fdecd3
@ -490,9 +490,7 @@ func FilterActivePods(pods []api.Pod) []*api.Pod {
|
||||
var result []*api.Pod
|
||||
for i := range pods {
|
||||
p := pods[i]
|
||||
if api.PodSucceeded != p.Status.Phase &&
|
||||
api.PodFailed != p.Status.Phase &&
|
||||
p.DeletionTimestamp == nil {
|
||||
if IsPodActive(p) {
|
||||
result = append(result, &p)
|
||||
} else {
|
||||
glog.V(4).Infof("Ignoring inactive pod %v/%v in state %v, deletion time %v",
|
||||
@ -502,6 +500,12 @@ func FilterActivePods(pods []api.Pod) []*api.Pod {
|
||||
return result
|
||||
}
|
||||
|
||||
func IsPodActive(p api.Pod) bool {
|
||||
return api.PodSucceeded != p.Status.Phase &&
|
||||
api.PodFailed != p.Status.Phase &&
|
||||
p.DeletionTimestamp == nil
|
||||
}
|
||||
|
||||
// FilterActiveReplicaSets returns replica sets that have (or at least ought to have) pods.
|
||||
func FilterActiveReplicaSets(replicaSets []*extensions.ReplicaSet) []*extensions.ReplicaSet {
|
||||
active := []*extensions.ReplicaSet{}
|
||||
|
@ -27,6 +27,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||
"k8s.io/kubernetes/pkg/apis/extensions"
|
||||
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
|
||||
"k8s.io/kubernetes/pkg/controller"
|
||||
"k8s.io/kubernetes/pkg/labels"
|
||||
"k8s.io/kubernetes/pkg/util/integer"
|
||||
intstrutil "k8s.io/kubernetes/pkg/util/intstr"
|
||||
@ -346,6 +347,9 @@ func getReadyPodsCount(pods []api.Pod, minReadySeconds int) int {
|
||||
}
|
||||
|
||||
func IsPodAvailable(pod *api.Pod, minReadySeconds int) bool {
|
||||
if !controller.IsPodActive(*pod) {
|
||||
return false
|
||||
}
|
||||
// Check if we've passed minReadySeconds since LastTransitionTime
|
||||
// If so, this pod is ready
|
||||
for _, c := range pod.Status.Conditions {
|
||||
|
Loading…
Reference in New Issue
Block a user