Last active
October 1, 2019 07:33
-
-
Save samuelb/4b8c0c6337ba0bea9b633e913ad39996 to your computer and use it in GitHub Desktop.
PoC - Wait for helm `install/update` deployments to be finished. Takes `helm template ...` from stdin.
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
#!/usr/bin/env python3 | |
""" Usage: helm template ... | python thisscript.py """ | |
import sys | |
import yaml | |
import subprocess | |
docs = yaml.load_all(sys.stdin, Loader=yaml.Loader) | |
# get all objects names of kind Deployment, DaemonSet, StatefulSet | |
for doc in docs: | |
if doc['kind'].lower() in ('deployment', 'daemonset', 'statefulset'): | |
# call `kubectl rollout status` for each. It will block util the rollout is finished. | |
subprocess.call(['kubectl', 'rollout', 'status', doc['kind'], doc['metadata']['name']]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment