From dd8b4091793e08ba7962325170bb32e29b86e141 Mon Sep 17 00:00:00 2001 From: Jont828 Date: Tue, 17 Dec 2024 13:04:06 -0500 Subject: [PATCH] Drop USE_AKS_MANAGEMENT_CLUSTER variable to avoid bugs in ci --- Makefile | 42 ++++++++++------------------------------ scripts/ci-entrypoint.sh | 15 +++++--------- 2 files changed, 15 insertions(+), 42 deletions(-) diff --git a/Makefile b/Makefile index b814ca5e082..23e42cd3c4a 100644 --- a/Makefile +++ b/Makefile @@ -166,8 +166,6 @@ TAG ?= dev ARCH ?= $(GOARCH) ALL_ARCH = amd64 arm arm64 ppc64le s390x -USE_AKS_MANAGEMENT_CLUSTER ?= false - # Allow overriding manifest generation destination directory MANIFEST_ROOT ?= config CRD_ROOT ?= $(MANIFEST_ROOT)/crd/bases @@ -316,12 +314,8 @@ install-tools: $(ENVSUBST) $(KUSTOMIZE) $(KUBECTL) $(HELM) $(GINKGO) $(KIND) $(A .PHONY: create-management-cluster create-management-cluster: $(KUSTOMIZE) $(ENVSUBST) $(KUBECTL) $(KIND) ## Create a management cluster. - # Create management cluster. - @if "${USE_AKS_MANAGEMENT_CLUSTER}" ; then \ - $(MAKE) aks-create ; \ - else \ - $(MAKE) kind-create ; \ - fi + # Create kind management cluster. + $(MAKE) kind-create # Install cert manager and wait for availability ./hack/install-cert-manager.sh @@ -337,9 +331,7 @@ create-management-cluster: $(KUSTOMIZE) $(ENVSUBST) $(KUBECTL) $(KIND) ## Create timeout --foreground 300 bash -c "until curl --retry $(CURL_RETRIES) -sSL https://github.com/kubernetes-sigs/cluster-api-addon-provider-helm/releases/download/v0.2.5/addon-components.yaml | $(ENVSUBST) | $(KUBECTL) apply -f -; do sleep 5; done" # Deploy CAPZ - @if ! "${USE_AKS_MANAGEMENT_CLUSTER}" ; then \ - $(KIND) load docker-image $(CONTROLLER_IMG)-$(ARCH):$(TAG) --name=$(KIND_CLUSTER_NAME) ; \ - fi + $(KIND) load docker-image $(CONTROLLER_IMG)-$(ARCH):$(TAG) --name=$(KIND_CLUSTER_NAME) ; \ timeout --foreground 300 bash -c "until $(KUSTOMIZE) build config/default | $(ENVSUBST) | $(KUBECTL) apply -f - --server-side=true; do sleep 5; done" # Wait for CAPI deployments @@ -369,26 +361,16 @@ create-management-cluster: $(KUSTOMIZE) $(ENVSUBST) $(KUBECTL) $(KIND) ## Create .PHONY: create-workload-cluster create-workload-cluster: $(ENVSUBST) $(KUBECTL) ## Create a workload cluster. + # Create workload Cluster. @if [ -z "${AZURE_CLIENT_ID_USER_ASSIGNED_IDENTITY}" ]; then \ export AZURE_CLIENT_ID_USER_ASSIGNED_IDENTITY=$(shell cat $(AZURE_IDENTITY_ID_FILEPATH)); \ fi; \ - # TODO: change this so it doesn't source aks-mgmt-vars.env when it is using a kind cluster - @if ${USE_AKS_MANAGEMENT_CLUSTER} ; then \ - if [ -f "$(TEMPLATES_DIR)/$(CLUSTER_TEMPLATE)" ]; then \ - timeout --foreground 300 bash -c "source aks-mgmt-vars.env && env && until $(ENVSUBST) < $(TEMPLATES_DIR)/$(CLUSTER_TEMPLATE) | $(KUBECTL) apply -f -; do sleep 5; done"; \ - elif [ -f "$(CLUSTER_TEMPLATE)" ]; then \ - timeout --foreground 300 bash -c "source aks-mgmt-vars.env && env && until $(ENVSUBST) < "$(CLUSTER_TEMPLATE)" | $(KUBECTL) apply -f -; do sleep 5; done"; \ - else \ - timeout --foreground 300 bash -c "source aks-mgmt-vars.env && env && until curl --retry "$(CURL_RETRIES)" "$(CLUSTER_TEMPLATE)" | "$(ENVSUBST)" | $(KUBECTL) apply -f -; do sleep 5; done"; \ - fi \ + if [ -f "$(TEMPLATES_DIR)/$(CLUSTER_TEMPLATE)" ]; then \ + timeout --foreground 300 bash -c "until $(ENVSUBST) < $(TEMPLATES_DIR)/$(CLUSTER_TEMPLATE) | $(KUBECTL) apply -f -; do sleep 5; done"; \ + elif [ -f "$(CLUSTER_TEMPLATE)" ]; then \ + timeout --foreground 300 bash -c "until $(ENVSUBST) < "$(CLUSTER_TEMPLATE)" | $(KUBECTL) apply -f -; do sleep 5; done"; \ else \ - if [ -f "$(TEMPLATES_DIR)/$(CLUSTER_TEMPLATE)" ]; then \ - timeout --foreground 300 bash -c "until $(ENVSUBST) < $(TEMPLATES_DIR)/$(CLUSTER_TEMPLATE) | $(KUBECTL) apply -f -; do sleep 5; done"; \ - elif [ -f "$(CLUSTER_TEMPLATE)" ]; then \ - timeout --foreground 300 bash -c "until $(ENVSUBST) < "$(CLUSTER_TEMPLATE)" | $(KUBECTL) apply -f -; do sleep 5; done"; \ - else \ - timeout --foreground 300 bash -c "until curl --retry "$(CURL_RETRIES)" "$(CLUSTER_TEMPLATE)" | "$(ENVSUBST)" | $(KUBECTL) apply -f -; do sleep 5; done"; \ - fi \ + timeout --foreground 300 bash -c "until curl --retry "$(CURL_RETRIES)" "$(CLUSTER_TEMPLATE)" | "$(ENVSUBST)" | $(KUBECTL) apply -f -; do sleep 5; done"; \ fi @@ -771,11 +753,7 @@ aks-create: $(KUBECTL) ## Create aks cluster as mgmt cluster. .PHONY: tilt-up tilt-up: install-tools ## Start tilt and build kind cluster if needed. # Create management cluster. - @if "${USE_AKS_MANAGEMENT_CLUSTER}" ; then \ - $(MAKE) aks-create ; \ - else \ - $(MAKE) kind-create ; \ - fi + $(MAKE) kind-create @if [ -z "${AZURE_CLIENT_ID_USER_ASSIGNED_IDENTITY}" ]; then \ export AZURE_CLIENT_ID_USER_ASSIGNED_IDENTITY=$(shell cat $(AZURE_IDENTITY_ID_FILEPATH)); \ diff --git a/scripts/ci-entrypoint.sh b/scripts/ci-entrypoint.sh index 85fb6e9de4a..c23e700816e 100755 --- a/scripts/ci-entrypoint.sh +++ b/scripts/ci-entrypoint.sh @@ -135,16 +135,11 @@ select_cluster_template() { create_cluster() { "${REPO_ROOT}/hack/create-dev-cluster.sh" - if "${USE_AKS_MANAGEMENT_CLUSTER}"; then - "${KUBECTL}" get clusters -A - else - if [ ! -f "${REPO_ROOT}/${KIND_CLUSTER_NAME}.kubeconfig" ]; then - echo "Unable to find kubeconfig for kind mgmt cluster ${KIND_CLUSTER_NAME}" - exit 1 - fi - "${KUBECTL}" --kubeconfig "${REPO_ROOT}/${KIND_CLUSTER_NAME}.kubeconfig" get clusters -A - fi; - + if [ ! -f "${REPO_ROOT}/${KIND_CLUSTER_NAME}.kubeconfig" ]; then + echo "Unable to find kubeconfig for kind mgmt cluster ${KIND_CLUSTER_NAME}" + exit 1 + fi + "${KUBECTL}" --kubeconfig "${REPO_ROOT}/${KIND_CLUSTER_NAME}.kubeconfig" get clusters -A # set the SSH bastion and user that can be used to SSH into nodes KUBE_SSH_BASTION=$(${KUBECTL} get azurecluster -o json | jq '.items[0].spec.networkSpec.apiServerLB.frontendIPs[0].publicIP.dnsName' | tr -d \"):22