Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
KubernetesAssistant : improve detection of ready containers in pod #1051
Using the KubernetesAssistant (or OpenshiftAssistant) we can programmatically wait for a pod to be ready by using the method: awaitApplicationReadinessOrFail
This method use another one called isRunning(Pod pod) to detect if the Pod is running.
Currently the implementation is:
However, after multiple manual tests, the check made by the isRunning method is inadequate.
Inadequate in term of the main objective of the method awaitApplicationReadinessOrFail because we want to know if the pod is ready meaning that each containers in the pod are ready.
Next, I've noticed that when the phase return running it does not mean that all containers in pod are ready (ie the readiness probe is ok for each of them).
So, having a pod phase defined to running means that containers have been started with readiness probe currently not check and the pod is in "Not ready" state displayed on the web console. Furthermore after all readiness probes are ok the phase will also return running.
So I propose this implementation instead which will check that all containers in the pod are ready:
And I guess that it should be a good point to rename the method isRunning to isReady or areAllContainersReady or something else.
I confirm this code works :)
So this is working:
Expose a route and use awaitUrl method to wait for the application to be ready.