Skip to content

Commit

Permalink
fix: Ensure Wait function waits for pods to appare in given namespace (
Browse files Browse the repository at this point in the history
…#803)

When the Wait function is called to wait for e.g. the expected outcome of another operator,
the operator might take longer then the initial interval time of 2s to create a pod.
In this scenario the Wait function would get 0 Pods returned from the API Server to check
the state of and assume all is done.

Ensure we at least get a pod count higher then 0 before we return successful. This gives
the other operator our 5min deadline to create and start the pod(s).
  • Loading branch information
aslakknutsen authored Jan 16, 2024
1 parent f6d9bb1 commit 99a899e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/feature/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ func WaitForPodsToBeReady(namespace string) Action {
readyPods := 0
totalPods := len(podList.Items)

if totalPods == 0 { // We want to wait for "something", so make sure we have "something" before we claim success.
return false, nil
}

for _, pod := range podList.Items {
podReady := true
// Consider a "PodSucceeded" as ready, since these will never will
Expand Down

0 comments on commit 99a899e

Please sign in to comment.