Prefetch the CDI images before the tests
Pre-fetch CDI images to all kubevirtci nodes during make cluster-sync
to avoid unpredictable timeouts due to varying pull speeds.
@@ -46,6 +46,28 @@ function _ensure_cdi_deployment() {
# Do not deploy any cdi-operator related objects on
# sriov-lane until kubevirt/kubevirt#4120 is fixed
if [[ ! "$KUBEVIRT_PROVIDER" =~ sriov.* ]]; then
+ # prefetch cdi images
+ if [[ $KUBEVIRT_PROVIDER == "external" ]] || [[ $KUBEVIRT_PROVIDER =~ kind.* ]] || [[ $KUBEVIRT_PROVIDER == "local" ]]; then
+ nodes=() # in case of external provider / kind we have no control over the nodes
+ else
+ nodes=()
+ nodes+=($(_kubectl get nodes -o name | sed "s#node/##g"))
+ pull_command="docker"
+ fi
+
+ cdi_images=$(sed -ne "s/.*\(quay.io[^\s]*\)/\1/p" manifests/testing/cdi*)
+ for node in ${nodes[@]}; do
+ count=0
+ until ${KUBEVIRT_PATH}cluster-up/ssh.sh ${node} "echo \"${cdi_images}\" | xargs \-\-max-args=1 sudo ${pull_command} pull"; do
+ count=$((count + 1))
+ if [ $count -eq 10 ]; then
+ echo "Failed to '${pull_command} pull' in ${node}" >&2
+ exit 1
+ fi
+ sleep 1
+ done
+ done
+
_kubectl apply -f - <<EOF
---
apiVersion: cdi.kubevirt.io/v1beta1
