diff --git a/AGENTS.md b/AGENTS.md index 379d80619e0..94c78f63f5b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -117,6 +117,8 @@ make kind-reset **tilt-settings.yaml** is required with Azure credentials (see docs/book/src/developers/development.md for details). +`make tilt-up` runs `check-az-cli`; if `az` is missing, it warns and tells you to install the Azure CLI and retry `make tilt-up` (needed for Tilt flows that call `az`, e.g. VNet peering with AKS as management cluster). Use `VERBOSE=1 make check-az-cli` to print the detected binary path. + ### E2E Testing ```bash diff --git a/Makefile b/Makefile index 64d58820eb7..5fcc813fb21 100644 --- a/Makefile +++ b/Makefile @@ -829,8 +829,19 @@ aks-create: $(KUBECTL) ## Create aks cluster as mgmt cluster. aks-delete: $(KUBECTL) ## Deletes the resource group and the associated AKS clusters listed under allowed_contexts in ./tilt-settings.yaml . ./scripts/aks-delete.sh +.PHONY: check-az-cli +check-az-cli: ## Warn if Azure CLI (az) is not installed (Tilt uses it for VNet peering with AKS management clusters). Set VERBOSE=1 to print path when found. + @if ! command -v az >/dev/null 2>&1; then \ + echo "WARNING: Azure CLI (az) is not installed or not on your PATH."; \ + echo " Please install it before continuing with Tilt; without it, steps that call 'az' (for example VNet peering with an AKS management cluster) will fail."; \ + echo " Install: https://learn.microsoft.com/en-us/cli/azure/install-azure-cli"; \ + echo " After installing, ensure 'az' is on your PATH, then run make tilt-up again."; \ + elif [ -n "$(VERBOSE)" ]; then \ + echo "Azure CLI (az) found: $$(command -v az)"; \ + fi + .PHONY: tilt-up -tilt-up: install-tools ## Start tilt and build kind cluster if needed. +tilt-up: install-tools check-az-cli ## Start tilt and build kind cluster if needed. @if [ -z "${AZURE_CLIENT_ID_USER_ASSIGNED_IDENTITY}" ]; then \ export AZURE_CLIENT_ID_USER_ASSIGNED_IDENTITY=$(shell cat $(AZURE_IDENTITY_ID_FILEPATH)); \ fi; \ diff --git a/Tiltfile b/Tiltfile index c14b8b8f390..78c5d80c21d 100644 --- a/Tiltfile +++ b/Tiltfile @@ -538,7 +538,6 @@ def waitforsystem(): local(kubectl_cmd + " wait --for=condition=ready --timeout=300s pod --all -n capi-system") def peer_vnets(): - # TODO: check for az cli to be installed in local peering_cmd = ''' echo "--------Peering VNETs--------"; az network vnet wait --resource-group ${AKS_RESOURCE_GROUP} --name ${AKS_MGMT_VNET_NAME} --created --timeout 180; diff --git a/docs/book/src/developers/development.md b/docs/book/src/developers/development.md index 372234f27c0..94278d0bb62 100644 --- a/docs/book/src/developers/development.md +++ b/docs/book/src/developers/development.md @@ -143,6 +143,8 @@ Install [Helm](https://helm.sh/docs/intro/install/): You would require installation of Helm for successfully setting up Tilt. +Install the [Azure CLI][azure_cli] if you use Tilt workflows that invoke `az` against Azure (for example VNet peering when using an AKS management cluster with an internal load balancer; see [Tilt with AKS as management cluster (ILB)](tilt-with-aks-as-mgmt-ilb.md)). `make tilt-up` runs `make check-az-cli` first; if `az` is missing, it prints a warning that asks you to install the CLI and fix your `PATH` before continuing with Tilt. To print the resolved `az` path when it is installed, run `VERBOSE=1 make check-az-cli`. + ### Using Tilt Both of the [Tilt](https://tilt.dev) setups below will get you started developing CAPZ in a local kind cluster.