Skip to content

Commit 9834e70

Browse files
committed
Filter out Evicted Pods from 'pgo test' results
This update filters out Evicted Pods from the 'pgo test' results because Evicted Pods are terminated and will need to be handled by the appropriate controller. These Pods are identified with a Status Phase set to 'Failed' and a Status Reason set to 'Evicted'. Issue: [sc-14183]
1 parent b8a60f0 commit 9834e70

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

internal/apiserver/clusterservice/clusterimpl.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import (
4141
kerrors "k8s.io/apimachinery/pkg/api/errors"
4242
"k8s.io/apimachinery/pkg/api/resource"
4343
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
44+
"k8s.io/apimachinery/pkg/fields"
4445
"k8s.io/apimachinery/pkg/util/validation"
4546
"k8s.io/client-go/kubernetes"
4647
)
@@ -2328,6 +2329,10 @@ func GetPrimaryAndReplicaPods(cluster *crv1.Pgcluster, ns string) ([]msgs.ShowCl
23282329
}
23292330
for i := range pods.Items {
23302331
p := &pods.Items[i]
2332+
// Filter out Evicted Pods, which have Status.Phase=Failed and Status.Reason=Evicted
2333+
if p.Status.Phase == "Failed" && p.Status.Reason == "Evicted" {
2334+
continue
2335+
}
23312336
d := msgs.ShowClusterPod{}
23322337
d.Name = p.Name
23332338
d.Phase = string(p.Status.Phase)
@@ -2351,6 +2356,10 @@ func GetPrimaryAndReplicaPods(cluster *crv1.Pgcluster, ns string) ([]msgs.ShowCl
23512356
}
23522357
for i := range pods.Items {
23532358
p := &pods.Items[i]
2359+
// Filter out Evicted Pods, which have Status.Phase=Failed and Status.Reason=Evicted
2360+
if p.Status.Phase == "Failed" && p.Status.Reason == "Evicted" {
2361+
continue
2362+
}
23542363
d := msgs.ShowClusterPod{}
23552364
d.Name = p.Name
23562365
d.Phase = string(p.Status.Phase)

0 commit comments

Comments
 (0)