This repository has been archived by the owner on Dec 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #758 from david-martin/stitch-walkthrough-with-pla…
…ceholders Copy the general flow and example commands to the API walkthrough, to…
- Loading branch information
Showing
3 changed files
with
300 additions
and
5 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
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
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,132 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# Copyright 2024 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. | ||
# | ||
|
||
export KFILT="docker run --rm -i ryane/kfilt" | ||
|
||
METRICS_FEDERATION=true | ||
|
||
if [ -z $MGC_BRANCH ]; then | ||
MGC_BRANCH=${MGC_BRANCH:="main"} | ||
fi | ||
if [ -z $MGC_ACCOUNT ]; then | ||
MGC_ACCOUNT=${MGC_ACCOUNT:="kuadrant"} | ||
fi | ||
|
||
if [ -n "$MGC_LOCAL_QUICKSTART_SCRIPTS_MODE" ]; then | ||
echo "Loading quickstart scripts locally" | ||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
source "${SCRIPT_DIR}/.quickstartEnv" | ||
source "${SCRIPT_DIR}/.kindUtils" | ||
source "${SCRIPT_DIR}/.cleanupUtils" | ||
source "${SCRIPT_DIR}/.deployUtils" | ||
source "${SCRIPT_DIR}/.startUtils" | ||
source "${SCRIPT_DIR}/.setupEnv" | ||
else | ||
echo "Loading quickstart scripts from GitHub" | ||
source /dev/stdin <<< "$(curl -s https://raw.githubusercontent.com/${MGC_ACCOUNT}/multicluster-gateway-controller/${MGC_BRANCH}/hack/.quickstartEnv)" | ||
source /dev/stdin <<< "$(curl -s https://raw.githubusercontent.com/${MGC_ACCOUNT}/multicluster-gateway-controller/${MGC_BRANCH}/hack/.kindUtils)" | ||
source /dev/stdin <<< "$(curl -s https://raw.githubusercontent.com/${MGC_ACCOUNT}/multicluster-gateway-controller/${MGC_BRANCH}/hack/.cleanupUtils)" | ||
source /dev/stdin <<< "$(curl -s https://raw.githubusercontent.com/${MGC_ACCOUNT}/multicluster-gateway-controller/${MGC_BRANCH}/hack/.deployUtils)" | ||
source /dev/stdin <<< "$(curl -s https://raw.githubusercontent.com/${MGC_ACCOUNT}/multicluster-gateway-controller/${MGC_BRANCH}/hack/.startUtils)" | ||
source /dev/stdin <<< "$(curl -s https://raw.githubusercontent.com/${MGC_ACCOUNT}/multicluster-gateway-controller/${MGC_BRANCH}/hack/.setupEnv)" | ||
fi | ||
|
||
export OPERATOR_SDK_BIN=$(dockerBinCmd "operator-sdk") | ||
export YQ_BIN=$(dockerBinCmd "yq") | ||
export CLUSTERADM_BIN=$(dockerBinCmd "clusteradm") | ||
|
||
MGC_REPO=${MGC_REPO:="github.com/${MGC_ACCOUNT}/multicluster-gateway-controller.git"} | ||
PROMETHEUS_DIR=${MGC_REPO}/config/prometheus | ||
INGRESS_NGINX_DIR=${MGC_REPO}/config/ingress-nginx | ||
PROMETHEUS_FOR_FEDERATION_DIR=${MGC_REPO}/config/prometheus-for-federation | ||
PROMETHEUS_FOR_FEDERATION_API_DASHBOARDS_KUSTOMIZATION_DIR=${PROMETHEUS_FOR_FEDERATION_DIR}/api-dashboards | ||
PROMETHEUS_FOR_FEDERATION_API_DASHBOARDS_GRAFANA_PATCH=https://raw.githubusercontent.com/${MGC_ACCOUNT}/multicluster-gateway-controller/${MGC_BRANCH}/config/prometheus-for-federation/api-dashboards/grafana_deployment_patch.yaml | ||
THANOS_DIR=${MGC_REPO}/config/thanos | ||
QUICK_START_HUB_KUSTOMIZATION=${MGC_REPO}/config/quick-start/control-cluster | ||
QUICK_START_SPOKE_KUSTOMIZATION=${MGC_REPO}/config/quick-start/workload-cluster | ||
|
||
set -e pipefail | ||
|
||
if [[ "${MGC_BRANCH}" != "main" ]]; then | ||
echo "setting MGC_REPO to use branch ${MGC_BRANCH}" | ||
QUICK_START_HUB_KUSTOMIZATION=${QUICK_START_HUB_KUSTOMIZATION}?ref=${MGC_BRANCH} | ||
QUICK_START_SPOKE_KUSTOMIZATION=${QUICK_START_SPOKE_KUSTOMIZATION}?ref=${MGC_BRANCH} | ||
echo "set QUICK_START_HUB_KUSTOMIZATION to ${QUICK_START_HUB_KUSTOMIZATION}" | ||
echo "set QUICK_START_SPOKE_KUSTOMIZATION to ${QUICK_START_SPOKE_KUSTOMIZATION}" | ||
|
||
fi | ||
|
||
|
||
# Prompt user for any required env vars that have not been set | ||
requiredENV | ||
|
||
# Default config | ||
if [[ -z "${LOG_LEVEL}" ]]; then | ||
LOG_LEVEL=1 | ||
fi | ||
if [[ -z "${MGC_WORKLOAD_CLUSTERS_COUNT}" ]]; then | ||
MGC_WORKLOAD_CLUSTERS_COUNT=2 | ||
fi | ||
|
||
# Make temporary directory for kubeconfig | ||
mkdir -p ${TMP_DIR} | ||
|
||
cleanupKind | ||
|
||
kindSetupMGCClusters ${KIND_CLUSTER_CONTROL_PLANE} ${KIND_CLUSTER_WORKLOAD} ${port80} ${port443} ${MGC_WORKLOAD_CLUSTERS_COUNT} | ||
|
||
# Apply Cluster Configurations to Control cluster | ||
# Deploy OCM hub | ||
deployOCMHub ${KIND_CLUSTER_CONTROL_PLANE} "minimal" | ||
# Deploy Quick start kustomize | ||
deployQuickStartControl ${KIND_CLUSTER_CONTROL_PLANE} | ||
# Initialize local dev setup for the controller on the control-plane cluster | ||
configureController ${KIND_CLUSTER_CONTROL_PLANE} | ||
# Deploy MetalLb | ||
configureMetalLB ${KIND_CLUSTER_CONTROL_PLANE} ${metalLBSubnetStart} | ||
# Deploy Prometheus in the hub too | ||
deployPrometheusForFederation ${KIND_CLUSTER_CONTROL_PLANE} ${PROMETHEUS_FOR_FEDERATION_DIR}?ref=${MGC_BRANCH} | ||
# Deploy Thanos components in the hub | ||
deployThanos ${KIND_CLUSTER_CONTROL_PLANE} ${THANOS_DIR} | ||
# Deploy Prometheus components in the hub | ||
deployPrometheus ${KIND_CLUSTER_CONTROL_PLANE} | ||
# Deploy API Dashboards in hub | ||
installAPIDashboards ${KIND_CLUSTER_CONTROL_PLANE} ${PROMETHEUS_FOR_FEDERATION_API_DASHBOARDS_KUSTOMIZATION_DIR}?ref=${MGC_BRANCH} ${PROMETHEUS_FOR_FEDERATION_API_DASHBOARDS_GRAFANA_PATCH} | ||
|
||
|
||
# Apply Cluster Configurations to Workload clusters | ||
if [[ -n "${MGC_WORKLOAD_CLUSTERS_COUNT}" ]]; then | ||
for ((i = 1; i <= ${MGC_WORKLOAD_CLUSTERS_COUNT}; i++)); do | ||
deployQuickStartWorkload ${KIND_CLUSTER_WORKLOAD}-${i} | ||
configureMetalLB ${KIND_CLUSTER_WORKLOAD}-${i} $((${metalLBSubnetStart} + ${i})) | ||
deployOLM ${KIND_CLUSTER_WORKLOAD}-${i} | ||
deployOCMSpoke ${KIND_CLUSTER_WORKLOAD}-${i} | ||
configureManagedAddon ${KIND_CLUSTER_CONTROL_PLANE} ${KIND_CLUSTER_WORKLOAD}-${i} | ||
configureClusterAsIngress ${KIND_CLUSTER_CONTROL_PLANE} ${KIND_CLUSTER_WORKLOAD}-${i} | ||
deployPrometheusForFederation ${KIND_CLUSTER_WORKLOAD}-${i} ${PROMETHEUS_FOR_FEDERATION_DIR}?ref=${MGC_BRANCH} | ||
done | ||
fi | ||
|
||
kubectl config use-context kind-${KIND_CLUSTER_CONTROL_PLANE} | ||
|
||
|
||
echo "" | ||
echo "What's next... | ||
Now that you have 2 kind clusters configured and with multicluster-gateway-controller installed you are ready to begin creating gateways | ||
Visit https://docs.kuadrant.io/multicluster-gateway-controller/docs/how-to/multicluster-gateways-walkthrough/ for next steps" |