github.com/verrazzano/verrazzano@v1.7.1/tests/e2e/config/scripts/wait-for-verrazzano-install.sh (about)

     1  #!/usr/bin/env bash
     2  #
     3  # Copyright (c) 2020, 2023, 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  
     7  
     8  SECONDS=0
     9  retval_success=1
    10  retval_failed=1
    11  i=0
    12  
    13  
    14  resName=$(kubectl get vz -o jsonpath='{.items[*].metadata.name}')
    15  echo "waiting for install of resource ${resName} to complete"
    16  while [[ $retval_success -ne 0 ]] && [[ $retval_failed -ne 0 ]]  && [[ $i -lt 45 ]]  ; do
    17    sleep 60
    18    vzstate=$(kubectl get vz ${resName} -o jsonpath={.status.state})
    19    echo "vz/${resName} state: ${vzstate}"
    20    # Only check the status if the CR is in the ready state
    21    if [ "${vzstate}" == "Ready" ]; then
    22      echo "vz/${resName} Ready, checking conditions"
    23      output=$(kubectl wait --for=condition=InstallFailed verrazzano/${resName} --timeout=0 2>&1)
    24      retval_failed=$?
    25      output=$(kubectl wait --for=condition=InstallComplete verrazzano/${resName} --timeout=0 2>&1)
    26      retval_success=$?
    27    fi
    28    i=$((i+1))
    29  done
    30  
    31  if [[ $retval_failed -eq 0 ]] || [[ $i -eq 45 ]] ; then
    32      echo "Installation Failed"
    33      kubectl get vz ${resName} -o yaml
    34      exit 1
    35  fi
    36  
    37  kubectl get vz ${resName}
    38  
    39  echo "Installation completed.  Wait time: $SECONDS seconds"