diff --git a/facilitator/assets/exams/ckad/001/scripts/validation/q6_s1_validate_multicontainer_pod.sh b/facilitator/assets/exams/ckad/001/scripts/validation/q6_s1_validate_multicontainer_pod.sh index 2813f68..dc5c283 100644 --- a/facilitator/assets/exams/ckad/001/scripts/validation/q6_s1_validate_multicontainer_pod.sh +++ b/facilitator/assets/exams/ckad/001/scripts/validation/q6_s1_validate_multicontainer_pod.sh @@ -11,10 +11,15 @@ fi # Verify container names NGINX_CONTAINER=$(kubectl get pod sidecar-pod -n troubleshooting -o jsonpath='{.spec.containers[?(@.name=="nginx")].name}' 2>/dev/null) SIDECAR_CONTAINER=$(kubectl get pod sidecar-pod -n troubleshooting -o jsonpath='{.spec.containers[?(@.name=="sidecar")].name}' 2>/dev/null) +SIDECAR_INITCONTAINER=$(kubectl get pod sidecar-pod -n troubleshooting -o jsonpath='{.spec.initContainers[?(@.name=="sidecar")].name}' 2>/dev/null) +SIDECAR_INITCONTAINER_CONDITION=$(kubectl get pod sidecar-pod -n troubleshooting -o jsonpath='{.spec.initContainers[?(@.name=="sidecar")].restartPolicy}' 2>/dev/null) if [ -n "$NGINX_CONTAINER" ] && [ -n "$SIDECAR_CONTAINER" ]; then echo "Success: Pod has both 'nginx' and 'sidecar' containers" exit 0 +elif [ -n "$NGINX_CONTAINER" ] && [ -n "$SIDECAR_INITCONTAINER" ] && [ "$SIDECAR_INITCONTAINER_CONDITION" = "Always" ]; then + echo "Success: Pod has 'nginx' container and 'sidecar' init container with restartPolicy 'Always'" + exit 0 else echo "Error: Pod does not have the required container names ('nginx' and 'sidecar')" echo "Found containers with names: $(kubectl get pod sidecar-pod -n troubleshooting -o jsonpath='{.spec.containers[*].name}' 2>/dev/null)"