Last active
May 3, 2016 06:48
-
-
Save ajohnstone/d10a17e51ca808ca82733f8f307de297 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function kubernetes::deployment::wait { | |
deployment=$1 | |
ns=${2:-'default'}; | |
k_cmd="kubectl --namespace=$ns get deployments $deployment"; | |
while true; do | |
observed=$($k_cmd -o 'jsonpath={.status.observedGeneration}'); | |
generated=$($k_cmd -o 'jsonpath={.metadata.Generation}'); | |
[ "$?" -ne 0 ] && break; | |
[ "${observed}" -ge "${generated}" ] && { | |
updated_replicas=$($k_cmd -o 'jsonpath={.status.updatedReplicas}'); | |
replicas=$($k_cmd -o 'jsonpath={.spec.replicas}'); | |
[ "${updated_replicas}" -eq "${replicas}" ] && { | |
echo "objects observed ${observed}:${generated} - ${updated_replicas}:${replicas}" | |
break; | |
} | |
} | |
print "."; | |
sleep 1; | |
done | |
} | |
kubernetes::deployment::wait secure-proxy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment