@@ -9,6 +9,9 @@ PGMONITOR_DIR ?= hack/tools/pgmonitor
9
9
PGMONITOR_VERSION ?= v4.11.0
10
10
QUERIES_CONFIG_DIR ?= hack/tools/queries
11
11
12
+ EXTERNAL_SNAPSHOTTER_DIR ?= hack/tools/external-snapshotter
13
+ EXTERNAL_SNAPSHOTTER_VERSION ?= v8.0.1
14
+
12
15
# Buildah's "build" used to be "bud". Use the alias to be compatible for a while.
13
16
BUILDAH_BUILD ?= buildah bud
14
17
@@ -52,6 +55,12 @@ get-pgmonitor:
52
55
cp -r ' $(PGMONITOR_DIR)/postgres_exporter/common/.' ' ${QUERIES_CONFIG_DIR}'
53
56
cp ' $(PGMONITOR_DIR)/postgres_exporter/linux/queries_backrest.yml' ' ${QUERIES_CONFIG_DIR}'
54
57
58
+ .PHONY : get-external-snapshotter
59
+ get-external-snapshotter :
60
+ git -C ' $(dir $(EXTERNAL_SNAPSHOTTER_DIR))' clone https://github.com/kubernetes-csi/external-snapshotter.git || git -C ' $(EXTERNAL_SNAPSHOTTER_DIR)' fetch origin
61
+ @git -C ' $(EXTERNAL_SNAPSHOTTER_DIR)' checkout ' $(EXTERNAL_SNAPSHOTTER_VERSION)'
62
+ @git -C ' $(EXTERNAL_SNAPSHOTTER_DIR)' config pull.ff only
63
+
55
64
.PHONY : clean
56
65
clean : # # Clean resources
57
66
clean : clean-deprecated
@@ -64,6 +73,7 @@ clean: clean-deprecated
64
73
[ ! -f hack/tools/setup-envtest ] || rm hack/tools/setup-envtest
65
74
[ ! -d hack/tools/envtest ] || { chmod -R u+w hack/tools/envtest && rm -r hack/tools/envtest; }
66
75
[ ! -d hack/tools/pgmonitor ] || rm -rf hack/tools/pgmonitor
76
+ [ ! -d hack/tools/external-snapshotter ] || rm -rf hack/tools/external-snapshotter
67
77
[ ! -n " $$ (ls hack/tools)" ] || rm -r hack/tools/*
68
78
[ ! -d hack/.kube ] || rm -r hack/.kube
69
79
@@ -130,7 +140,10 @@ deploy-dev: createnamespaces
130
140
CHECK_FOR_UPGRADES=' $(if $(CHECK_FOR_UPGRADES),$(CHECK_FOR_UPGRADES),false)' \
131
141
KUBECONFIG=hack/.kube/postgres-operator/pgo \
132
142
PGO_NAMESPACE=' postgres-operator' \
133
- $(shell $(KUSTOMIZE ) build ./config/dev | \
143
+ PGO_INSTALLER=' deploy-dev' \
144
+ PGO_INSTALLER_ORIGIN=' postgres-operator-repo' \
145
+ BUILD_SOURCE=' build-postgres-operator' \
146
+ $(shell kubectl kustomize ./config/dev | \
134
147
sed -ne ' /^kind: Deployment/,/^---/ { \
135
148
/RELATED_IMAGE_/ { N; s,.* \( RELATED_[^[:space:]]* \) .* value:[[:space:]]* \( [^[:space:]]* \) ,\1 = " \2" ,; p; }; \
136
149
}' ) \
@@ -140,8 +153,9 @@ deploy-dev: createnamespaces
140
153
# #@ Build - Binary
141
154
.PHONY : build-postgres-operator
142
155
build-postgres-operator : # # Build the postgres-operator binary
143
- $(GO_BUILD ) -ldflags ' -X "main.versionString=$(PGO_VERSION)"' \
144
- -o bin/postgres-operator ./cmd/postgres-operator
156
+ $(GO_BUILD ) $(\
157
+ ) --ldflags ' -X "main.versionString=$(PGO_VERSION)"' $(\
158
+ ) --trimpath -o bin/postgres-operator ./cmd/postgres-operator
145
159
146
160
# #@ Build - Images
147
161
.PHONY : build-postgres-operator-image
@@ -193,7 +207,7 @@ check: get-pgmonitor
193
207
check-envtest : # # Run check using envtest and a mock kube api
194
208
check-envtest : ENVTEST_USE = hack/tools/setup-envtest --bin-dir=$(CURDIR ) /hack/tools/envtest use $(ENVTEST_K8S_VERSION )
195
209
check-envtest : SHELL = bash
196
- check-envtest : get-pgmonitor
210
+ check-envtest : get-pgmonitor get-external-snapshotter
197
211
GOBIN=' $(CURDIR)/hack/tools' $(GO ) install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
198
212
@$(ENVTEST_USE ) --print=overview && echo
199
213
source <( $( ENVTEST_USE) --print=env) && PGO_NAMESPACE=" postgres-operator" QUERIES_CONFIG_DIR=" $( CURDIR) /${QUERIES_CONFIG_DIR} " \
@@ -205,7 +219,7 @@ check-envtest: get-pgmonitor
205
219
# make check-envtest-existing PGO_TEST_TIMEOUT_SCALE=1.2
206
220
.PHONY : check-envtest-existing
207
221
check-envtest-existing : # # Run check using envtest and an existing kube api
208
- check-envtest-existing : get-pgmonitor
222
+ check-envtest-existing : get-pgmonitor get-external-snapshotter
209
223
check-envtest-existing : createnamespaces
210
224
kubectl apply --server-side -k ./config/dev
211
225
USE_EXISTING_CLUSTER=true PGO_NAMESPACE=" postgres-operator" QUERIES_CONFIG_DIR=" $( CURDIR) /${QUERIES_CONFIG_DIR} " \
0 commit comments