File tree Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,33 @@ wait_for_installation() {
2525 done
2626}
2727
28+ function retry() {
29+ local retries=$1
30+ shift
31+
32+ local count=0
33+ until " $@ " ; do
34+ exit=$?
35+ wait=$(( 2 ** $count ))
36+ count=$(( $count + 1 ))
37+ if [ $count -lt $retries ]; then
38+ echo " Retry $count /$retries exited $exit , retrying in $wait seconds..."
39+ sleep $wait
40+ else
41+ echo " Retry $count /$retries exited $exit , no more retries left."
42+ return $exit
43+ fi
44+ done
45+ return 0
46+ }
47+
48+ function check_nginx_version {
49+ if ! kubectl describe pod -n ingress-nginx | grep -q " 4.9.1" ; then
50+ return 1
51+ fi
52+ return 0
53+ }
54+
2855main () {
2956 local installation_version=
3057 installation_version=" $1 "
@@ -75,7 +102,7 @@ main() {
75102 exit 1
76103 fi
77104 # ensure the new version made it into the pod
78- if ! kubectl describe pod -n ingress-nginx | grep -q " 4.9.1 " ; then
105+ if ! retry 5 check_nginx_version ; then
79106 echo " 4.9.1 not found in ingress-nginx pod"
80107 kubectl describe pod -n ingress-nginx
81108 exit 1
You can’t perform that action at this time.
0 commit comments