Skip to content

Instantly share code, notes, and snippets.

@chmouel
Last active April 25, 2019 00:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chmouel/76911bbf28695959ddeac7a792db157e to your computer and use it in GitHub Desktop.
Save chmouel/76911bbf28695959ddeac7a792db157e to your computer and use it in GitHub Desktop.
install openshift 4 in loop
#!/usr/bin/env bash
# set -x
set -e
SD=$(readlink -f $(dirname $0))
IC=$(readlink -f $(dirname $0)/install-config.yaml )
DIR=${SD}/os4
function recreate() {
date
[[ -d ${DIR} ]] && {
./clients/openshift-install destroy cluster --dir ${DIR} --log-level debug
rm -rf ${DIR}
}
mkdir -p ${DIR}
echo "Waiting....."
sleep 600
cp ${IC} ${DIR}
./clients/openshift-install create cluster --dir ${DIR}
date
}
function waitforit() {
[[ -e ${DIR}/auth/kubeconfig ]] || return
SERVER=$(env KUBECONFIG=${DIR}/auth/kubeconfig ./clients/oc config view|python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)' | jq -r '.clusters[].cluster.server')
while true;do
curl -k -i -f -s -o/dev/null ${SERVER} || {
recreate
}
read -t 140000 -e -s -p "Waiting for 4h....";date
done
}
waitforit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment