@@ -352,30 +352,48 @@ function start_pre_download_images() {
352352 export CORTEX_IMAGE_TENSORFLOW_SERVING_INF=" ${registry} /tensorflow-serving-inf:${CORTEX_VERSION} "
353353 export CORTEX_IMAGE_TENSORFLOW_PREDICTOR=" ${registry} /tensorflow-predictor:${CORTEX_VERSION} "
354354
355- if [[ " $CORTEX_INSTANCE_TYPE " == p* ]] || [[ " $CORTEX_INSTANCE_TYPE " == g* ]] || [ -n " $CORTEX_ACCELERATOR_TYPE " ]; then
355+ envsubst < manifests/image-downloader-cpu.yaml | kubectl apply -f - & > /dev/null
356+
357+ has_gpu=" false"
358+ has_inf=" false"
359+
360+ cluster_config_len=$( cat /in/cluster_${CORTEX_CLUSTER_NAME} _${CORTEX_REGION} .yaml | yq -r .node_groups | yq -r length)
361+ for idx in $( seq 0 $(( $cluster_config_len - 1 )) ) ; do
362+ ng_instance_type=$( cat /in/cluster_${CORTEX_CLUSTER_NAME} _${CORTEX_REGION} .yaml | yq -r .node_groups[$idx ].instance_type)
363+ if [[ " $ng_instance_type " == p* || " $ng_instance_type " == g* ]]; then
364+ has_gpu=" true"
365+ fi
366+ if [[ " $ng_instance_type " == inf* ]]; then
367+ has_inf=" true"
368+ fi
369+ done
370+
371+ if [ " $has_gpu " == " true" ]; then
356372 envsubst < manifests/image-downloader-gpu.yaml | kubectl apply -f - & > /dev/null
357- elif [[ " $CORTEX_INSTANCE_TYPE " == inf* ]]; then
373+ fi
374+
375+ if [ " $has_inf " == " true" ]; then
358376 envsubst < manifests/image-downloader-inf.yaml | kubectl apply -f - & > /dev/null
359- else
360- envsubst < manifests/image-downloader-cpu.yaml | kubectl apply -f - & > /dev/null
361377 fi
362378}
363379
364380function await_pre_download_images() {
365- if kubectl get daemonset image-downloader -n=default & > /dev/null; then
366- echo -n " ○ downloading docker images "
367- printed_dot=" false"
381+ echo -n " ○ downloading docker images ."
382+ for ds_name in image-downloader-cpu image-downloader-gpu image-downloader-inf; do
383+ if ! kubectl get daemonset $ds_name > /dev/null 2>&1 ; then
384+ continue
385+ fi
368386 i=0
369- until [ " $( kubectl get daemonset image-downloader -n=default -o ' jsonpath={.status.numberReady}' ) " == " $( kubectl get daemonset image-downloader -n=default -o ' jsonpath={.status.desiredNumberScheduled}' ) " ]; do
387+ until [ " $( kubectl get daemonset $ds_name -n=default -o ' jsonpath={.status.numberReady}' ) " == " $( kubectl get daemonset $ds_name -n=default -o ' jsonpath={.status.desiredNumberScheduled}' ) " ]; do
370388 if [ $i -eq 120 ]; then break ; fi # give up after 6 minutes
371389 echo -n " ."
372- printed_dot=" true"
373390 (( i= i+ 1 ))
374391 sleep 3
375392 done
376- kubectl -n=default delete --ignore-not-found=true daemonset image-downloader & > /dev/null
377- if [ " $printed_dot " == " true" ]; then echo " ✓" ; else echo " ✓" ; fi
378- fi
393+ kubectl -n=default delete --ignore-not-found=true daemonset $ds_name & > /dev/null
394+ done
395+
396+ echo " ✓"
379397}
380398
381399function validate_cortex() {
0 commit comments