git.iko.soy/typeable/octopod
on master help sign in
Handle kubectl errors during ingress-nginx installation (#163)
commitb8d490a2c48e37b31514a20c79b8407ea1504511 authorNikita <anisimoff.nikita@gmail.com> dateTue 8 Feb 2022, 13:47 (5 years ago) parent929e880
1 file changed+18−1
octopod_local_install.sh+18−1
octopod_local_install.sh+18−1
@@ -90,8 +90,25 @@ data:
9090EOF
9191message "Installing ingress-nginx controller"
9292kubectl --context=kind-octopod apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.45.0/deploy/static/provider/kind/deploy.yaml
93+has_error=0
9394while true; do
94− if [ $(kubectl --context=kind-octopod -n ingress-nginx get deploy | awk -F ' ' '$1 ~ /^ingress-nginx/ {print $4}') == '1' ]; then
95+ set +e
96+ kube_out=`kubectl --context=kind-octopod -n ingress-nginx get deploy 2>&1`
97+ err_code=$?
98+ set -e
99+ if [ $err_code != 0 ] && [ $has_error == 0 ]; then
100+ echo "kubectl returned: $kube_out"
101+ echo "Do you want to continue installation? [y/n] "
102+ read confirm
103+ if [ "$confirm" != 'y' ]; then
104+ message "Deleting cluster..."
105+ kind delete cluster --name octopod
106+ exit 0;
107+ else
108+ has_error=1
109+ fi
110+ fi
111+ if [ $err_code == 0 ] && [ $( echo -n "$kube_out" | awk -F ' ' '$1 ~ /^ingress-nginx/ {print $4}') == '1' ]; then
95112 message 'ingress-controller is ready'
96113 break;
97114 else