You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a status.conditions with type: ServiceReady and status: 'True' when service fully deployed
Prevent status.ready == 'True' before pods are ready
Validation
Assuming:
A namespace called test
A TrustyAIService CR named trustyai-service deployed in test
The following script ran before the deployment of the CR
#!/bin/bash
NAMESPACE="test"whiletrue;do# Get the 'Available' status of TrustyAIService
trusty_ai_service_status=$(kubectl get TrustyAIService trustyai-service -n ${NAMESPACE} -o jsonpath='{.status.conditions[?(@.type=="Available")].status}'2>/dev/null)
trusty_ai_service_exit_code=$?# Get the 'Available' status of the deployment
deployment_status=$(kubectl get deployment trustyai-service -n ${NAMESPACE} -o jsonpath='{.status.conditions[?(@.type=="Available")].status}'2>/dev/null)
deployment_exit_code=$?# Check if both statuses are "True" or if any command failedif [ "$trusty_ai_service_exit_code"-eq 0 ] && [ "$trusty_ai_service_status"=="True" ] && [ "$deployment_exit_code"-eq 0 ] && [ "$deployment_status"=="True" ];thenecho"TrustyAIService: Available, Deployment: Available"break# Exit the loop if both are availableelse# Default to "Not available" if the kubectl command failed or status is not "True"echo"TrustyAIService: ${trusty_ai_service_status:-Not available}, Deployment: ${deployment_status:-Not available}"fi
sleep 1 # Wait for 1 second before checking againdone
It should show that the TrustyAIService is never Available before the Deployment is available.
The output should be similar to:
TrustyAIService: Not available, Deployment: Not available
...
TrustyAIService: Not available, Deployment: False
...
TrustyAIService: Not available, Deployment: True
...
TrustyAIService: Available, Deployment: Available
The text was updated successfully, but these errors were encountered:
I've reproduced this in a couple of ways, be aware the pod does spin up within about 15 seconds on an empty cluster, so you have a short window to catch it.
The easiest way is to have a dedicated console window open on the pods page for that namespace and have two console windows open, one ready to create the CR, the other with the command typed out ready to retrieve the CR. If you create and then fetch the CR straight after, you'll see it shows as ready before the pod is fully spun up in your browser.
status.conditions
with type:ServiceReady
and status: 'True' when service fully deployedstatus.ready == 'True'
before pods are readyValidation
Assuming:
test
TrustyAIService
CR namedtrustyai-service
deployed intest
It should show that the
TrustyAIService
is neverAvailable
before theDeployment
is available.The output should be similar to:
The text was updated successfully, but these errors were encountered: