From 5d4f2a849b384c3772d7ef5d868f5fd1e659db95 Mon Sep 17 00:00:00 2001 From: Adam Cattermole Date: Tue, 23 Jan 2024 10:49:16 +0000 Subject: [PATCH] Use istioctl for local install and skip sail tests on PR (#395) --- .github/workflows/test.yaml | 5 +++++ hack/quickstart-setup.sh | 26 ++++++++++++++++++++++---- make/istio.mk | 2 +- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index d6f798065..798653bd8 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -48,6 +48,11 @@ jobs: strategy: matrix: istio-type: [ sail, istioctl ] + pr-event: + - ${{ github.event_name == 'pull_request' }} + exclude: + - istio-type: sail + pr-event: true runs-on: ubuntu-latest env: KIND_CLUSTER_NAME: kuadrant-test diff --git a/hack/quickstart-setup.sh b/hack/quickstart-setup.sh index cfa5667b5..d13988d26 100755 --- a/hack/quickstart-setup.sh +++ b/hack/quickstart-setup.sh @@ -26,16 +26,24 @@ if [ -z $MGC_REF ]; then MGC_REF=${MGC_REF:="main"} fi -SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +if [ -z $ISTIO_INSTALL_SAIL]; then + ISTIO_INSTALL_SAIL=${ISTIO_INSTALL_SAIL:=false} +fi + +echo "Loading quickstart scripts from GitHub" source /dev/stdin <<< "$(curl -s https://raw.githubusercontent.com/${KUADRANT_ORG}/multicluster-gateway-controller/${MGC_REF}/hack/.quickstartEnv)" source /dev/stdin <<< "$(curl -s https://raw.githubusercontent.com/${KUADRANT_ORG}/multicluster-gateway-controller/${MGC_REF}/hack/.deployUtils)" +YQ_BIN=$(dockerBinCmd "yq") + KUADRANT_IMAGE="quay.io/${KUADRANT_ORG}/kuadrant-operator:latest" KUADRANT_REPO="github.com/${KUADRANT_ORG}/kuadrant-operator.git" +MGC_REPO="github.com/${KUADRANT_ORG}/multicluster-gateway-controller.git" KUADRANT_REPO_RAW="https://raw.githubusercontent.com/${KUADRANT_ORG}/kuadrant-operator/${KUADRANT_REF}" KUADRANT_DEPLOY_KUSTOMIZATION="${KUADRANT_REPO}/config/deploy" KUADRANT_GATEWAY_API_KUSTOMIZATION="${KUADRANT_REPO}/config/dependencies/gateway-api" KUADRANT_ISTIO_KUSTOMIZATION="${KUADRANT_REPO}/config/dependencies/istio/sail" +MGC_ISTIO_KUSTOMIZATION="${MGC_REPO}/config/istio" KUADRANT_CERT_MANAGER_KUSTOMIZATION="${KUADRANT_REPO}/config/dependencies/cert-manager" KUADRANT_METALLB_KUSTOMIZATION="${KUADRANT_REPO}/config/metallb" @@ -48,6 +56,7 @@ if [[ "${KUADRANT_REF}" != "main" ]]; then KUADRANT_ISTIO_KUSTOMIZATION=${KUADRANT_ISTIO_KUSTOMIZATION}?ref=${KUADRANT_REF} KUADRANT_CERT_MANAGER_KUSTOMIZATION=${KUADRANT_CERT_MANAGER_KUSTOMIZATION}?ref=${KUADRANT_REF} KUADRANT_METALLB_KUSTOMIZATION=${KUADRANT_METALLB_KUSTOMIZATION}?ref=${KUADRANT_REF} + MGC_ISTIO_KUSTOMIZATION=${MGC_ISTIO_KUSTOMIZATION}?ref=${MGC_REF} fi # Make temporary directory @@ -78,9 +87,18 @@ ${KUSTOMIZE_BIN} build ${KUADRANT_GATEWAY_API_KUSTOMIZATION} | kubectl apply -f # Install istio echo "Installing Istio in ${KUADRANT_CLUSTER_NAME}" -${KUSTOMIZE_BIN} build ${KUADRANT_ISTIO_KUSTOMIZATION} | kubectl apply -f - -kubectl -n istio-system wait --for=condition=Available deployment istio-operator --timeout=300s -kubectl apply -f ${KUADRANT_REPO_RAW}/config/dependencies/istio/sail/istio.yaml +if [ "$ISTIO_INSTALL_SAIL" = true ]; then + ${KUSTOMIZE_BIN} build ${KUADRANT_ISTIO_KUSTOMIZATION} | kubectl apply -f - + kubectl -n istio-system wait --for=condition=Available deployment istio-operator --timeout=300s + kubectl apply -f ${KUADRANT_REPO_RAW}/config/dependencies/istio/sail/istio.yaml +else + # Create CRD first to prevent race condition with creating CR + ${KUSTOMIZE_BIN} build ${MGC_ISTIO_KUSTOMIZATION} > ${TMP_DIR}/doctmp + ${YQ_BIN} 'select(.kind == "CustomResourceDefinition")' ${TMP_DIR}/doctmp | kubectl apply -f - + kubectl -n istio-system wait --for=condition=established crd/istiooperators.install.istio.io --timeout=60s + cat ${TMP_DIR}/doctmp | kubectl apply -f - + kubectl -n istio-operator wait --for=condition=Available deployment istio-operator --timeout=300s +fi # Install cert-manager echo "Installing cert-manager in ${KUADRANT_CLUSTER_NAME}" diff --git a/make/istio.mk b/make/istio.mk index 42c239f9c..04efb039f 100644 --- a/make/istio.mk +++ b/make/istio.mk @@ -6,7 +6,7 @@ ISTIO_INSTALL_DIR = config/dependencies/istio ISTIO_NAMESPACE = istio-system ## installs project sail vs istioctl install -ISTIO_INSTALL_SAIL ?= true +ISTIO_INSTALL_SAIL ?= false ifeq (true,$(ISTIO_INSTALL_SAIL)) INSTALL_COMMAND=sail-install else