Skip to content

Commit 5e93d4a

Browse files
authored
Parameterize and tidy up the hackfile, use region variable in pipelines (#1688)
* parameterize and tidy up the hackfile Signed-off-by: Evan Baker <[email protected]> * use region variable in pipelines when building clusters Signed-off-by: Evan Baker <[email protected]> Signed-off-by: Evan Baker <[email protected]>
1 parent a802493 commit 5e93d4a

File tree

3 files changed

+34
-32
lines changed

3 files changed

+34
-32
lines changed

.pipelines/singletenancy/aks-swift/e2e-step-template.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ steps:
3232
inlineScript: |
3333
mkdir -p ~/.kube/
3434
echo "Create AKS cluster"
35-
make -C ./hack/swift azcfg AZCLI=az
36-
make -C ./hack/swift byocni-up SUB=$(SUB_AZURE_NETWORK_AGENT_TEST) AZCLI=az CLUSTER=${{ parameters.clusterName }}-${{ parameters.osSku }}-$(make revision) OSSKU=${{ parameters.osSku }}
35+
make -C ./hack/swift azcfg AZCLI=az REGION=$(REGION_AKS_CLUSTER_TEST)
36+
make -C ./hack/swift byocni-up AZCLI=az REGION=$(REGION_AKS_CLUSTER_TEST) SUB=$(SUB_AZURE_NETWORK_AGENT_TEST) CLUSTER=${{ parameters.clusterName }}-${{ parameters.osSku }}-$(make revision) OSSKU=${{ parameters.osSku }}
3737
echo "Cluster successfully created"
3838
displayName: Create test cluster
3939
condition: succeeded()
@@ -117,8 +117,8 @@ steps:
117117
addSpnToEnvironment: true
118118
inlineScript: |
119119
echo "Deleting cluster"
120-
make -C ./hack/swift azcfg AZCLI=az
121-
make -C ./hack/swift down SUB=$(SUB_AZURE_NETWORK_AGENT_TEST) AZCLI=az CLUSTER=${{ parameters.clusterName }}-${{ parameters.osSku }}-$(make revision)
120+
make -C ./hack/swift azcfg AZCLI=az REGION=$(REGION_AKS_CLUSTER_TEST)
121+
make -C ./hack/swift down AZCLI=az REGION=$(REGION_AKS_CLUSTER_TEST) SUB=$(SUB_AZURE_NETWORK_AGENT_TEST) CLUSTER=${{ parameters.clusterName }}-${{ parameters.osSku }}-$(make revision)
122122
echo "Cluster and resources down"
123123
name: "Cleanupcluster"
124124
displayName: "Cleanup cluster"

.pipelines/singletenancy/cilium/cilium-e2e-step-template.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ steps:
3131
inlineScript: |
3232
mkdir -p ~/.kube/
3333
echo "Create AKS cluster"
34-
make -C ./hack/swift azcfg AZCLI=az
35-
make -C ./hack/swift byocni-up SUB=$(SUB_AZURE_NETWORK_AGENT_TEST) AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(make revision)
34+
make -C ./hack/swift azcfg AZCLI=az REGION=$(REGION_AKS_CLUSTER_TEST)
35+
make -C ./hack/swift byocni-up AZCLI=az REGION=$(REGION_AKS_CLUSTER_TEST) SUB=$(SUB_AZURE_NETWORK_AGENT_TEST) CLUSTER=${{ parameters.clusterName }}-$(make revision)
3636
echo "Cluster successfully created"
3737
displayName: Create test cluster
3838
condition: succeeded()
@@ -142,8 +142,8 @@ steps:
142142
addSpnToEnvironment: true
143143
inlineScript: |
144144
echo "Deleting cluster"
145-
make -C ./hack/swift azcfg AZCLI=az
146-
make -C ./hack/swift down SUB=$(SUB_AZURE_NETWORK_AGENT_TEST) AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(make revision)
145+
make -C ./hack/swift azcfg AZCLI=az REGION=$(REGION_AKS_CLUSTER_TEST)
146+
make -C ./hack/swift down AZCLI=az REGION=$(REGION_AKS_CLUSTER_TEST) SUB=$(SUB_AZURE_NETWORK_AGENT_TEST) CLUSTER=${{ parameters.clusterName }}-$(make revision)
147147
echo "Cluster and resources down"
148148
name: "Cleanupcluster"
149149
displayName: "Cleanup cluster"

hack/swift/Makefile

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ AZIMG = mcr.microsoft.com/azure-cli
88
AZCLI ?= docker run --rm -v $(AZCFG):/root/.azure -v $(KUBECFG):/root/.kube -v $(SSH):/root/.ssh $(AZIMG) az
99

1010
# overrideable variables
11-
USER ?= $(whoami)
12-
OSSKU ?= Ubuntu
13-
CLUSTER ?= $(USER)-$(REGION)
14-
GROUP ?= $(CLUSTER)
15-
REGION ?= westus2
1611
SUB ?= $(AZURE_SUBSCRIPTION)
12+
CLUSTER ?= $(whoami)-$(REGION)
13+
GROUP ?= $(CLUSTER)
1714
VNET ?= $(CLUSTER)
18-
15+
# overrideable defaults
16+
REGION ?= westus2
17+
OS_SKU ?= Ubuntu
18+
VM_SIZE ?= Standard_B2s
1919

2020
##@ Help
2121

@@ -45,28 +45,30 @@ unset-kubeconf: ## Deletes the kubeconf for $CLUSTER
4545
shell: ## print $AZCLI so it can be used outside of make
4646
@echo $(AZCLI)
4747

48-
49-
##@ SWIFT Infra
50-
51-
vars: ## Show the env vars configured for the swift command
52-
@echo SUB=$(SUB)
48+
vars: ## Show the input vars configured for the cluster commands
49+
@echo CLUSTER=$(CLUSTER)
5350
@echo GROUP=$(GROUP)
5451
@echo REGION=$(REGION)
52+
@echo SUB=$(SUB)
5553
@echo VNET=$(VNET)
56-
@echo CLUSTER=$(CLUSTER)
54+
@echo OS_SKU=$(OS_SKU)
55+
@echo VM_SIZE=$(VM_SIZE)
56+
57+
58+
##@ SWIFT Infra
5759

58-
rg-up: ## Create resource group $GROUP in $SUB/$REGION
60+
rg-up: ## Create resource group
5961
@$(AZCLI) group create --location $(REGION) --name $(GROUP)
6062

61-
rg-down: ## Delete the $GROUP in $SUB/$REGION
63+
rg-down: ## Delete resource group
6264
$(AZCLI) group delete -g $(GROUP) --yes
6365

64-
net-up: ## Create required swift vnet/subnets
66+
swift-net-up: ## Create vnet, nodenet and podnet subnets
6567
$(AZCLI) network vnet create -g $(GROUP) -l $(REGION) --name $(VNET) --address-prefixes 10.0.0.0/8 -o none
6668
$(AZCLI) network vnet subnet create -g $(GROUP) --vnet-name $(VNET) --name nodenet --address-prefixes 10.240.0.0/16 -o none
6769
$(AZCLI) network vnet subnet create -g $(GROUP) --vnet-name $(VNET) --name podnet --address-prefixes 10.241.0.0/16 -o none
6870

69-
overlay-net-up:
71+
overlay-net-up: ## Create vnet, nodenet subnets
7072
$(AZCLI) network vnet create -g $(GROUP) -l $(REGION) --name $(VNET) --address-prefixes 10.0.0.0/8 -o none
7173
$(AZCLI) network vnet subnet create -g $(GROUP) --vnet-name $(VNET) --name nodenet --address-prefix 10.10.0.0/16 -o none
7274

@@ -80,7 +82,7 @@ up: swift-up ## Alias to swift-up
8082
overlay-up: rg-up overlay-net-up ## Brings up an Overlay AzCNI cluster
8183
$(AZCLI) aks create -n $(CLUSTER) -g $(GROUP) -l $(REGION) \
8284
--node-count 2 \
83-
--node-vm-size Standard_B2s \
85+
--node-vm-size $(VM_SIZE) \
8486
--load-balancer-sku basic \
8587
--network-plugin azure \
8688
--network-plugin-mode overlay \
@@ -90,23 +92,23 @@ overlay-up: rg-up overlay-net-up ## Brings up an Overlay AzCNI cluster
9092
--yes
9193
@$(MAKE) set-kubeconf
9294

93-
swift-byocni-up: rg-up net-up ## Bring up a SWIFT BYO CNI cluster
95+
swift-byocni-up: rg-up swift-net-up ## Bring up a SWIFT BYO CNI cluster
9496
$(AZCLI) aks create -n $(CLUSTER) -g $(GROUP) -l $(REGION) \
9597
--node-count 2 \
96-
--node-vm-size Standard_B2s \
98+
--node-vm-size $(VM_SIZE) \
9799
--load-balancer-sku basic \
98100
--network-plugin none \
99101
--vnet-subnet-id /subscriptions/$(SUB)/resourceGroups/$(GROUP)/providers/Microsoft.Network/virtualNetworks/$(VNET)/subnets/nodenet \
100102
--pod-subnet-id /subscriptions/$(SUB)/resourceGroups/$(GROUP)/providers/Microsoft.Network/virtualNetworks/$(VNET)/subnets/podnet \
101103
--no-ssh-key \
102-
--os-sku $(OSSKU) \
104+
--os-sku $(OS_SKU) \
103105
--yes
104106
@$(MAKE) set-kubeconf
105107

106-
swift-cilium-up: rg-up net-up ## Bring up a SWIFT Cilium cluster
108+
swift-cilium-up: rg-up swift-net-up ## Bring up a SWIFT Cilium cluster
107109
$(AZCLI) aks create -n $(CLUSTER) -g $(GROUP) -l $(REGION) \
108110
--node-count 2 \
109-
--node-vm-size Standard_B2s \
111+
--node-vm-size $(VM_SIZE) \
110112
--load-balancer-sku basic \
111113
--network-plugin azure \
112114
--enable-cilium-dataplane \
@@ -117,10 +119,10 @@ swift-cilium-up: rg-up net-up ## Bring up a SWIFT Cilium cluster
117119
--yes
118120
@$(MAKE) set-kubeconf
119121

120-
swift-up: rg-up net-up ## Bring up a SWIFT AzCNI cluster
122+
swift-up: rg-up swift-net-up ## Bring up a SWIFT AzCNI cluster
121123
$(AZCLI) aks create -n $(CLUSTER) -g $(GROUP) -l $(REGION) \
122124
--node-count 2 \
123-
--node-vm-size Standard_B2s \
125+
--node-vm-size $(VM_SIZE) \
124126
--load-balancer-sku basic \
125127
--network-plugin azure \
126128
--vnet-subnet-id /subscriptions/$(SUB)/resourceGroups/$(GROUP)/providers/Microsoft.Network/virtualNetworks/$(VNET)/subnets/nodenet \

0 commit comments

Comments
 (0)