@@ -92,6 +92,10 @@ waitResourceExists() {
9292 local start_time=$( date +%s)
9393 local now=$( date +%s)
9494
95+ if [ " $DRYRUN " = true ] ; then
96+ return
97+ fi
98+
9599 while [ $(( $now - $start_time )) -le $TIMEOUT ] ; do
96100 if kubeExists $resource ; then
97101 return 0
@@ -127,16 +131,12 @@ getLatestAmsterJob() {
127131 timeoutExit
128132}
129133
130- waitForDS () {
131- local ds=$1
132-
133- waitResourceExists " sts/${ds} "
134- local rep=$( $K_CMD $NAMESPACE_OPT get sts $ds -o=jsonpath=' {.spec.replicas}' )
135- (( rep-- ))
136- message " rep=${rep} " " debug"
137- for i in $( seq 0 $rep ) ; do
138- waitForResource ready " pod/${ds} -${i} "
139- done
134+ waitForRollout () {
135+ local resource=$1
136+ echo " Waiting for ${resource} rollout to complete."
137+ if waitResourceExists " $resource " ; then
138+ kube rollout status --watch " ${resource} " --timeout=" ${TIMEOUT} s"
139+ fi
140140}
141141
142142# Setup valid components now so they get presented in the usage
@@ -177,11 +177,11 @@ for c in ${COMPONENTS[@]} ; do
177177 message " c=$c " " debug"
178178 case $c in
179179 admin-ui)
180- waitForResource ready " pod -l app= admin-ui"
180+ waitForRollout " deployment/ admin-ui"
181181 ;;
182182
183183 am)
184- waitForResource ready " pod -l app= am"
184+ waitForRollout " deployment/ am"
185185 ;;
186186
187187 amster)
@@ -190,34 +190,34 @@ for c in ${COMPONENTS[@]} ; do
190190 ;;
191191
192192 apps)
193- waitForResource ready " pod -l app=am"
194193 amster_job=$( getLatestAmsterJob)
194+ waitForRollout " deployment/am"
195195 waitForResource ' complete' " job/${amster_job} "
196- waitForResource ready " pod -l app= idm"
196+ waitForRollout " deployment/ idm"
197197 ;;
198198
199199 ds-cts)
200- waitForDS ds-cts
200+ waitForRollout " statefulset/ ds-cts"
201201 ;;
202202
203203 ds-idrepo)
204- waitForDS ds-idrepo
204+ waitForRollout " statefulset/ ds-idrepo"
205205 ;;
206206
207207 end-user-ui)
208- waitForResource ready " pod -l app= end-user-ui"
208+ waitForRollout " deployment/ end-user-ui"
209209 ;;
210210
211211 idm)
212- waitForResource ready " pod -l app= idm"
212+ waitForRollout " deployment/ idm"
213213 ;;
214214
215215 ig)
216- waitForResource ready " pod -l app= ig"
216+ waitForRollout " deployment/ ig"
217217 ;;
218218
219219 login-ui)
220- waitForResource ready " pod -l app= login-ui"
220+ waitForRollout " deployment/ login-ui"
221221 ;;
222222
223223 secrets)
0 commit comments