-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
99 lines (77 loc) · 2.16 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# ==============================================================================
# Development
# ==============================================================================
.PHONY: serve
serve:
gunicorn \
-w 1 \
-k uvicorn.workers.UvicornWorker \
-b :8080 \
-e DEV=true \
-e PORT=6379 \
--reload \
leaderboard.app:app
.PHONY: run
run:
docker-compose -f compose/base.yml up \
-d \
--build
.PHONY: sh
sh:
docker exec -it frontend /bin/sh
.PHONY: dev
dev:
docker-compose -f compose/base.yml -f compose/dev.yml up \
-d \
--build
-docker exec -it frontend /bin/sh
$(MAKE) down
.PHONY: build
build:
docker-compose -f compose/base.yml build
.PHONY: push
push: build
docker push thomasr/hpa-frontend:v1
.PHONY: logs
logs:
docker-compose -f compose/base.yml -f compose/dev.yml logs -f
.PHONY: down
down:
docker-compose -f compose/base.yml down
.PHONY: update-lock
update-lock:
pip-compile --output-file requirements.txt requirements.in
# ==============================================================================
# Demo
# ==============================================================================
.PHONY: clean
clean:
helm delete --purge linkerd
linkerd install --ignore-cluster | kubectl delete -f -
kubectl -n leaderboard delete deploy,statefulset,hpa --all
.PHONY: setup-system
setup-system:
linkerd install | kubectl apply -f -
helm repo update
helm -n linkerd --namespace linkerd \
install stable/prometheus-adapter \
-f hpa/prometheus-adapter.yml
.PHONY: verify-system
verify-system:
kubectl get --raw /apis/custom.metrics.k8s.io/v1beta1 | jq .
kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta1/namespaces/linkerd/pods/*/response_per_second" | \
jq .
kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta1/namespaces/leaderboard/pods/*/response_latency_ms_99th" | \
jq .
.PHONY: demo
demo:
kubectl apply -f k8s
kubectl -n leaderboard get deploy -o yaml | \
linkerd inject - | \
kubectl apply -f -
kubectl apply -f hpa/policy.yml
.PHONY: schema
schema:
curl http://localhost:8001/api/v1/namespaces/leaderboard/services/web:http/proxy/schema | \
linkerd -n leaderboard profile web --open-api - | \
kubectl apply -f -