forked from crc-org/snc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcrc-cluster-status.sh
More file actions
39 lines (30 loc) · 1.01 KB
/
Copy pathcrc-cluster-status.sh
File metadata and controls
39 lines (30 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
set -o pipefail
set -o errexit
set -o nounset
set -o errtrace
set -x
export KUBECONFIG=/opt/kubeconfig
if [ ! -f /opt/crc/pass_kubeadmin ]; then
echo "kubeadmin password file not found"
exit 1
fi
rm -rf /tmp/.crc-cluster-ready
if ! oc adm wait-for-stable-cluster --minimum-stable-period=1m --timeout=10m; then
exit 1
fi
echo "Logging into OpenShift with kubeadmin user to update $KUBECONFIG"
COUNTER=1
MAXIMUM_LOGIN_RETRY=10
# use a `(set +x)` subshell to avoid leaking the password
until (set +x ; oc login --insecure-skip-tls-verify=true -u kubeadmin -p "$(cat /opt/crc/pass_kubeadmin)" https://api.crc.testing:6443 > /dev/null 2>&1); do
if [ "$COUNTER" -ge "$MAXIMUM_LOGIN_RETRY" ]; then
echo "Unable to login to the cluster..., authentication failed."
exit 1
fi
echo "Logging into OpenShift with updated credentials try $COUNTER, hang on...."
sleep 5
((COUNTER++))
done
# need to set a marker to let `crc` know the cluster is ready
touch /tmp/.crc-cluster-ready