-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6e985e3
commit d17dad5
Showing
1 changed file
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# Copyright 2021 Red Hat, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
if [ -z $KUADRANT_BRANCH ]; then | ||
KUADRANT_BRANCH=${KUADRANT_BRANCH:="main"} | ||
fi | ||
if [ -z $KUADRANT_ORG ]; then | ||
KUADRANT_ORG=${KUADRANT_ORG:="kuadrant"} | ||
fi | ||
if [ -z $MCG_BRANCH ]; then | ||
MCG_BRANCH=${MCG_BRANCH:="main"} | ||
fi | ||
|
||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
source /dev/stdin <<< "$(curl -s https://raw.githubusercontent.com/adam-cattermole/multicluster-gateway-controller/optional-set-network/hack/.quickstartEnv)" | ||
source /dev/stdin <<< "$(curl -s https://raw.githubusercontent.com/${KUADRANT_ORG}/multicluster-gateway-controller/${MCG_BRANCH}/hack/.deployUtils)" | ||
|
||
|
||
KUADRANT_IMAGE="quay.io/${KUADRANT_ORG}/kuadrant-operator:latest" | ||
KUADRANT_REPO="github.com/${KUADRANT_ORG}/kuadrant-operator.git" | ||
KUADRANT_REPO_RAW="https://raw.githubusercontent.com/${KUADRANT_ORG}/kuadrant-operator/${KUADRANT_BRANCH}" | ||
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" | ||
KUADRANT_CERT_MANAGER_KUSTOMIZATION="${KUADRANT_REPO}/config/dependencies/cert-manager" | ||
|
||
set -e pipefail | ||
|
||
if [[ "${KUADRANT_BRANCH}" != "main" ]]; then | ||
echo "setting KUADRANT_REPO to use branch ${KUADRANT_BRANCH}" | ||
KUADRANT_IMAGE="quay.io/${KUADRANT_ORG}/kuadrant-operator:${KUADRANT_BRANCH}" | ||
KUADRANT_GATEWAY_API_KUSTOMIZATION=${KUADRANT_GATEWAY_API_KUSTOMIZATION}?ref=${KUADRANT_BRANCH} | ||
KUADRANT_ISTIO_KUSTOMIZATION=${KUADRANT_ISTIO_KUSTOMIZATION}?ref=${KUADRANT_BRANCH} | ||
KUADRANT_CERT_MANAGER_KUSTOMIZATION=${KUADRANT_CERT_MANAGER_KUSTOMIZATION}?ref=${KUADRANT_BRANCH} | ||
fi | ||
|
||
# Make temporary directory | ||
mkdir -p ${TMP_DIR} | ||
|
||
KUADRANT_CLUSTER_NAME=kuadrant-local | ||
KUADRANT_NAMESPACE=kuadrant-system | ||
|
||
# Kind delete cluster | ||
${KIND_BIN} delete cluster --name ${KUADRANT_CLUSTER_NAME} | ||
|
||
# Kind create cluster | ||
${KIND_BIN} create cluster --name ${KUADRANT_CLUSTER_NAME} --config=- <<< "$(curl -s ${KUADRANT_REPO_RAW}/utils/kind-cluster.yaml)" | ||
kubectl config use-context kind-${KUADRANT_CLUSTER_NAME} | ||
|
||
# Create namespace | ||
kubectl create namespace ${KUADRANT_NAMESPACE} | ||
|
||
# Install gateway api | ||
${KUSTOMIZE_BIN} build ${KUADRANT_GATEWAY_API_KUSTOMIZATION} | kubectl apply -f - | ||
|
||
# Install istio | ||
${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 | ||
|
||
# Install cert-manager | ||
${KUSTOMIZE_BIN} build ${KUADRANT_CERT_MANAGER_KUSTOMIZATION} | kubectl apply -f - | ||
kubectl -n cert-manager wait --for=condition=Available deployments --all --timeout=300s | ||
|
||
# Install kuadrant | ||
${KUSTOMIZE_BIN} build ${KUADRANT_DEPLOY_KUSTOMIZATION} | kubectl apply -f - | ||
kubectl -n kuadrant-system patch deployment kuadrant-operator-controller-manager --type='merge' -p '{"spec":{"template":{"spec":{"containers":[{"name":"manager","image":"'"${KUADRANT_IMAGE}"'"}]}}}}' | ||
kubectl -n kuadrant-system apply -f ${KUADRANT_REPO_RAW}/config/samples/kuadrant_v1beta1_kuadrant.yaml | ||
|
||
# Configure managedzone etc WIP | ||
echo "Do you want to set up a DNS provider? (y/N)" | ||
read SETUP_PROVIDER </dev/tty | ||
if [[ "$SETUP_PROVIDER" =~ ^[yY]$ ]]; then | ||
requiredENV | ||
configureController ${KUADRANT_CLUSTER_NAME} | ||
fi |