-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
61 lines (47 loc) · 1.72 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
ROOT_DIR = .
DASHBOARDS_DIR = ${ROOT_DIR}/tools/dashboards
DASHBOARDS_COMPRESSED_DIR = ${DASHBOARDS_DIR}_compressed
default: help
.PHONY: run-dry
run-dry: init plan ## Run terraform without deployment
.PHONY: run
run: init plan apply ## Run terraform with deployment
.PHONY: init
init: ## Terraform init
terraform init
.PHONY: plan
plan: ## Terraform plan
terraform plan
.PHONY: apply
apply: ## Terraform apply
terraform apply
.PHONY: destroy
destroy: ## Terraform destroy
terraform destroy
.PHONY: test
test: ## Terraform test
terraform test
.PHONY: fix
fix: ## Fix style
terraform fmt -check -diff; \
terraform fmt
.PHONY: update-kubeconfig
update-kubeconfig: ## Create or update kubeconfig e.g. make update-kubeconfig profile=playground cluster=my-cluster
aws --profile=$(profile) eks update-kubeconfig --name $(cluster)
.PHONY: apply-podinfo
apply-podinfo: ## Apply podinfo to EKS
kubectl apply -f podinfo/deployment.yaml -f podinfo/gateway.yaml -f podinfo/hpa.yaml -f podinfo/canary.yaml -f podinfo/metric.yaml
.PHONY: generate-cerfificate
generate-cerfificate: ## Generate certificate e.g. make generate-cerfificate domain=yourdomain.com
mkdir -p certs; \
openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes \
-keyout certs/key.pem -out certs/cert.pem -subj "/CN=$(domain)"
.PHONY: compress-grafana-dasboards
compress-grafana-dasboards: ## Compress grafana dasboards
@for file in $(DASHBOARDS_DIR)/* ; do \
filename=`echo "$$file" | sed 's|^.*/||'`; \
jq -r tostring $$file > ${DASHBOARDS_COMPRESSED_DIR}/$$filename; \
done
.PHONY: help
help: ## Display this help message
@cat $(MAKEFILE_LIST) | grep -e "^[a-zA-Z_\-]*: *.*## *" | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'