Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 28 additions & 11 deletions hack/swift/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ KUBECFG = $(HOME)/.kube
SSH = $(HOME)/.ssh
AZCFG = $(HOME)/.azure
AZIMG = mcr.microsoft.com/azure-cli
AZCLI ?= docker run -v $(AZCFG):/root/.azure -v $(KUBECFG):/root/.kube -v $(SSH):/root/.ssh $(AZIMG) az
AZCLI ?= docker run --rm -v $(AZCFG):/root/.azure -v $(KUBECFG):/root/.kube -v $(SSH):/root/.ssh $(AZIMG) az

# overrideable variables
USER ?= $(whoami)
Expand All @@ -21,6 +21,7 @@ VNET ?= $(CLUSTER)
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)


##@ Utilities

azlogin:
Expand All @@ -29,6 +30,7 @@ azlogin:

azcfg:
@$(AZCLI) extension add --name aks-preview --yes
@$(AZCLI) extension update --name aks-preview

set-kubeconf: ## Adds the kubeconf for $CLUSTER
$(AZCLI) aks get-credentials -n $(CLUSTER) -g $(GROUP)
Expand All @@ -44,6 +46,7 @@ shell: ## print $AZCLI so it can be used outside of make


##@ SWIFT Infra

vars: ## Show the env vars configured for the swift command
@echo SUB=$(SUB)
@echo GROUP=$(GROUP)
Expand All @@ -66,43 +69,57 @@ overlay-net-up:
$(AZCLI) network vnet create -g $(GROUP) -l $(REGION) --name $(VNET) --address-prefixes 10.0.0.0/8 -o none
$(AZCLI) network vnet subnet create -g $(GROUP) --vnet-name $(VNET) --name nodenet --address-prefix 10.10.0.0/16 -o none


##@ AKS Clusters

swift-up: rg-up net-up ## Brings up a swift cluster $name in $SUB/$REGION
byocni-up: swift-byocni-up ## Alias to swift-byocni-up
cilium-up: swift-cilium-up ## Alias to swift-cilium-up
up: swift-up ## Alias to swift-up

overlay-up: rg-up overlay-net-up ## Brings up an Overlay AzCNI cluster
$(AZCLI) aks create -n $(CLUSTER) -g $(GROUP) -l $(REGION) \
--max-pods 250 \
--node-count 3 \
--network-plugin azure \
--network-plugin-mode overlay \
--pod-cidr 192.168.0.0/16 \
--vnet-subnet-id /subscriptions/$(SUB)/resourceGroups/$(GROUP)/providers/Microsoft.Network/virtualNetworks/$(VNET)/subnets/nodenet \
--generate-ssh-keys \
--yes
@$(MAKE) set-kubeconf

swift-byocni-up: rg-up net-up ## Bring up a SWIFT BYO CNI cluster
$(AZCLI) aks create -n $(CLUSTER) -g $(GROUP) -l $(REGION) \
--node-count 3 \
--network-plugin none \
--vnet-subnet-id /subscriptions/$(SUB)/resourceGroups/$(GROUP)/providers/Microsoft.Network/virtualNetworks/$(VNET)/subnets/nodenet \
--pod-subnet-id /subscriptions/$(SUB)/resourceGroups/$(GROUP)/providers/Microsoft.Network/virtualNetworks/$(VNET)/subnets/podnet \
--generate-ssh-keys \
--yes
@$(MAKE) set-kubeconf

overlay-up: rg-up overlay-net-up ## Brings up an overlay cluster $name in $SUB/$REGION
swift-cilium-up: rg-up net-up ## Bring up a SWIFT Cilium cluster
$(AZCLI) aks create -n $(CLUSTER) -g $(GROUP) -l $(REGION) \
--max-pods 250 \
--node-count 3 \
--network-plugin azure \
--network-plugin-mode overlay \
--pod-cidr 192.168.0.0/16 \
--enable-cilium-dataplane \
--aks-custom-headers AKSHTTPCustomFeatures=Microsoft.ContainerService/CiliumDataplanePreview \
--vnet-subnet-id /subscriptions/$(SUB)/resourceGroups/$(GROUP)/providers/Microsoft.Network/virtualNetworks/$(VNET)/subnets/nodenet \
--pod-subnet-id /subscriptions/$(SUB)/resourceGroups/$(GROUP)/providers/Microsoft.Network/virtualNetworks/$(VNET)/subnets/podnet \
--generate-ssh-keys \
--yes
@$(MAKE) set-kubeconf

byocni-up: rg-up net-up ## Brings up a swift cluster $name in $SUB/$REGION
swift-up: rg-up net-up ## Bring up a SWIFT AzCNI cluster
$(AZCLI) aks create -n $(CLUSTER) -g $(GROUP) -l $(REGION) \
--max-pods 250 \
--node-count 3 \
--network-plugin none \
--network-plugin azure \
--vnet-subnet-id /subscriptions/$(SUB)/resourceGroups/$(GROUP)/providers/Microsoft.Network/virtualNetworks/$(VNET)/subnets/nodenet \
--pod-subnet-id /subscriptions/$(SUB)/resourceGroups/$(GROUP)/providers/Microsoft.Network/virtualNetworks/$(VNET)/subnets/podnet \
--generate-ssh-keys \
--yes
@$(MAKE) set-kubeconf

down: ## Deletes the swift resources $SUB/$REGION
down: ## Delete the cluster
$(AZCLI) aks delete -g $(GROUP) -n $(CLUSTER) --yes
@$(MAKE) unset-kubeconf
@$(MAKE) rg-down
23 changes: 16 additions & 7 deletions hack/swift/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Use this Makefile to swiftly provision/deprovision [enhanced pod subnet (aka swift)](https://docs.microsoft.com/en-us/azure/aks/configure-azure-cni#dynamic-allocation-of-ips-and-enhanced-subnet-support-preview) clusters in Azure.
Use this Makefile to swiftly provision/deprovision AKS clusters of different Networking flavors in Azure.

---
```bash
Expand All @@ -14,10 +14,19 @@ Utilities
unset-kubeconf Deletes the kubeconf for $CLUSTER
shell print $AZCLI so it can be used outside of make

SWIFT
swift-vars Show the env vars configured for the swift command
swift-net-up Create required swift vnet/subnets
swift-rg-down Delete the $GROUP in $SUB/$REGION
swift-up Brings up a swift cluster $name in $SUB/$REGION
swift-down Deletes the swift resources $SUB/$REGION
SWIFT Infra
vars Show the env vars configured for the swift command
rg-up Create resource group $GROUP in $SUB/$REGION
rg-down Delete the $GROUP in $SUB/$REGION
net-up Create required swift vnet/subnets

AKS Clusters
byocni-up Alias to swift-byocni-up
cilium-up Alias to swift-cilium-up
up Alias to swift-up
overlay-up Brings up an Overlay AzCNI cluster
swift-byocni-up Bring up a SWIFT BYO CNI cluster
swift-cilium-up Bring up a SWIFT Cilium cluster
swift-up Bring up a SWIFT AzCNI cluster
down Delete the cluster
```