Skip to content

Commit

Permalink
fix: added a filter to evicted pods when checking for ready status (#…
Browse files Browse the repository at this point in the history
…1334)

* fix: added a filter to evicted pods

Signed-off-by: Alessio Pragliola <[email protected]>

---------

Signed-off-by: Alessio Pragliola <[email protected]>
  • Loading branch information
Al-Pragliola authored Nov 14, 2024
1 parent 2dca1e9 commit e589680
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/feature/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ func WaitForPodsToBeReady(namespace string) Action {
return false, err
}

podList.Items = filterEvictedPods(podList.Items)
readyPods := 0
totalPods := len(podList.Items)

Expand Down Expand Up @@ -102,6 +103,18 @@ func WaitForPodsToBeReady(namespace string) Action {
}
}

func filterEvictedPods(pods []corev1.Pod) []corev1.Pod {
var filteredPods []corev1.Pod

for _, pod := range pods {
if pod.Status.Phase != corev1.PodFailed || pod.Status.Reason != "Evicted" {
filteredPods = append(filteredPods, pod)
}
}

return filteredPods
}

func WaitForResourceToBeCreated(namespace string, gvk schema.GroupVersionKind) Action {
return func(ctx context.Context, cli client.Client, f *Feature) error {
f.Log.Info("waiting for resource to be created", "namespace", namespace, "resource", gvk)
Expand Down

0 comments on commit e589680

Please sign in to comment.