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

     1  #!/usr/bin/env bash
     2  #
     3  # Copyright (c) 2020, 2022, 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  resourceName=${1:-my-verrazzano}
     8  resPath=verrazzano/${resourceName}
     9  
    10  if ! kubectl get ${resPath}; then
    11    echo "Verrazzano resource ${resPath} not found"
    12    exit 1
    13  fi
    14  
    15  echo "Starting wait for upgrade operation at $(date)"
    16  
    17  SECONDS=0
    18  retval_success=1
    19  retval_failed=1
    20  while [[ $retval_success -ne 0 ]] && [[ $retval_failed -ne 0 ]]; do
    21    sleep 5
    22    output=$(kubectl wait --for=condition=UpgradeFailed ${resPath} --timeout=0 2>&1)
    23    retval_failed=$?
    24    output=$(kubectl wait --for=condition=UpgradeComplete ${resPath} --timeout=0 2>&1)
    25    retval_success=$?
    26  done
    27  
    28  if [ $retval_failed -eq 0 ]; then
    29      echo "Upgrade Failed"
    30      exit 1
    31  fi
    32  
    33  echo "Upgrade completed successfully at $(date).  Wait time: $SECONDS seconds"