-
Notifications
You must be signed in to change notification settings - Fork 25
/
Makefile
432 lines (348 loc) · 19 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
# Image URL to use all building/pushing image targets
IMG ?= milvusdb/milvus-operator:dev-latest
TOOL_IMG ?= milvus-config-tool:dev-latest
SIT_IMG ?= milvus-operator:sit
VERSION ?= 1.1.2
TOOL_VERSION ?= 1.0.0
MILVUS_HELM_VERSION ?= milvus-4.2.13
RELEASE_IMG ?= milvusdb/milvus-operator:v$(VERSION)
TOOL_RELEASE_IMG ?= milvusdb/milvus-config-tool:v$(TOOL_VERSION)
KIND_CLUSTER ?= kind
# Produce remove descriptions, it's too long
CRD_OPTIONS ?= "crd:maxDescLen=0"
# cert-manager
CERT_MANAGER_MANIFEST ?= "https://github.com/jetstack/cert-manager/releases/download/v1.5.3/cert-manager.yaml"
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
else
GOBIN=$(shell go env GOBIN)
endif
CERT_DIR = ${TMPDIR}/k8s-webhook-server/serving-certs
CSR_CONF = config/cert/csr.conf
DEV_HOOK_PATCH = config/dev/webhook_patch.yaml
# Setting SHELL to bash allows bash commands to be executed by recipes.
# This is a requirement for 'setup-envtest.sh' in the test target.
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
SHELL = /usr/bin/env bash -o pipefail
.SHELLFLAGS = -ec
all: build
##@ General
# The help target prints out all targets with their descriptions organized
# beneath their categories. The categories are represented by '##@' and the
# target descriptions by '##'. The awk commands is responsible for reading the
# entire set of makefiles included in this invocation, looking for lines of the
# file as xyz: ## something, and then pretty-format the target and help. Then,
# if there's a line with ##@ something, that gets pretty-printed as a category.
# More info on the usage of ANSI control characters for terminal formatting:
# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
# More info on the awk command:
# http://linuxcommand.org/lc3_adv_awk.php
help: ## Display this help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
##@ Development
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
generate: controller-gen go-generate ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
generate-all: generate deploy-manifests
go-generate:
go install go.uber.org/mock/[email protected]
go generate ./...
generate-client-groups:
./hack/update-codegen.sh
fmt: ## Run go fmt against code.
go fmt ./...
vet: ## Run go vet against code.
go vet ./...
ENVTEST_ASSETS_DIR=$(shell pwd)/testbin
test: manifests generate fmt vet test-only ## Run tests.
code-check: go-generate fmt vet
test-only: ## -race requires cgo
CGO_ENABLED=1 go test -race ./... -coverprofile tmp.out; cat tmp.out | sed '/zz_generated.deepcopy.go/d' | sed '/_mock.go/d' > cover.out
##@ Build
VERSION_PATH=github.com/milvus-io/milvus-operator/apis/milvus.io/v1beta1
BUILD_LDFLAGS=-X '$(VERSION_PATH).Version=$(VERSION)' -X '$(VERSION_PATH).MilvusHelmVersion=$(MILVUS_HELM_VERSION)'
build: generate fmt vet ## Build manager binary.
go build -o bin/manager -ldflags="$(BUILD_LDFLAGS)" main.go
build-only:
go build -o bin/manager -ldflags="$(BUILD_LDFLAGS)" main.go
build-config-tool:
mkdir -p out
CGO_ENABLED=0 go build -ldflags="-s -w" -o out/merge ./tool/merge
CGO_ENABLED=0 go build -ldflags="-s -w" -o out/cp ./tool/cp
CGO_ENABLED=0 go build -ldflags="-s -w" -o out/iam-verify ./tool/iam-verify
build-release: build-config-tool
mkdir -p out
CGO_ENABLED=0 go build -ldflags="$(BUILD_LDFLAGS)" -o out/manager main.go
CGO_ENABLED=0 go build -ldflags="-s -w" -o out/checker ./tool/checker
run: manifests generate fmt vet ## Run a controller from your host.
go run ./main.go
docker-build: ## Build docker image with the manager.
docker build -t ${IMG} .
docker-push: ## Push docker image with the manager.
docker push ${IMG}
out/config/assets:
mkdir -p out/config/assets
cp -r config/assets out/config/assets
docker-prepare: build-release out/config/assets
wget https://github.com/zilliztech/milvus-helm/raw/${MILVUS_HELM_VERSION}/charts/milvus/charts/etcd-6.3.3.tgz -O ./etcd.tgz
wget https://github.com/zilliztech/milvus-helm/raw/${MILVUS_HELM_VERSION}/charts/milvus/charts/minio-8.0.17.tgz -O ./minio.tgz
wget https://github.com/zilliztech/milvus-helm/raw/${MILVUS_HELM_VERSION}/charts/milvus/charts/pulsar-2.7.8.tgz -O ./pulsar.tgz
wget https://archive.apache.org/dist/pulsar/helm-chart/3.3.0/pulsar-3.3.0.tgz -O ./pulsar-v3.tgz
wget https://github.com/zilliztech/milvus-helm/raw/${MILVUS_HELM_VERSION}/charts/milvus/charts/kafka-15.5.1.tgz -O ./kafka.tgz
tar -xf ./etcd.tgz -C ./out/config/assets/charts/
tar -xf ./minio.tgz -C ./out/config/assets/charts/
tar -xf ./pulsar-v3.tgz -C ./out/config/assets/charts/
mv ./out/config/assets/charts/pulsar ./out/config/assets/charts/pulsar-v3
tar -xf ./pulsar.tgz -C ./out/config/assets/charts/
tar -xf ./kafka.tgz -C ./out/config/assets/charts/
wget https://github.com/zilliztech/milvus-helm/raw/${MILVUS_HELM_VERSION}/charts/milvus/values.yaml -O ./out/config/assets/charts/values.yaml
cp ./scripts/run.sh ./out/run.sh
cp ./scripts/run-helm.sh ./out/run-helm.sh
cp ./scripts/init.sh ./out/init.sh
docker-tool-prepare: build-config-tool
mkdir -p out/tool
cp ./scripts/run-helm.sh ./out/tool/run-helm.sh
cp ./out/merge ./out/tool/merge
cp ./out/cp ./out/tool/cp
cp ./out/iam-verify ./out/tool/iam-verify
docker-tool-build:
docker build --platform=linux/amd64 -t ${TOOL_RELEASE_IMG}-amd64 -f tool.Dockerfile .
docker build --platform=linux/arm64 -t ${TOOL_RELEASE_IMG}-arm64 -f tool.Dockerfile .
docker-tool-push:
docker manifest create ${TOOL_RELEASE_IMG} ${TOOL_RELEASE_IMG}-amd64 ${TOOL_RELEASE_IMG}-arm64
docker manifest push ${TOOL_RELEASE_IMG}
docker-local-build:
docker build -t ${IMG} -f local.Dockerfile .
docker-local: build-release docker-local-build
##@ Deployment
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | kubectl apply -f -
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | kubectl delete -f -
deploy: ## Deploy controller to the K8s cluster specified in ~/.kube/config.
# cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
# $(KUSTOMIZE) build config/default | kubectl apply -f -
kubectl apply -f deploy/manifests/deployment.yaml
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
# $(KUSTOMIZE) build config/default | kubectl delete -f -
kubectl delete -f deploy/manifests/deployment.yaml
deploy-dev: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
$(KUSTOMIZE) build config/dev | kubectl apply -f -
deploy-cert-manager:
kubectl apply -f ${CERT_MANAGER_MANIFEST}
kubectl wait --timeout=3m --for=condition=Ready pods -l app.kubernetes.io/instance=cert-manager -n cert-manager
undeploy-cert-manager:
kubectl delete -f ${CERT_MANAGER_MANIFEST}
deploy-manifests: manifests kustomize helm-generate
# add namespace
echo "---" > deploy/manifests/deployment.yaml
cat config/manager/namespace.yaml >> deploy/manifests/deployment.yaml
helm template milvus-operator --create-namespace -n milvus-operator ./charts/milvus-operator-$(VERSION).tgz >> deploy/manifests/deployment.yaml
kind-dev: kind
sudo $(KIND) create cluster --config config/kind/kind-dev.yaml --name ${KIND_CLUSTER}
uninstall-kind-dev: kind
sudo $(KIND) delete cluster --name ${KIND_CLUSTER}
# Install local certificate
# Required for webhook server to start
dev-cert:
$(RM) -r $(CERT_DIR)
mkdir -p $(CERT_DIR)
openssl genrsa -out $(CERT_DIR)/ca.key 2048
openssl req -x509 -new -nodes -key $(CERT_DIR)/ca.key -subj "/CN=host.docker.internal" -days 10000 -out $(CERT_DIR)/ca.crt
openssl genrsa -out $(CERT_DIR)/tls.key 2048
openssl req -new -SHA256 -newkey rsa:2048 -nodes -keyout $(CERT_DIR)/tls.key -out $(CERT_DIR)/tls.csr -subj "/C=CN/ST=Shanghai/L=Shanghai/O=/OU=/CN=host.docker.internal"
openssl req -new -key $(CERT_DIR)/tls.key -out $(CERT_DIR)/tls.csr -config $(CSR_CONF)
openssl x509 -req -in $(CERT_DIR)/tls.csr -CA $(CERT_DIR)/ca.crt -CAkey $(CERT_DIR)/ca.key -CAcreateserial -out $(CERT_DIR)/tls.crt -days 10000 -extensions v3_ext -extfile $(CSR_CONF)
CA64=$(shell base64 -i $(CERT_DIR)/ca.crt)
CA=$(CA64:K==)
dev-cert-apply: dev-cert
$(RM) -r config/dev/webhook_patch_ca.yaml
echo '- op: "add"' > config/dev/webhook_patch_ca.yaml
echo ' path: "/webhooks/0/clientConfig/caBundle"' >> config/dev/webhook_patch_ca.yaml
echo " value: $(CA)" >> config/dev/webhook_patch_ca.yaml
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
controller-gen: ## Download controller-gen locally if necessary.
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/[email protected])
KUSTOMIZE = $(shell pwd)/bin/kustomize
kustomize: ## Download kustomize locally if necessary.
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected])
KIND = $(shell pwd)/bin/kind
kind: ## Download kind locally if necessary.
$(call go-get-tool,$(KIND),sigs.k8s.io/[email protected])
##@ system integration test
sit-prepare-operator-images:
@echo "Preparing operator images"
docker build -t ${SIT_IMG} .
docker pull -q quay.io/jetstack/cert-manager-controller:v1.5.3
docker pull -q quay.io/jetstack/cert-manager-webhook:v1.5.3
docker pull -q quay.io/jetstack/cert-manager-cainjector:v1.5.3
sit-prepare-images: sit-prepare-operator-images
@echo "Preparing images"
docker pull milvusdb/milvus:v2.4.15
# docker pull -q apachepulsar/pulsar:2.8.2
docker pull -q bitnami/kafka:3.1.0-debian-10-r52
docker pull -q milvusdb/etcd:3.5.14-r1
docker pull -q minio/minio:RELEASE.2023-03-20T20-16-18Z
docker pull -q bitnami/pymilvus:2.4.6
sit-load-operator-images:
@echo "Loading operator images"
kind load docker-image ${SIT_IMG} --name ${KIND_CLUSTER}
kind load docker-image quay.io/jetstack/cert-manager-controller:v1.5.3 --name ${KIND_CLUSTER}
kind load docker-image quay.io/jetstack/cert-manager-webhook:v1.5.3 --name ${KIND_CLUSTER}
kind load docker-image quay.io/jetstack/cert-manager-cainjector:v1.5.3 --name ${KIND_CLUSTER}
sit-load-images: sit-load-operator-images
@echo "Loading images"
kind load docker-image milvusdb/milvus:v2.4.15
# kind load docker-image apachepulsar/pulsar:2.8.2 --name ${KIND_CLUSTER}
kind load docker-image bitnami/kafka:3.1.0-debian-10-r52 --name ${KIND_CLUSTER}
kind load docker-image milvusdb/etcd:3.5.14-r1 --name ${KIND_CLUSTER}
kind load docker-image minio/minio:RELEASE.2023-03-20T20-16-18Z --name ${KIND_CLUSTER}
kind load docker-image bitnami/pymilvus:2.4.6 --name ${KIND_CLUSTER}
sit-load-and-cleanup-images: sit-load-images
@echo "Clean up some big images to save disk space in github action"
docker rmi milvusdb/milvus:v2.4.15
# docker rmi apachepulsar/pulsar:2.8.2
docker rmi bitnami/kafka:3.1.0-debian-10-r52
docker rmi milvusdb/etcd:3.5.14-r1
docker rmi minio/minio:RELEASE.2023-03-20T20-16-18Z
sit-generate-manifest:
cat deploy/manifests/deployment.yaml | sed "s#${RELEASE_IMG}#${SIT_IMG}#g" > test/test_gen.yaml
sit-deploy: sit-load-and-cleanup-images
@echo "Deploying"
$(HELM) -n milvus-operator install --set image.repository=milvus-operator,image.tag=sit,resources.requests.cpu=10m --create-namespace milvus-operator ./charts/milvus-operator
kubectl -n milvus-operator describe pods
@echo "Waiting for operator to be ready"
kubectl -n milvus-operator wait --for=condition=complete job/milvus-operator-checker --timeout=6m
kubectl -n milvus-operator rollout restart deploy/milvus-operator
kubectl -n milvus-operator wait --timeout=3m --for=condition=available deployments/milvus-operator
sleep 5 #wait for the service to be ready
sit-test:
./test/sit.sh ${test_mode}
cleanup-sit:
kubectl delete -f test/test_gen.yaml
test-milvus-upgrade:
./test/milvus-upgrade.sh
test-upgrade:
./test/upgrade.sh
# go-get-tool will 'go get' any package $2 and install it to $1.
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
define go-get-tool
@[ -f $(1) ] || { \
set -e ;\
TMP_DIR=$$(mktemp -d) ;\
cd $$TMP_DIR ;\
go mod init tmp ;\
echo "Downloading $(2)" ;\
GOBIN=$(PROJECT_DIR)/bin go get $(2) ;\
rm -rf $$TMP_DIR ;\
}
endef
####################
# Helm chart #
####################
CHARTS_DIRECTORY := charts
CHART_MILVUS_OPERATOR := $(CHARTS_DIRECTORY)/milvus-operator
CHART_REPO_URL := /milvus-operator/charts
DO_NOT_EDIT := Code generated by make. DO NOT EDIT.
# find helm or raise an error
.PHONY: helm
helm:
ifeq (, $(shell which helm 2> /dev/null))
$(error Helm not found. Please install it: https://helm.sh/docs/intro/install/#from-script)
HELM=helm-not-found
else
HELM=$(shell which helm 2> /dev/null)
endif
.PHONY: helm-generate $(KUSTOMIZE) $(HELM)
helm-generate: $(CHARTS_DIRECTORY)/index.yaml
$(CHARTS_DIRECTORY)/index.yaml: $(CHARTS_DIRECTORY)/milvus-operator-$(VERSION).tgz
$(HELM) repo index \
--url $(CHART_REPO_URL) \
$(CHARTS_DIRECTORY)
CHART_TEMPLATE_PATH := $(CHART_MILVUS_OPERATOR)/templates
$(CHARTS_DIRECTORY)/milvus-operator-$(VERSION).tgz: $(CHART_MILVUS_OPERATOR)/templates/crds.yaml \
$(wildcard $(CHART_MILVUS_OPERATOR)/assets/*) \
$(CHART_TEMPLATE_PATH)/role.yaml $(CHART_TEMPLATE_PATH)/clusterrole.yaml \
$(CHART_TEMPLATE_PATH)/rolebinding.yaml $(CHART_TEMPLATE_PATH)/clusterrolebinding.yaml \
$(CHART_TEMPLATE_PATH)/mutatingwebhookconfiguration.yaml $(CHART_TEMPLATE_PATH)/validatingwebhookconfiguration.yaml \
$(CHART_TEMPLATE_PATH)/deployment.yaml
$(HELM) package $(CHART_MILVUS_OPERATOR) \
--version $(VERSION) \
--app-version $(VERSION) \
--destination $(CHARTS_DIRECTORY)
$(CHART_MILVUS_OPERATOR)/templates/crds.yaml: kustomize config/crd/bases
echo '{{- /* $(DO_NOT_EDIT) */ -}}' > '$@'
echo '{{- if .Values.installCRDs }}' >> '$@'
$(KUSTOMIZE) build config/helm/crds/ | \
sed "s/'\({{[^}}]*}}\)'/\1/g">> '$@'
echo '{{- end -}}' >> '$@'
$(CHART_TEMPLATE_PATH)/deployment.yaml: kustomize $(wildcard config/helm/deployment/*) $(wildcard config/manager/*) $(wildcard config/config/*)
echo '{{- /* $(DO_NOT_EDIT) */ -}}' > $(CHART_TEMPLATE_PATH)/deployment.yaml
$(KUSTOMIZE) build --reorder legacy config/helm/deployment | \
$(KUSTOMIZE) cfg grep --annotate=false 'kind=Deployment' | \
sed "s/'\({{[^}}]*}}\)'/\1/g" \
>> $(CHART_TEMPLATE_PATH)/deployment.yaml
$(CHART_TEMPLATE_PATH)/role.yaml: kustomize $(wildcard config/helm/rbac/*) $(wildcard config/rbac/*)
echo '{{- /* $(DO_NOT_EDIT) */ -}}' > $(CHART_TEMPLATE_PATH)/role.yaml
echo '{{- if .Values.rbac.create }}' >> $(CHART_TEMPLATE_PATH)/role.yaml
$(KUSTOMIZE) build --reorder legacy config/helm/rbac | \
$(KUSTOMIZE) cfg grep --annotate=false 'kind=Role' | \
$(KUSTOMIZE) cfg grep --annotate=false --invert-match 'kind=ClusterRole' | \
$(KUSTOMIZE) cfg grep --annotate=false --invert-match 'kind=RoleBinding' | \
sed "s/'\({{[^}}]*}}\)'/\1/g" \
>> $(CHART_TEMPLATE_PATH)/role.yaml
echo '{{- end -}}' >> $(CHART_TEMPLATE_PATH)/role.yaml
$(CHART_TEMPLATE_PATH)/clusterrole.yaml: kustomize $(wildcard config/helm/rbac/*) $(wildcard config/rbac/*)
echo '{{- /* $(DO_NOT_EDIT) */ -}}' > $(CHART_TEMPLATE_PATH)/clusterrole.yaml
echo '{{- if .Values.rbac.create }}' >> $(CHART_TEMPLATE_PATH)/clusterrole.yaml
$(KUSTOMIZE) build --reorder legacy config/helm/rbac | \
$(KUSTOMIZE) cfg grep --annotate=false 'kind=ClusterRole' | \
$(KUSTOMIZE) cfg grep --annotate=false --invert-match 'kind=ClusterRoleBinding' | \
sed "s/'\({{[^}}]*}}\)'/\1/g" \
>> $(CHART_TEMPLATE_PATH)/clusterrole.yaml
echo '{{- end -}}' >> $(CHART_TEMPLATE_PATH)/clusterrole.yaml
$(CHART_TEMPLATE_PATH)/rolebinding.yaml: kustomize $(wildcard config/helm/rbac/*) $(wildcard config/rbac/*)
echo '{{- /* $(DO_NOT_EDIT) */ -}}' > $(CHART_TEMPLATE_PATH)/rolebinding.yaml
echo '{{- if .Values.rbac.create }}' >> $(CHART_TEMPLATE_PATH)/rolebinding.yaml
$(KUSTOMIZE) build --reorder legacy config/helm/rbac | \
$(KUSTOMIZE) cfg grep --annotate=false 'kind=RoleBinding' | \
$(KUSTOMIZE) cfg grep --annotate=false --invert-match 'kind=ClusterRoleBinding' | \
sed "s/'\({{[^}}]*}}\)'/\1/g" \
>> $(CHART_TEMPLATE_PATH)/rolebinding.yaml
echo '{{- end -}}' >> $(CHART_TEMPLATE_PATH)/rolebinding.yaml
$(CHART_TEMPLATE_PATH)/clusterrolebinding.yaml: kustomize $(wildcard config/helm/rbac/*) $(wildcard config/rbac/*)
echo '{{- /* $(DO_NOT_EDIT) */ -}}' > $(CHART_TEMPLATE_PATH)/clusterrolebinding.yaml
echo '{{- if .Values.rbac.create }}' >> $(CHART_TEMPLATE_PATH)/clusterrolebinding.yaml
$(KUSTOMIZE) build --reorder legacy config/helm/rbac | \
$(KUSTOMIZE) cfg grep --annotate=false 'kind=ClusterRoleBinding' | \
sed "s/'\({{[^}}]*}}\)'/\1/g" \
>> $(CHART_TEMPLATE_PATH)/clusterrolebinding.yaml
echo '{{- end -}}' >> $(CHART_TEMPLATE_PATH)/clusterrolebinding.yaml
$(CHART_TEMPLATE_PATH)/validatingwebhookconfiguration.yaml: kustomize $(wildcard config/helm/webhook/*) $(wildcard config/webhook/*)
echo '{{- /* $(DO_NOT_EDIT) */ -}}' > $(CHART_TEMPLATE_PATH)/validatingwebhookconfiguration.yaml
$(KUSTOMIZE) build --reorder legacy config/helm/webhook | \
$(KUSTOMIZE) cfg grep --annotate=false 'kind=ValidatingWebhookConfiguration' | \
sed "s/'\({{[^}}]*}}\)'/\1/g" \
>> $(CHART_TEMPLATE_PATH)/validatingwebhookconfiguration.yaml
$(CHART_TEMPLATE_PATH)/mutatingwebhookconfiguration.yaml: kustomize $(wildcard config/helm/webhook/*) $(wildcard config/webhook/*)
echo '{{- /* $(DO_NOT_EDIT) */ -}}' > $(CHART_TEMPLATE_PATH)/mutatingwebhookconfiguration.yaml
$(KUSTOMIZE) build --reorder legacy config/helm/webhook | \
$(KUSTOMIZE) cfg grep --annotate=false 'kind=MutatingWebhookConfiguration' | \
sed "s/'\({{[^}}]*}}\)'/\1/g" \
>> $(CHART_TEMPLATE_PATH)/mutatingwebhookconfiguration.yaml
deploy-by-manifest: sit-prepare-operator-images sit-load-operator-images sit-generate-manifest
@echo "Deploying Milvus Operator"
kubectl apply -f ./test/test_gen.yaml
@echo "Waiting for the operator to be ready..."
kubectl -n milvus-operator wait --for=condition=complete job/milvus-operator-checker --timeout=6m
kubectl -n milvus-operator rollout restart deploy/milvus-operator
kubectl -n milvus-operator wait --timeout=3m --for=condition=available deployments/milvus-operator
sleep 5 #wait for the service to be ready
debug-start: dev-cert
kubectl -n milvus-operator patch deployment/milvus-operator --patch '{"spec":{"template":{"spec":{"containers":[{"name":"manager","args":["-namespace","milvus-operator","-name","milvus-operator","--health-probe-bind-address=:8081","--metrics-bind-address=:8080","--leader-elect","--stop-reconcilers=all"]}]}}}}'
go run ./main.go -debug
debug-stop:
kubectl -n milvus-operator patch deployment/milvus-operator --patch '{"spec":{"template":{"spec":{"containers":[{"name":"manager","args":["-namespace","milvus-operator","-name","milvus-operator","--health-probe-bind-address=:8081","--metrics-bind-address=:8080","--leader-elect"]}]}}}}'