-
Notifications
You must be signed in to change notification settings - Fork 260
Add BYO CNI cluster automation to hack/aks/Makefile #3846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
3c52106
b771da8
7a08a48
7269168
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -33,6 +33,18 @@ CLUSTER ?= $(USER)-$(REGION) | |||||||||
| GROUP ?= $(CLUSTER) | ||||||||||
| VNET ?= $(CLUSTER) | ||||||||||
|
|
||||||||||
| # BYO CNI cluster configuration | ||||||||||
| CNI_TYPE ?= cilium | ||||||||||
| CNS_VERSION ?= v1.5.38 | ||||||||||
| AZURE_IPAM_VERSION ?= v0.3.0 | ||||||||||
| CNS_IMAGE_REPO ?= MCR | ||||||||||
| CILIUM_DIR ?= 1.14 | ||||||||||
| CILIUM_VERSION_TAG ?= v1.14.8 | ||||||||||
| CILIUM_IMAGE_REGISTRY ?= acnpublic.azurecr.io | ||||||||||
| IPV6_HP_BPF_VERSION ?= v0.0.3 | ||||||||||
| DUALSTACK ?= false | ||||||||||
| REPO_ROOT ?= $(shell git rev-parse --show-toplevel) | ||||||||||
|
|
||||||||||
| # Long Term Support (LTS) | ||||||||||
| ifeq ($(LTS),true) | ||||||||||
| LTS_ARGS=--k8s-support-plan AKSLongTermSupport --tier premium | ||||||||||
|
|
@@ -109,6 +121,16 @@ vars: ## Show the input vars configured for the cluster commands | |||||||||
| @echo K8S_VER=$(K8S_VER) | ||||||||||
| @echo LTS_ARGS=$(if $(LTS_ARGS),$(LTS_ARGS),$(LTS)) | ||||||||||
| @echo COMMON_AKS_FIELDS=$(COMMON_AKS_FIELDS) | ||||||||||
| @echo CNI_TYPE=$(CNI_TYPE) | ||||||||||
| @echo CNS_VERSION=$(CNS_VERSION) | ||||||||||
| @echo AZURE_IPAM_VERSION=$(AZURE_IPAM_VERSION) | ||||||||||
| @echo CNS_IMAGE_REPO=$(CNS_IMAGE_REPO) | ||||||||||
| @echo CILIUM_DIR=$(CILIUM_DIR) | ||||||||||
| @echo CILIUM_VERSION_TAG=$(CILIUM_VERSION_TAG) | ||||||||||
| @echo CILIUM_IMAGE_REGISTRY=$(CILIUM_IMAGE_REGISTRY) | ||||||||||
| @echo IPV6_HP_BPF_VERSION=$(IPV6_HP_BPF_VERSION) | ||||||||||
| @echo DUALSTACK=$(DUALSTACK) | ||||||||||
| @echo REPO_ROOT=$(REPO_ROOT) | ||||||||||
|
|
||||||||||
|
|
||||||||||
| ##@ SWIFT Infra | ||||||||||
|
|
@@ -413,3 +435,110 @@ restart-vmss: ## Restarts the nodes in the cluster | |||||||||
|
|
||||||||||
| scale-nodes: ## Scales the nodes in the cluster | ||||||||||
| $(AZCLI) aks nodepool scale --resource-group $(GROUP) --cluster-name $(CLUSTER) --name $(NODEPOOL) --node-count $(NODE_COUNT) | ||||||||||
|
|
||||||||||
| ##@ BYO CNI Automation | ||||||||||
|
|
||||||||||
| byocni-cluster-up: ## Create complete BYO CNI cluster with CNS and CNI (default: Cilium) | ||||||||||
| @echo "Creating BYO CNI cluster with CNS and $(CNI_TYPE)..." | ||||||||||
| @echo "Variables: CLUSTER=$(CLUSTER), CNS_VERSION=$(CNS_VERSION), CNI_TYPE=$(CNI_TYPE)" | ||||||||||
| @$(MAKE) validate-cni-type | ||||||||||
| ifeq ($(CNI_TYPE),azurecni) | ||||||||||
| @$(MAKE) overlay-up | ||||||||||
| else | ||||||||||
| @$(MAKE) overlay-byocni-nokubeproxy-up | ||||||||||
| endif | ||||||||||
| @echo "Cluster created successfully. Deploying CNS..." | ||||||||||
| @$(MAKE) deploy-cns | ||||||||||
| @echo "CNS deployed successfully. Deploying $(CNI_TYPE)..." | ||||||||||
| ifeq ($(CNI_TYPE),cilium) | ||||||||||
| @$(MAKE) deploy-cilium | ||||||||||
| else ifeq ($(CNI_TYPE),azurecni) | ||||||||||
| @echo "Azure CNI is already configured in the cluster. No additional CNI deployment needed." | ||||||||||
| else | ||||||||||
| @echo "Warning: CNI_TYPE=$(CNI_TYPE) not supported yet." | ||||||||||
| @echo "Available CNI types: cilium, azurecni" | ||||||||||
| @exit 1 | ||||||||||
| endif | ||||||||||
| @echo "BYO CNI cluster setup completed successfully!" | ||||||||||
|
|
||||||||||
| validate-cni-type: ## Validate the CNI type | ||||||||||
| ifeq ($(CNI_TYPE),cilium) | ||||||||||
| @echo "✓ CNI type validation passed: $(CNI_TYPE)" | ||||||||||
| else ifeq ($(CNI_TYPE),azurecni) | ||||||||||
| @echo "✓ CNI type validation passed: $(CNI_TYPE)" | ||||||||||
| else | ||||||||||
| @echo "✗ Error: CNI_TYPE=$(CNI_TYPE) is not supported." | ||||||||||
| @echo "Available CNI types: cilium, azurecni" | ||||||||||
| @echo "Example: make byocni-cluster-up CNI_TYPE=cilium" | ||||||||||
| @echo "Example: make byocni-cluster-up CNI_TYPE=azurecni" | ||||||||||
| @exit 1 | ||||||||||
| endif | ||||||||||
|
|
||||||||||
| deploy-cns: ## Deploy CNS to the cluster | ||||||||||
| @echo "Deploying CNS with version $(CNS_VERSION)..." | ||||||||||
| cd $(REPO_ROOT) && sudo -E env "PATH=$$PATH" make test-load \ | ||||||||||
| CNS_ONLY=true \ | ||||||||||
| CNS_VERSION=$(CNS_VERSION) \ | ||||||||||
| AZURE_IPAM_VERSION=$(AZURE_IPAM_VERSION) \ | ||||||||||
| INSTALL_CNS=true \ | ||||||||||
| INSTALL_OVERLAY=true \ | ||||||||||
| CNS_IMAGE_REPO=$(CNS_IMAGE_REPO) | ||||||||||
|
|
||||||||||
| deploy-cilium: ## Deploy Cilium to the cluster | ||||||||||
| @echo "Deploying Cilium $(CILIUM_VERSION_TAG) from directory v$(CILIUM_DIR)..." | ||||||||||
| @if [ ! -d "$(REPO_ROOT)/test/integration/manifests/cilium/v$(CILIUM_DIR)" ]; then \ | ||||||||||
| echo "Error: Cilium directory v$(CILIUM_DIR) not found."; \ | ||||||||||
| echo "Available versions: $$(ls $(REPO_ROOT)/test/integration/manifests/cilium/ | grep '^v' | tr '\n' ' ')"; \ | ||||||||||
| exit 1; \ | ||||||||||
| fi | ||||||||||
| ifeq ($(DUALSTACK),true) | ||||||||||
| @echo "Deploying Cilium with dual-stack configuration..." | ||||||||||
| kubectl apply -f $(REPO_ROOT)/test/integration/manifests/cilium/v$(CILIUM_DIR)/cilium-config/cilium-config-dualstack.yaml | ||||||||||
| else | ||||||||||
| kubectl apply -f $(REPO_ROOT)/test/integration/manifests/cilium/v$(CILIUM_DIR)/cilium-config/cilium-config.yaml | ||||||||||
| endif | ||||||||||
| kubectl apply -f $(REPO_ROOT)/test/integration/manifests/cilium/v$(CILIUM_DIR)/cilium-operator/files | ||||||||||
| kubectl apply -f $(REPO_ROOT)/test/integration/manifests/cilium/v$(CILIUM_DIR)/cilium-agent/files | ||||||||||
|
Comment on lines
+500
to
+501
|
||||||||||
| kubectl apply -f $(REPO_ROOT)/test/integration/manifests/cilium/v$(CILIUM_DIR)/cilium-operator/files | |
| kubectl apply -f $(REPO_ROOT)/test/integration/manifests/cilium/v$(CILIUM_DIR)/cilium-agent/files | |
| kubectl apply -f $(REPO_ROOT)/test/integration/manifests/cilium/v$(CILIUM_DIR)/cilium-operator/files --recursive | |
| kubectl apply -f $(REPO_ROOT)/test/integration/manifests/cilium/v$(CILIUM_DIR)/cilium-agent/files --recursive |
Copilot
AI
Jul 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The complex multi-line export and envsubst command should be broken into separate variables or a shell script for better readability and maintainability. Consider defining the environment variables at the target level or using a helper script.
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -45,4 +45,100 @@ AKS Clusters | |||||||||||||
| windows-nodepool-up Add windows node pool | ||||||||||||||
| down Delete the cluster | ||||||||||||||
| vmss-restart Restart the nodes of the cluster | ||||||||||||||
|
|
||||||||||||||
| BYO CNI Automation | ||||||||||||||
| byocni-cluster-up Create complete BYO CNI cluster with CNS and CNI (default: Cilium) | ||||||||||||||
| deploy-cns Deploy CNS to the cluster | ||||||||||||||
| deploy-cilium Deploy Cilium to the cluster | ||||||||||||||
| byocni-cluster-vars Show variables for BYO CNI cluster setup | ||||||||||||||
| validate-cni-type Validate the CNI type | ||||||||||||||
| ``` | ||||||||||||||
|
|
||||||||||||||
| ## BYO CNI Cluster Automation | ||||||||||||||
|
|
||||||||||||||
| The Makefile now includes automated setup for complete BYO CNI clusters with CNS and CNI deployment. | ||||||||||||||
|
|
||||||||||||||
| ### Quick Start | ||||||||||||||
|
|
||||||||||||||
| Create a BYO CNI cluster with Cilium (default): | ||||||||||||||
| ```bash | ||||||||||||||
| make byocni-cluster-up CLUSTER=my-cluster SUB=<subscription-id> | ||||||||||||||
| ``` | ||||||||||||||
|
|
||||||||||||||
| Create a BYO CNI cluster with Azure CNI: | ||||||||||||||
| ```bash | ||||||||||||||
| make byocni-cluster-up CLUSTER=my-cluster SUB=<subscription-id> CNI_TYPE=azurecni | ||||||||||||||
|
Comment on lines
+68
to
+70
|
||||||||||||||
| Create a BYO CNI cluster with Azure CNI: | |
| ```bash | |
| make byocni-cluster-up CLUSTER=my-cluster SUB=<subscription-id> CNI_TYPE=azurecni | |
| Create a cluster with Azure CNI pre-configured: | |
| ```bash | |
| make overlay-up CLUSTER=my-cluster SUB=<subscription-id> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add node vm sku as parameter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added VM_SIZE as a configurable parameter for BYO CNI cluster automation. It's now documented in the configuration section and included in the customization examples. Commit 7269168
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
based on image repo, can cns/cilium image path be constructed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enhanced documentation to clarify the relationship between image repositories and image paths. Added examples showing different registry configurations (MCR vs ACR vs custom) and improved the variable display to show how CNS_IMAGE_REPO affects CNS image paths while CILIUM_IMAGE_REGISTRY controls Cilium images. Commit 7269168
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The path 'cilium-operator/files' appears to be a directory being applied as a file. This should likely be 'cilium-operator/files/' with trailing slash or use '-f' with '--recursive' flag, or specify individual YAML files.