github.com/eth-easl/loader@v0.0.0-20230908084258-8a37e1d94279/scripts/konk-ci/02-kourier.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  #
     4  # MIT License
     5  #
     6  # Copyright (c) 2023 EASL and the vHive community
     7  #
     8  # Permission is hereby granted, free of charge, to any person obtaining a copy
     9  # of this software and associated documentation files (the "Software"), to deal
    10  # in the Software without restriction, including without limitation the rights
    11  # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    12  # copies of the Software, and to permit persons to whom the Software is
    13  # furnished to do so, subject to the following conditions:
    14  #
    15  # The above copyright notice and this permission notice shall be included in all
    16  # copies or substantial portions of the Software.
    17  #
    18  # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    19  # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    20  # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    21  # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    22  # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    23  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    24  # SOFTWARE.
    25  #
    26  
    27  set -eo pipefail
    28  set -u
    29  
    30  KNATIVE_NET_KOURIER_VERSION=${KNATIVE_NET_KOURIER_VERSION:-1.4.0}
    31  
    32  ## INSTALL KOURIER
    33  n=0
    34  until [ $n -ge 3 ]; do
    35    kubectl apply -f https://github.com/knative-sandbox/net-kourier/releases/download/knative-v${KNATIVE_NET_KOURIER_VERSION}/kourier.yaml  && break
    36    echo "Kourier failed to install on first try"
    37    n=$[$n+1]
    38    sleep 10
    39  done
    40  kubectl wait pod --timeout=-1s --for=condition=Ready -l '!job-name' -n kourier-system
    41  kubectl wait pod --timeout=-1s --for=condition=Ready -l '!job-name' -n knative-serving
    42  
    43  # Configure Knative to use this ingress
    44  kubectl patch configmap/config-network \
    45    --namespace knative-serving \
    46    --type merge \
    47    --patch '{"data":{"ingress.class":"kourier.ingress.networking.knative.dev"}}'
    48  
    49  
    50  cat <<EOF | kubectl apply -f -
    51  apiVersion: v1
    52  kind: Service
    53  metadata:
    54    name: kourier-ingress
    55    namespace: kourier-system
    56    labels:
    57      networking.knative.dev/ingress-provider: kourier
    58  spec:
    59    type: NodePort
    60    selector:
    61      app: 3scale-kourier-gateway
    62    ports:
    63      - name: http2
    64        nodePort: 31080
    65        port: 80
    66        targetPort: 8080
    67  EOF