-
Notifications
You must be signed in to change notification settings - Fork 185
/
Makefile
143 lines (114 loc) 路 4.91 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
ORG := keyval
.PHONY: build-odiglet
build-odiglet:
docker build -t $(ORG)/odigos-odiglet:$(TAG) . -f odiglet/Dockerfile
.PHONY: build-autoscaler
build-autoscaler:
docker build -t $(ORG)/odigos-autoscaler:$(TAG) . --build-arg SERVICE_NAME=autoscaler
.PHONY: build-instrumentor
build-instrumentor:
docker build -t $(ORG)/odigos-instrumentor:$(TAG) . --build-arg SERVICE_NAME=instrumentor
.PHONY: build-scheduler
build-scheduler:
docker build -t $(ORG)/odigos-scheduler:$(TAG) . --build-arg SERVICE_NAME=scheduler
.PHONY: build-collector
build-collector:
docker build -t $(ORG)/odigos-collector:$(TAG) collector -f collector/Dockerfile
.PHONY: build-images
build-images:
make build-autoscaler TAG=$(TAG)
make build-scheduler TAG=$(TAG)
make build-odiglet TAG=$(TAG)
make build-instrumentor TAG=$(TAG)
make build-collector TAG=$(TAG)
.PHONY: push-odiglet
push-odiglet:
docker buildx build --platform linux/amd64,linux/arm64/v8 --push -t $(ORG)/odigos-odiglet:$(TAG) . -f odiglet/Dockerfile
.PHONY: push-autoscaler
push-autoscaler:
docker buildx build --platform linux/amd64,linux/arm64/v8 --push -t $(ORG)/odigos-autoscaler:$(TAG) . --build-arg SERVICE_NAME=autoscaler
.PHONY: push-instrumentor
push-instrumentor:
docker buildx build --platform linux/amd64,linux/arm64/v8 --push -t $(ORG)/odigos-instrumentor:$(TAG) . --build-arg SERVICE_NAME=instrumentor
.PHONY: push-scheduler
push-scheduler:
docker buildx build --platform linux/amd64,linux/arm64/v8 --push -t $(ORG)/odigos-scheduler:$(TAG) . --build-arg SERVICE_NAME=scheduler
.PHONY: push-collector
push-collector:
docker buildx build --platform linux/amd64,linux/arm64/v8 --push -t $(ORG)/odigos-collector:$(TAG) collector -f collector/Dockerfile
.PHONY: push-images
push-images:
make push-autoscaler TAG=$(TAG)
make push-scheduler TAG=$(TAG)
make push-odiglet TAG=$(TAG)
make push-instrumentor TAG=$(TAG)
make push-collector TAG=$(TAG)
.PHONY: load-to-kind-odiglet
load-to-kind-odiglet:
kind load docker-image $(ORG)/odigos-odiglet:$(TAG)
.PHONY: load-to-kind-autoscaler
load-to-kind-autoscaler:
kind load docker-image $(ORG)/odigos-autoscaler:$(TAG)
.PHONY: load-to-kind-collector
load-to-kind-collector:
kind load docker-image $(ORG)/odigos-collector:$(TAG)
.PHONY: load-to-kind-instrumentor
load-to-kind-instrumentor:
kind load docker-image $(ORG)/odigos-instrumentor:$(TAG)
.PHONY: load-to-kind
load-to-kind:
make load-to-kind-autoscaler TAG=$(TAG)
kind load docker-image $(ORG)/odigos-scheduler:$(TAG)
make load-to-kind-odiglet TAG=$(TAG)
kind load docker-image $(ORG)/odigos-instrumentor:$(TAG)
make load-to-kind-collector TAG=$(TAG)
.PHONY: restart-odiglet
restart-odiglet:
kubectl rollout restart daemonset odiglet -n odigos-system
.PHONY: restart-autoscaler
restart-autoscaler:
kubectl rollout restart deployment odigos-autoscaler -n odigos-system
.PHONY: restart-instrumentor
restart-instrumentor:
kubectl rollout restart deployment odigos-instrumentor -n odigos-system
.PHONY: restart-collector
restart-collector:
kubectl rollout restart deployment odigos-gateway -n odigos-system
# DaemonSets don't directly support the rollout restart command in the same way Deployments do. However, you can achieve the same result by updating an environment variable or any other field in the DaemonSet's pod template, triggering a rolling update of the pods managed by the DaemonSet
kubectl -n odigos-system patch daemonset odigos-data-collection -p "{\"spec\":{\"template\":{\"metadata\":{\"annotations\":{\"kubectl.kubernetes.io/restartedAt\":\"$(date +%Y-%m-%dT%H:%M:%S%z)\"}}}}}"
.PHONY: deploy-odiglet
deploy-odiglet:
make build-odiglet TAG=$(TAG) && make load-to-kind-odiglet TAG=$(TAG) && make restart-odiglet
.PHONY: deploy-autoscaler
deploy-autoscaler:
make build-autoscaler TAG=$(TAG) && make load-to-kind-autoscaler TAG=$(TAG) && make restart-autoscaler
.PHONY: deploy-collector
deploy-collector:
make build-collector TAG=$(TAG) && make load-to-kind-collector TAG=$(TAG) && make restart-collector
.PHONY: deploy-instrumentor
deploy-instrumentor:
make build-instrumentor TAG=$(TAG) && make load-to-kind-instrumentor TAG=$(TAG) && make restart-instrumentor
.PHONY: debug-odiglet
debug-odiglet:
docker build -t $(ORG)/odigos-odiglet:$(TAG) . -f odiglet/debug.Dockerfile
kind load docker-image $(ORG)/odigos-odiglet:$(TAG)
kubectl delete pod -n odigos-system -l app=odiglet
kubectl wait --for=condition=ready pod -n odigos-system -l app=odiglet
kubectl port-forward -n odigos-system daemonset/odiglet 2345:2345
,PHONY: e2e-test
e2e-test:
./e2e-test.sh
ALL_GO_MOD_DIRS := $(shell go list -m -f '{{.Dir}}' | sort)
.PHONY: go-mod-tidy
go-mod-tidy: $(ALL_GO_MOD_DIRS:%=go-mod-tidy/%)
go-mod-tidy/%: DIR=$*
go-mod-tidy/%:
@cd $(DIR) && go mod tidy -compat=1.21
.PHONY: check-clean-work-tree
check-clean-work-tree:
if [ -n "$$(git status --porcelain)" ]; then \
git status; \
git --no-pager diff; \
echo 'Working tree is not clean, did you forget to run "make go-mod-tidy"?'; \
exit 1; \
fi