github.com/verrazzano/verrazzano@v1.7.1/ci/scripts/wait-for-namespace-not-exist.sh (about)

     1  #!/bin/bash
     2  #
     3  # Copyright (c) 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  # Waits until a namespace does not exist
     7  #
     8  NAMESPACE=$1
     9  i=0
    10  for (( i=1; i<=20; i++ ))
    11  do
    12    kubectl get ns $NAMESPACE >&- 2>&-
    13    if [ "$?" -eq 1 ]; then
    14      exit 0
    15    fi
    16    echo "Waiting for namespace $NAMESPACE to be deleted ..."
    17    sleep 5
    18  done
    19  exit 1