-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
83 lines (59 loc) · 2.34 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
# Access metrics directly (4000) or through the sidecar (3001)
# go install github.com/divan/expvarmon@latest
# expvarmon -ports=":4000" -vars="build,requests,goroutines,errors,panics,mem:memstats.Alloc"
# curl -il http://localhost:3000/test
# ==============================================================================
# Building containers
# $(shell git rev-parse --short HEAD)
VERSION := 1.0
all: sales
sales:
docker build \
-f zarf/docker/dockerfile.sales-api \
-t sales-api-amd64:$(VERSION) \
--build-arg BUILD_REF=$(VERSION) \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
.
# ==============================================================================
# Running from within k8s/kind
KIND_CLUSTER := ardan-starter-cluster
# Upgrade to latest Kind: brew upgrade kind
# For full Kind v0.14 release notes: https://github.com/kubernetes-sigs/kind/releases/tag/v0.14.0
# The image used below was copied by the above link and supports both amd64 and arm64.
kind-up:
kind create cluster \
--image kindest/node:v1.24.0@sha256:0866296e693efe1fed79d5e6c7af8df71fc73ae45e3679af05342239cdc5bc8e \
--name $(KIND_CLUSTER) \
--config zarf/k8s/kind/kind-config.yaml
kubectl config set-context --current --namespace=sales-system
kind-down:
kind delete cluster --name $(KIND_CLUSTER)
kind-load:
kind load docker-image sales-api-amd64:$(VERSION) --name $(KIND_CLUSTER)
kind-apply:
kustomize build zarf/k8s/kind/sales-pod | kubectl apply -f -
kind-status:
kubectl get nodes -o wide
kubectl get svc -o wide
kubectl get pods -o wide --watch --all-namespaces
kind-status-sales:
kubectl get pods -o wide --watch --namespace=sales-system
kind-logs-sales:
kubectl logs -l app=sales --all-containers=true -f --tail=100 | go run app/tooling/logfmt/main.go -service=SALES-API
kind-restart:
kubectl rollout restart deployment sales-pod
kind-update: all kind-load kind-restart
kind-update-apply: all kind-load kind-apply
kind-describe-deployment:
kubectl describe deployment sales-pod
# ==============================================================================
# Local support
run:
go run app/services/sales-api/main.go | go run app/tooling/logfmt/main.go
run-help:
go run app/services/sales-api/main.go --help
# ==============================================================================
# Modules support
tidy:
go mod tidy
go mod vendor