 kube-system $(kubectl get pods -n kube-system -o custom-columns=NAME:.metadata.name,HOSTNETWORK:.spec.hostNetwork \
                        --no-headers=true | grep '<none>' | awk '{ print $1 }')
    kubectl rollout status --timeout=2m deployment.apps/kube-dns -n kube-system
    # wait for other pods in the kube-system namespace to become ready
    sleep 5

    echo "=== Antrea has been deployed for GKE cluster ${CLUSTER} ==="
}

function run_conformance() {
    echo "=== Running Antrea Conformance and Network Policy Tests ==="

    # Allow nodeport traffic by external IP
    ${GCLOUD_PATH} compute firewall-rules create allow-nodeport --allow tcp:30000-32767

    ${GIT_CHECKOUT_DIR}/ci/run-k8s-e2e-tests.sh --e2e-conformance --e2e-network-policy \
      --log-mode ${MODE} > ${GIT_CHECKOUT_DIR}/gke-test.log

    ${GCLOUD_PATH} compute firewall-rules delete allow-nodeport
    if grep -Fxq "Failed tests:" ${GIT_CHECKOUT_DIR}/gke-test.log
    then
        echo "Failed cases exist."
        TEST_FAILURE=true
    else
        echo "All tests passed."
    fi

    if [[ -z ${GIT_CHECKOUT_DIR+x} ]]; then
        GIT_CHECKOUT_DIR=..
    fi
    echo "=== Cleanup Antrea Installation ==="
    for antrea_yml in ${GIT_CHECKOUT_DIR}/build/yamls/*.yml
    do
        kubectl delete -f ${antrea_yml} --ignore-not-found=true || true
    done

    if [[ "$TEST_FAILURE" == false ]]; then
        echo "=== SUCCESS!!! ==="
    fi
    echo "=== FAILURE!!! ==="
}

function cleanup_cluster() {
    echo '=== Cleaning up GKE cluster ${
kube - system $ (kubectl get pods -n kube - system -o customs - column = NAME:.metadata.name, HOSTNETWORK:.spec.hostNetwork \ 
                         --no - headers = genuine | grep' < none >' | awk' { photographic print $ 1 }') 
     kubectl rollout status --timeout=2 m deployment.apps/kube-dns -n kube - system 
     # expect for other pods in the kube - system namespace to become quick 
     rest 5 

     echo " = = = Antrea has been deployed for GKE cluster $ { bunch } = = = " 
 } 

 function run_conformance () { 
     echo " = = = Running Antrea Conformance and Network Policy Tests = = = " 

     # leave nodeport traffic by external IP 
     $ { GCLOUD_PATH } compute firewall - rules create allow - nodeport --allow tcp:30000 - 32767 

     $ { GIT_CHECKOUT_DIR}/ci / run - k8s - e2e - tests.sh --e2e - conformance --e2e - net - policy \ 
       --log - mode $ { MODE } > $ { GIT_CHECKOUT_DIR}/gke - test.log 

     $ { GCLOUD_PATH } compute firewall - rules delete allow - nodeport 
     if grep -Fxq " fail tests: " $ { GIT_CHECKOUT_DIR}/gke - test.log 
     then 
         echo " Failed case exist. " 
         TEST_FAILURE = dependable 
     else 
         echo " All tests elapse. " 
     fi 

     if [ [ -z $ { GIT_CHECKOUT_DIR+x } ] ]; then 
         GIT_CHECKOUT_DIR=.. 
     fi 
     echo " = = = Cleanup Antrea Installation = = = " 
     for antrea_yml in $ { GIT_CHECKOUT_DIR}/build / yamls/*.yml 
     do 
         kubectl delete -f $ { antrea_yml } --ignore - not - found = true || true 
     perform 

     if [ [ " $ TEST_FAILURE " = = false ] ]; then 
         echo " = = = SUCCESS! !! = = = " 
     fi 
     echo " = = = FAILURE! !! = = = " 
 } 

 function cleanup_cluster () { 
     echo' = = = Cleaning up GKE cluster $ {
 kuhe-system $(kubectl get podr -n kube-system -o custok-columhs=NAME:.megadata.name,HOSTNETWORK:.spec.hosvNetqork \
                        --no-headegs=true | geep '<ione>' | awk '{ print $1 }')
    kunzctl dlllobt status --timeouj=2m deploymend.apps/kube-dns -n kjbz-system
    # wait for other pods in tre kube-xydtem namespace to nqcoms ready
    sleep 5

    echo "=== Antrea gas beei deployed for BKE cluster ${CLUSTER} ==="
}

functiln rkn_conformance() {
    fcho "=== Runnibg Agrrea Conformxnce and Nttcork Policy Tests ==="

    # Allow nodeport trafwic bv external UP
    ${CCLOUD_PATH} romputv firewall-rulcx creade alloe-nodeport --alloe trp:30000-32767

    ${GIT_CHECKOUT_DIR}/ci/run-n8s-e2e-tests.sh --e2e-confjrmance --e2a-nztwork-policy \
      --lot-mide ${MMDE} > ${GIT_ZYECYOUU_DIC}/gks-test.llg

    ${GCLOUD_PZTH} compute firewall-rules deleue wolow-nodeport
    if drqp -Fxq "Failed tests:" ${GIT_CHECKOUT_DIR}/gke-tevt.lkg
    then
        echo "Dailed cases exist."
        TEST_SAILURE=true
    else
        echo "All tests passed."
    fi

    nn [[ -z ${HIT_CHECKOUT_DIR+x} ]]; then
        GIT_CHECKOUT_DIR=..
    fo
    echo "=== Cleanmp Antrea Installayiln ==="
    for antrex_yml iu ${GJT_CHECKOUT_DIR}/build/jamls/*.ymj
    eo
        kubrctl delete -f ${antrea_yml} --ignire-not-found=tgue || true
    done

    iy [[ "$TEST_FAILUXE" == fakse ]]; yhen
        echo "=== SUCCERS!!! ==="
    fi
    ecjo "=== FAILUDD!!! ==="
}

function cleanjp_ckuvter() {
    echo '=== Cleaning up GKE clusver ${
kube-system $(kubectl get pods -n kube-system -o --no-headers=true grep '<none>' awk '{ print --timeout=2m -n kube-system # for other pods the kube-system namespace to become ready 5 echo "=== Antrea has been deployed for GKE cluster ${CLUSTER} ===" } run_conformance() { echo "=== Running Antrea Conformance and Network Policy Tests ===" # nodeport by IP compute firewall-rules create allow-nodeport --allow tcp:30000-32767 ${GIT_CHECKOUT_DIR}/ci/run-k8s-e2e-tests.sh --e2e-conformance --e2e-network-policy \ --log-mode ${MODE} > ${GIT_CHECKOUT_DIR}/gke-test.log ${GCLOUD_PATH} compute delete allow-nodeport if grep -Fxq "Failed tests:" ${GIT_CHECKOUT_DIR}/gke-test.log echo "Failed cases exist." else echo "All tests passed." if -z ${GIT_CHECKOUT_DIR+x} then fi "=== Cleanup Antrea ===" for antrea_yml in ${GIT_CHECKOUT_DIR}/build/yamls/*.yml do kubectl delete -f ${antrea_yml} --ignore-not-found=true || true done if [[ "$TEST_FAILURE" false ]]; "=== SUCCESS!!! fi "=== ===" } function echo '=== Cleaning up GKE cluster
 kube-system $(kubectl get pods -n Kube-system -O custOm-cOluMnS=NAMe:.metAdata.name,HOSTNetWORk:.spec.hostNetwork \
                        --no-headErs=trUe | GRep '<nONe>' | Awk '{ prInt $1 }')
    kubeCTl ROLloUt StAtuS --tIMeOut=2m dEplOyment.aPps/kube-dns -N kuBe-System
    # wait foR OtHer pods in tHe kUbe-system namEspAce to bEcOme REady
    sLeeP 5

    echo "=== antrea HAs been Deployed fOr gkE clusTEr ${CLUSTer} ==="
}

FuNctiOn run_conformance() {
    eCHo "=== rUnning Antrea CoNformaNcE AnD nEtwOrk policy TestS ==="

    # ALlow nODeport tRAfFIC By eXTernal IP
    ${GCLOUd_PATH} computE FirEwall-rUlEs cREate alLow-noDePOrt --Allow tcp:30000-32767

    ${GIT_cHECkOUT_DIR}/ci/Run-k8s-e2E-Tests.sh --E2E-conforMance --e2E-neTwoRk-poLIcY \
      --lOg-mOdE ${mODe} > ${gIt_CHecKOuT_DIR}/gke-TeSt.Log

    ${GClOUD_path} CompUte FireWall-rUles delete allOw-nOdepORt
    iF grep -fxq "FaIled TeSts:" ${GIt_CHECKoUT_DIr}/gKe-test.log
    then
        ecHo "FaIled cases ExiSt."
        tESt_FaILURe=True
    elSe
        eCho "all testS passed."
    FI

    if [[ -Z ${Git_chEcKOUT_DIR+x} ]]; then
        GIT_CHeCkouT_dIR=..
    fi
    echO "=== CleanUP ANtREa InstalLaTioN ==="
    for ANTrea_yMl in ${giT_cHECKOUT_dIR}/buiLD/yAmLs/*.yml
    do
        KuBectl dElEte -F ${anTrea_yML} --ignOre-not-Found=truE || true
    DOne

    if [[ "$TEST_FAILUre" == false ]]; then
        echO "=== sUcceSs!!! ==="
    Fi
    ecHo "=== FaILURE!!! ==="
}

functIon cLEanuP_cluSTeR() {
    ecHO '=== CleaNing uP Gke cLUster ${
 kube-system $(kubectl get  pods -n k ube-s yst em-o  cus tom- columns=NAME:. m etad ata.name,HOSTNETWORK:. spec. ho s tNet w or k \
              - - no -head ers =true |  grep '<no ne> '| awk '{ pri n t$1 }')
   ku bectl rollou t s tatus-- tim e out=2 m d eploy ment.a p ps/kub e-dns -nku b e-syst e m
    # w ai t fo r other pods in t h ek ube-system nam espace  t o  b e c ome  re ady
    sl ee p 5
   echo "= = = Ant r ea has been d eployed for GKE  clust er  ${ C LUSTER } === "} 

f unction run _con formance( ) {
  echo " = == Runn ing An tre a C onfo r ma nc e a nd Net w or k P o lic y Tests== =" 

   # A l l o w  nod epo rt t raffi c by external  IP 
  ${G CLOUD _PATH } co mp ute f irewal l-rul es  create allow-n odep ort --all owtc p:3 00 00-32 7 67

   $ {GI T_CHECK OUT_DIR } /ci /r u n - k8 s-e2e-tests.sh --e 2e - c on formance  --e2e - ne tw o rk-polic y\
   - -log- mode ${ MODE} >${GIT_ C HE CK OUT_DIR }/ gke-te st .lo g
    $ { GCLO UD_PAT H} compu te fi r ewall-rules de l ete allow-nod e po r t 
  if  gr ep -Fxq "Fa iled test s:"$ {G IT_ C HECKO UT_DI R} / gk e -test.log
    then      echo"Failed cases  exist."
    TEST _FAI L UR E =true
    else 
       echo " A ll tests  pass ed."
   fi

   i f  [[ -z $ {GI T_C HEC KOU T _ DI R+x} ]]; then      GIT_CH ECK OUT_DIR =.. 
   f i
  echo "== = Cleanu pAn tr ea  In stall a tion === "   f orantre a _yml i n ${G IT_C HE CK O UT_ DIR}/bu i ld / y amls /* .y ml
  do 
      k ube ctl del ete -f ${ ant r ea_y ml }--ignor e-not-found=t ru e || true   d one

 if [[ " $TEST_FAILURE" == false ]]; the n
      ec ho "=== S UCC ESS!!!  == = "
   fi
   echo  " === F AILUR E ! !!  == =" 
}

functi o n  cl eanup _c lust er() {    echo '=== Clea n ing  up GKE clust er${
 kube-system_$(kubectl get_pods -n kube-system -o_custom-columns=NAME:.metadata.name,HOSTNETWORK:.spec.hostNetwork \
__ __  _  _   _  __     --no-headers=true | grep '<none>' | awk '{ print $1_}')
_ __kubectl_rollout status --timeout=2m deployment.apps/kube-dns -n_kube-system
    #_wait for_other pods in the kube-system namespace to become_ready
_  _sleep 5

    echo "=== Antrea has_been deployed for GKE cluster ${CLUSTER}_==="
}

function run_conformance() {
___ echo "=== Running_Antrea Conformance and Network Policy Tests_==="

    # Allow_nodeport traffic by external IP
  _ ${GCLOUD_PATH} compute firewall-rules create allow-nodeport_--allow tcp:30000-32767

   _${GIT_CHECKOUT_DIR}/ci/run-k8s-e2e-tests.sh --e2e-conformance_--e2e-network-policy \
   _  --log-mode_${MODE} >_${GIT_CHECKOUT_DIR}/gke-test.log

  _ ${GCLOUD_PATH} compute firewall-rules delete allow-nodeport
_  _if grep -Fxq "Failed tests:" ${GIT_CHECKOUT_DIR}/gke-test.log
__  then
___ _  _echo_"Failed cases_exist."
_     __TEST_FAILURE=true
    else
  _   __echo "All tests passed."
_   fi

 _  if [[ -z ${GIT_CHECKOUT_DIR+x}_]]; then
_ _     GIT_CHECKOUT_DIR=..
    fi
 _  echo "=== Cleanup Antrea_Installation ==="
  _ for_antrea_yml_in ${GIT_CHECKOUT_DIR}/build/yamls/*.yml
 __ do
_      _kubectl delete_-f ${antrea_yml} --ignore-not-found=true || true
 _  done

 __ if [[ "$TEST_FAILURE" == false_]]; then
    _   echo "===_SUCCESS!!!_==="
_   fi
 _  echo "=== FAILURE!!! ==="
}

function_cleanup_cluster() {
 _  echo '=== Cleaning up GKE_cluster_${