From 78a0a36d19ea73f0626338e3bab4d47b03865b3e Mon Sep 17 00:00:00 2001 From: Adam Cattermole Date: Mon, 11 Dec 2023 11:47:55 +0000 Subject: [PATCH 1/3] Set network for dockerBinCmd via env var Signed-off-by: Adam Cattermole --- hack/.kindUtils | 2 +- hack/.quickstartEnv | 6 +++++- hack/.setupEnv | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hack/.kindUtils b/hack/.kindUtils index 7e8d744a7..32e612bb5 100644 --- a/hack/.kindUtils +++ b/hack/.kindUtils @@ -72,7 +72,7 @@ kindSetupMGCClusters() { local dataPlaneClusterCount=$5 # Create network for the clusters - docker network create -d bridge --subnet 172.31.0.0/16 mgc --gateway 172.31.0.1 \ + docker network create -d bridge --subnet 172.31.0.0/16 ${KIND_CLUSTER_DOCKER_NETWORK} --gateway 172.31.0.1 \ -o "com.docker.network.bridge.enable_ip_masquerade"="true" \ -o "com.docker.network.driver.mtu"="1500" diff --git a/hack/.quickstartEnv b/hack/.quickstartEnv index f6751fe9b..28496a2ac 100644 --- a/hack/.quickstartEnv +++ b/hack/.quickstartEnv @@ -2,7 +2,11 @@ export TOOLS_IMAGE=quay.io/kuadrant/mgc-tools:latest export TMP_DIR=/tmp/mgc dockerBinCmd() { - echo "docker run --rm -u $UID -v ${TMP_DIR}:/tmp/mgc:z --network mgc -e KUBECONFIG=/tmp/mgc/kubeconfig --entrypoint=$1 $TOOLS_IMAGE" + local network="" + if [ ! -z ${KIND_CLUSTER_DOCKER_NETWORK} ]; then + network=" --network ${KIND_CLUSTER_DOCKER_NETWORK}" + fi + echo "docker run --rm -u $UID -v ${TMP_DIR}:/tmp/mgc:z${network} -e KUBECONFIG=/tmp/mgc/kubeconfig --entrypoint=$1 $TOOLS_IMAGE" } export KIND_BIN=kind diff --git a/hack/.setupEnv b/hack/.setupEnv index b716081fc..501dfbb97 100644 --- a/hack/.setupEnv +++ b/hack/.setupEnv @@ -3,6 +3,7 @@ export KIND_CLUSTER_PREFIX="mgc-" export KIND_CLUSTER_CONTROL_PLANE="${KIND_CLUSTER_PREFIX}control-plane" export KIND_CLUSTER_WORKLOAD="${KIND_CLUSTER_PREFIX}workload" +export KIND_CLUSTER_DOCKER_NETWORK="mgc" export port80=9090 export port443=8445 From 3a8a3c857bd38546df4213e3c7cad9b9a3b87e25 Mon Sep 17 00:00:00 2001 From: Adam Cattermole Date: Mon, 11 Dec 2023 16:06:29 +0000 Subject: [PATCH 2/3] Set namespace optional for configureController Signed-off-by: Adam Cattermole --- hack/.deployUtils | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/hack/.deployUtils b/hack/.deployUtils index 9f890ac69..8994033a4 100644 --- a/hack/.deployUtils +++ b/hack/.deployUtils @@ -323,6 +323,10 @@ deployPrometheusForFederation() { # quickstart-setup specific functions setupAWSProvider() { + local namespace="$1" + if [ -z "$1" ]; then + namespace="multi-cluster-gateways" + fi if [ "$MGC_AWS_ACCESS_KEY_ID" == "" ]; then echo "MGC_AWS_ACCESS_KEY_ID is not set" exit 1 @@ -333,7 +337,7 @@ apiVersion: v1 kind: Secret metadata: name: ${KIND_CLUSTER_PREFIX}aws-credentials - namespace: multi-cluster-gateways + namespace: ${namespace} type: "kuadrant.io/aws" stringData: AWS_ACCESS_KEY_ID: ${MGC_AWS_ACCESS_KEY_ID} @@ -344,7 +348,7 @@ apiVersion: v1 kind: ConfigMap metadata: name: ${KIND_CLUSTER_PREFIX}controller-config - namespace: multicluster-gateway-controller-system + namespace: ${namespace} data: AWS_DNS_PUBLIC_ZONE_ID: ${MGC_AWS_DNS_PUBLIC_ZONE_ID} ZONE_ROOT_DOMAIN: ${MGC_ZONE_ROOT_DOMAIN} @@ -354,7 +358,7 @@ apiVersion: kuadrant.io/v1alpha1 kind: ManagedZone metadata: name: ${KIND_CLUSTER_PREFIX}dev-mz - namespace: multi-cluster-gateways + namespace: ${namespace} spec: id: ${MGC_AWS_DNS_PUBLIC_ZONE_ID} domainName: ${MGC_ZONE_ROOT_DOMAIN} @@ -365,12 +369,16 @@ EOF } setupGCPProvider() { + local namespace="$1" + if [ -z "$1" ]; then + namespace="multi-cluster-gateways" + fi kubectl apply -f - < Date: Wed, 13 Dec 2023 14:03:13 +0000 Subject: [PATCH 3/3] Rename variables from MGC_ to KUADRANT_ Signed-off-by: Adam Cattermole --- .../multicluster-gateways-walkthrough.md | 16 +++++----- ...mple-ratelimitpolicy-for-app-developers.md | 10 +++---- .../control-plane-installation.md | 10 +++---- hack/.deployUtils | 18 +++++------ hack/.quickstartEnv | 30 +++++++++---------- 5 files changed, 42 insertions(+), 42 deletions(-) diff --git a/docs/how-to/multicluster-gateways-walkthrough.md b/docs/how-to/multicluster-gateways-walkthrough.md index cdb240900..c40747774 100644 --- a/docs/how-to/multicluster-gateways-walkthrough.md +++ b/docs/how-to/multicluster-gateways-walkthrough.md @@ -13,7 +13,7 @@ We will start with a hub cluster and 2 workload clusters and highlight the autom ## Initial Setup -In this walkthrough, we'll deploy test echo services across multiple clusters. If you followed the [Getting Started Guide](https://docs.kuadrant.io/getting-started/), you would have already set up a `MGC_ZONE_ROOT_DOMAIN` environment variable. For this tutorial, we'll derive a host from this domain for these echo services. +In this walkthrough, we'll deploy test echo services across multiple clusters. If you followed the [Getting Started Guide](https://docs.kuadrant.io/getting-started/), you would have already set up a `KUADRANT_ZONE_ROOT_DOMAIN` environment variable. For this tutorial, we'll derive a host from this domain for these echo services. ### Create a gateway @@ -50,7 +50,7 @@ You are now ready to begin creating a gateway! :tada: namespaces: from: All name: api - hostname: "*.$MGC_ZONE_ROOT_DOMAIN" + hostname: "*.$KUADRANT_ZONE_ROOT_DOMAIN" port: 443 protocol: HTTPS tls: @@ -202,7 +202,7 @@ The listener is configured to use this TLS secret also. So now our gateway has b So now we have workload ingress clusters configured with the same Gateway. -5. Let's create the HTTPRoute in the first workload cluster. Again, remembering to replace the hostname accordingly if you haven't already set a value for the `MGC_ZONE_ROOT_DOMAIN` variable as described in the [Getting Started Guide](https://docs.kuadrant.io/getting-started/): +5. Let's create the HTTPRoute in the first workload cluster. Again, remembering to replace the hostname accordingly if you haven't already set a value for the `KUADRANT_ZONE_ROOT_DOMAIN` variable as described in the [Getting Started Guide](https://docs.kuadrant.io/getting-started/): ```bash kubectl --context kind-mgc-workload-1 apply -f - <