github.com/verrazzano/verrazzano@v1.7.0/platform-operator/scripts/wait4webhook.sh (about)

     1  #!/bin/bash
     2  # Copyright (c) 2020, 2023, Oracle and/or its affiliates.
     3  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
     4  
     5  function poll-webhook {
     6      SECONDS=0
     7      MAX_SECONDS=120
     8      while [ $SECONDS -lt $MAX_SECONDS ]; do
     9          status_code=$(curl  -vvv --insecure --silent --output /tmp/out --write-out '%{http_code}' -H 'Content-Type: application/json' $1)
    10          echo "$1 returned HTTP $status_code."
    11          if [[ "$status_code" != "200" ]]; then
    12              cat /tmp/out
    13              echo "waiting 5 seconds"
    14              let SECONDS=SECONDS+5
    15              sleep 5
    16          else
    17              exit 0
    18          fi
    19      done
    20      echo "timeout waiting for VPO webhook"
    21      exit 1
    22  }
    23  
    24  poll-webhook "https://verrazzano-platform-operator-webhook.verrazzano-install.svc.cluster.local:443/validate-install-verrazzano-io-v1beta1-verrazzano"