forked from mchmarny/dapr-demos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
67 lines (57 loc) · 1.93 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
CLUSTER_NAME ?=mfusselldemo10
CLUSTER_VERSION ?=1.18.10
NODE_COUNT ?=3
NODE_TYPE ?=Standard_D4_v2
.PHONY: all
all:
@echo === ACTIVE CONFIGURATION ===
@echo "CLUSTER_NAME: ${CLUSTER_NAME}"
@echo "CLUSTER_VERSION: ${CLUSTER_VERSION}"
@echo "NODE_COUNT: ${NODE_COUNT}"
@echo "NODE_TYPE: ${NODE_TYPE}"
@echo
@echo "Export these as environment variables to change their values"
@echo
.PHONY: cluster-list
cluster-list: ## List AKS clusters
az aks list -o table
.PHONY: version-list
version-list: ## List Kubernetes versions supported in AKS
az aks get-versions -o json --query 'orchestrators[].orchestratorVersion'
.PHONY: cluster
cluster: ## Create AKS cluster
az aks create \
--name $(CLUSTER_NAME) \
--node-count $(NODE_COUNT) \
--node-vm-size $(NODE_TYPE) \
--kubernetes-version $(CLUSTER_VERSION) \
-g mfussell
az aks get-credentials --name $(CLUSTER_NAME)
.PHONY: cluster-down
cluster-down: cluster-list ## Delete previously created AKS cluster (make clusterdown CLUSTER_NAME=demo)
az aks delete --name $(CLUSTER_NAME)
.PHONY: ip
ip: ## Create Static IP for the existing AKS cluster
$(eval CLUSTERRC=$(shell az aks show -n $(CLUSTER_NAME) -o tsv --query nodeResourceGroup))
az network public-ip create \
-g $(CLUSTERRC) \
-n "${CLUSTER_NAME}IP" \
--sku STANDARD
az network public-ip show \
-g $(CLUSTERRC) \
-n "${CLUSTER_NAME}IP" \
-o tsv --query ipAddress
.PHONY: node-pool
node-pool: ## Add new AKS node pool
$(eval NODE_SUFIX=$(shell date +"%d%m"))
az aks nodepool add \
--cluster-name $(CLUSTER_NAME) \
--name nodepool$(NODE_SUFIX) \
--node-count $(NODE_COUNT) \
--node-vm-size $(NODE_TYPE) \
--mode System \
--no-wait
.PHONY: help
help: ## Display available commands
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk \
'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'