From 972f32bdb085f324ecdc0c086c8bece47650945d Mon Sep 17 00:00:00 2001 From: Michael Nairn Date: Thu, 22 Feb 2024 11:41:11 +0000 Subject: [PATCH] refactor: Align local-setup and quick-start deployment paths Updates local-setup to use the same kustomizations as the quick start scripts. Installation and configuration of hub and spoke dependencies is now consistent across both deployment paths. The only difference between quick start and local setup now is that metrics is enabled by default with local-setup and managedzones and dns providers are created using local environment files instead of environment variables. --- README.md | 29 +-- config/local-setup/issuer/issuer.yaml | 6 - config/local-setup/issuer/kustomization.yaml | 2 - .../control-cluster/kustomization.yaml | 2 +- hack/.deployUtils | 201 +----------------- hack/local-setup-mgc.sh | 83 +++++--- hack/quickstart-setup.sh | 144 +++++++++++-- test/util/suite_config.go | 4 +- 8 files changed, 194 insertions(+), 277 deletions(-) delete mode 100644 config/local-setup/issuer/issuer.yaml delete mode 100644 config/local-setup/issuer/kustomization.yaml diff --git a/README.md b/README.md index 3cee9d8d0..d04278eba 100644 --- a/README.md +++ b/README.md @@ -12,17 +12,12 @@ Key Features: - Health checks to detect and take remedial action against unhealthy endpoints - Cloud DNS provider integrations (AWS route 53) with new ones being added (google DNS) - When deploying the multicluster gateway controller using the make targets, the following will be created: * Kind cluster(s) * Gateway API CRDs in the control plane cluster * Ingress controller * Cert manager -* ArgoCD instance -* K8s Dashboard * LetsEncrypt certs - - ## Prerequisites: * AWS or GCP @@ -71,28 +66,7 @@ When deploying the multicluster gateway controller using the make targets, the f make build-gateway-controller run-gateway-controller ``` -## 3. Running the agent in the cluster: -1. Build the agent image and load it into the workload cluster - ```sh - kubectl config use-context kind-mgc-workload-1 - make kind-load-agent - ``` - -1. Deploy the agent to the workload cluster - ```sh - make deploy-agent - ``` - -## 4. Running the agent locally -1. Target the workload cluster you wish to run on: -```sh -export KUBECONFIG=./tmp/kubeconfigs/mgc-workload-1.kubeconfig -``` -1. Run the agent locally: -```sh -make build-agent run-agent -``` -## 5. Clean up local environment +## 3. Clean up local environment In any terminal window target control plane cluster by: ```bash kubectl config use-context kind-mgc-control-plane @@ -121,4 +95,3 @@ 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. - diff --git a/config/local-setup/issuer/issuer.yaml b/config/local-setup/issuer/issuer.yaml deleted file mode 100644 index fdd2cb5bc..000000000 --- a/config/local-setup/issuer/issuer.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: cert-manager.io/v1 -kind: ClusterIssuer -metadata: - name: glbc-ca -spec: - selfSigned: {} diff --git a/config/local-setup/issuer/kustomization.yaml b/config/local-setup/issuer/kustomization.yaml deleted file mode 100644 index 7a9676a44..000000000 --- a/config/local-setup/issuer/kustomization.yaml +++ /dev/null @@ -1,2 +0,0 @@ -resources: -- ./issuer.yaml \ No newline at end of file diff --git a/config/quick-start/control-cluster/kustomization.yaml b/config/quick-start/control-cluster/kustomization.yaml index 4fe5671fa..a83d21ded 100644 --- a/config/quick-start/control-cluster/kustomization.yaml +++ b/config/quick-start/control-cluster/kustomization.yaml @@ -20,4 +20,4 @@ patchesStrategicMerge: metadata: name: mgc-cert-manager-webhook namespace: cert-manager - $patch: delete \ No newline at end of file + $patch: delete diff --git a/hack/.deployUtils b/hack/.deployUtils index f529a9429..0c1994349 100644 --- a/hack/.deployUtils +++ b/hack/.deployUtils @@ -60,10 +60,6 @@ deployOCMHub(){ echo "PATCHING CLUSTERMANAGER: placement image patch to use amd64 image - See https://kubernetes.slack.com/archives/C01GE7YSUUF/p1685016272443249" kubectl patch clustermanager cluster-manager --type='merge' -p '{"spec":{"placementImagePullSpec":"quay.io/open-cluster-management/placement:v0.11.0-amd64"}}' --context kind-${clusterName} echo "checking if cluster is single or multi" - if [[ -n "${OCM_SINGLE}" ]]; then - deployOCMSpoke ${clusterName} - deployOLM ${KIND_CLUSTER_CONTROL_PLANE} - fi } deployOCMSpoke() { @@ -84,25 +80,8 @@ deployOCMSpoke() { done } - - -# local-setup-mgc specific functions LOCAL_SETUP_DIR="$(dirname "${BASH_SOURCE[0]}")" - -deployMetalLB () { - local METALLB_KUSTOMIZATION_DIR=${LOCAL_SETUP_DIR}/../config/metallb - clusterName=${1} - metalLBSubnet=${2} - - kubectl config use-context kind-${clusterName} - echo "Deploying MetalLB to ${clusterName}" - ${KUSTOMIZE_BIN} build ${METALLB_KUSTOMIZATION_DIR} | kubectl apply -f - - echo "Waiting for deployments to be ready ..." - kubectl -n metallb-system wait --for=condition=ready pod --selector=app=metallb --timeout=600s - configureMetalLB ${clusterName} ${metalLBSubnet} -} - deployIngressController () { local INGRESS_NGINX_KUSTOMIZATION_DIR="$2" if [ -z "$2" ]; then @@ -116,58 +95,6 @@ deployIngressController () { kubectl -n ingress-nginx wait --timeout=600s --for=condition=Available deployments --all } -deployCertManager() { - local CERT_MANAGER_KUSTOMIZATION_DIR=${LOCAL_SETUP_DIR}/../config/cert-manager - clusterName=${1} - echo "Deploying Cert Manager to (${clusterName})" - - kubectl config use-context kind-${clusterName} - - ${KUSTOMIZE_BIN} build ${CERT_MANAGER_KUSTOMIZATION_DIR} --enable-helm --helm-command ${HELM_BIN} | kubectl apply -f - - echo "Waiting for Cert Manager deployments to be ready..." - kubectl -n cert-manager wait --timeout=300s --for=condition=Available deployments --all - - kubectl delete validatingWebhookConfiguration mgc-cert-manager-webhook - kubectl delete mutatingWebhookConfiguration mgc-cert-manager-webhook -} - -#ToDo Use kuadrant operator dependencies -deployIstio() { - local ISTIO_KUSTOMIZATION_DIR=${LOCAL_SETUP_DIR}/../config/istio/istio-operator.yaml - clusterName=${1} - echo "Deploying Istio to (${clusterName})" - - kubectl config use-context kind-${clusterName} - ${ISTIOCTL_BIN} operator init - kubectl apply -f ${ISTIO_KUSTOMIZATION_DIR} -} - -#ToDo Use kuadrant operator dependencies -installGatewayAPI() { - local GATEWAY_API_KUSTOMIZATION_DIR=${LOCAL_SETUP_DIR}/../config/gateway-api - clusterName=${1} - kubectl config use-context kind-${clusterName} - echo "Installing Gateway API in ${clusterName}" - - ${KUSTOMIZE_BIN} build ${GATEWAY_API_KUSTOMIZATION_DIR} | kubectl apply -f - -} - -initController() { - clusterName=${1} - kubectl config use-context kind-${clusterName} - echo "Initialize local dev setup for the controller on ${clusterName}" -# # Add the mgc CRDs - ${KUSTOMIZE_BIN} build config/local-setup/controller/ | kubectl apply -f - - ${KUSTOMIZE_BIN} build config/local-setup/issuer/ | kubectl apply -f - - ${KUSTOMIZE_BIN} build config/dependencies/kuadrant-operator/ | kubectl apply -f - - if [[ -f "controller-config.env" && -f "gcp-credentials.env" ]]; then - ${KUSTOMIZE_BIN} --reorder none --load-restrictor LoadRestrictionsNone build config/local-setup/controller/gcp | kubectl apply -f - - fi - if [[ -f "controller-config.env" && -f "aws-credentials.env" ]]; then - ${KUSTOMIZE_BIN} --reorder none --load-restrictor LoadRestrictionsNone build config/local-setup/controller/aws | kubectl apply -f - - fi -} - deployThanos() { local THANOS_KUSTOMIZATION_DIR="$2" if [ -z "$2" ]; then @@ -206,138 +133,32 @@ deployPrometheusForFederation() { fi } -# quickstart-setup specific functions - -setupAWSProvider() { - local namespace="$1" - if [ -z "$1" ]; then - namespace="multi-cluster-gateways" - fi - if [ "$KUADRANT_AWS_ACCESS_KEY_ID" == "" ]; then - echo "KUADRANT_AWS_ACCESS_KEY_ID is not set" - exit 1 - fi - - kubectl apply -f - <