Last active
April 25, 2019 00:01
-
-
Save chmouel/76911bbf28695959ddeac7a792db157e to your computer and use it in GitHub Desktop.
install openshift 4 in loop
This file contains hidden or 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 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