github.com/verrazzano/verrazzano@v1.7.1/tests/e2e/config/scripts/wait-for-component-ready.sh (about) 1 #!/bin/bash 2 # 3 # Copyright (c) 2021, Oracle and/or its affiliates. 4 # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. 5 # 6 # Waits for all component-level statuses to report Ready 7 # 8 9 resName=${1:-my-verrazzano} 10 components=($(kubectl get vz ${resName} -o json | jq -r '.status.components | keys[]')) 11 12 if [ ${#components[@]} -eq 0 ]; then 13 echo "No components found for ${resName}" 14 exit 1 15 fi 16 17 echo "Waiting for the following components to reach Ready state: ${components[@]}" 18 19 for comp in ${components[@]}; do 20 echo "Checking component ${comp}" 21 for iter in {1..20}; do 22 state=$(kubectl get vz my-verrazzano -o jsonpath={.status.components.${comp}.state}) 23 echo "Component ${comp} state: ${state}" 24 if [ "${state}" == "Disabled" ]; then 25 echo "Component ${comp} disabled, continuing" 26 break 27 elif [ "${state}" == "Ready" ]; then 28 echo "Component ${comp} ready, continuing" 29 break 30 fi 31 if (( ${iter} >= 20 )); then 32 # Wait for a total of 10 minutes for each component to complete 33 echo "Timed out waiting for component ${comp} to reach Ready state" 34 exit 1 35 fi 36 sleep 30s 37 done 38 done