-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
71 lines (53 loc) · 2.23 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
SHELL = /bin/bash
build:
go build -ldflags "-X main.build=local" ./api/services
# With `main.build=local`, we define the value of build var inside main.go.
run:
go run api/services/main.go
# ==============================================================================
# Building containers
VERSION := 0.2
BASE_IMAGE_NAME := giou/energy-service
SERVICE_NAME := energy-api
SERVICE_IMAGE := $(BASE_IMAGE_NAME)/$(SERVICE_NAME):$(VERSION)
KIND := kindest/node:v1.27.3
KIND_CLUSTER := cluster-europe
NAMESPACE := ns-energy-europe
APP := energy-pod
all: service
service:
echo $(SERVICE_IMAGE)
docker build \
-f infra/docker/dockerfile.service \
-t $(SERVICE_IMAGE) \
--build-arg BUILD_REF=$(VERSION) \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
.
# ==============================================================================
# K8s
dev-up:
kind create cluster --image $(KIND) --name $(KIND_CLUSTER) --config infra/k8s/kind-config.yaml
# todo here we will need to wait for the cluster to come up and then we can load other services that depend on that one,f.e metrics
dev-down:
kind delete cluster --name $(KIND_CLUSTER)
dev-status:
kubectl get nodes -o wide
kubectl get svc -o wide
kubectl get pods -o wide --watch --all-namespaces
dev-load:
#cd zarf/k8s/dev/sales; kustomize edit set image service-image=$(SERVICE_IMAGE)
kind load docker-image $(SERVICE_IMAGE) --name $(KIND_CLUSTER)
dev-apply:
kustomize build infra/k8s/ | kubectl apply -f -
#kubectl apply -f ./infra/k8s/base.yaml
dev-logs:
kubectl logs --namespace=$(NAMESPACE) -l app=$(APP) --all-containers=true -f --tail=100 # --max-log-requests=6, 5 is the default value, Specify maximum number of concurrent logs to follow when using by a selector.
# currently the above is not working cause of namespace resources: "No resources found in ns-energy-europe namespace."
# logs based on the selector of base.yaml: `k logs -l app=energy --all-containers=true -f --tail=100`
dev-restart:
kubectl rollout restart deployment $(APP) --namespace=$(NAMESPACE)
dev-update: all dev-load dev-apply run
curl-test:
curl -il -X GET http://localhost:3011/debug/pprof
curl -il -X GET http://localhost:3000
curl -il -X GET http://localhost:3000/test