@@ -31,9 +31,21 @@ REPO_URL ?= https://github.com/packethost/cluster-api-provider-packet
31
31
BUILDARCH ?= $(shell uname -m)
32
32
BUILDOS ?= $(shell uname -s | tr A-Z a-z)
33
33
34
- TEST_E2E_DIR := test/e2e
35
34
E2E_FOCUS := "functional tests"
36
35
36
+ # Directories.
37
+ TOOLS_DIR := hack/tools
38
+ TOOLS_BIN_DIR := $(TOOLS_DIR ) /bin
39
+ BIN_DIR := bin
40
+ TEST_E2E_DIR := test/e2e
41
+
42
+ # Binaries.
43
+ KUSTOMIZE := $(TOOLS_BIN_DIR ) /kustomize
44
+
45
+ kustomize : $(KUSTOMIZE )
46
+ $(KUSTOMIZE ) : $(TOOLS_DIR ) /go.mod # Build kustomize from tools folder.
47
+ cd $(TOOLS_DIR ) ; go build -tags=tools -o $(BIN_DIR ) /kustomize sigs.k8s.io/kustomize/kustomize/v3
48
+
37
49
# canonicalized names for host architecture
38
50
ifeq ($(BUILDARCH ) ,aarch64)
39
51
BUILDARCH =arm64
@@ -201,16 +213,16 @@ run: generate fmt vet crds
201
213
202
214
# Install CRDs into a cluster
203
215
install : crds
204
- kustomize build config/crd | kubectl apply -f -
216
+ $( KUSTOMIZE ) build config/crd | kubectl apply -f -
205
217
206
218
# Uninstall CRDs from a cluster
207
219
uninstall : crds
208
- kustomize build config/crd | kubectl delete -f -
220
+ $( KUSTOMIZE ) build config/crd | kubectl delete -f -
209
221
210
222
# Deploy controller in the configured Kubernetes cluster in ~/.kube/config
211
223
deploy : crds
212
- cd config/manager && kustomize edit set image controller=${IMG}
213
- kustomize build config/default | kubectl apply -f -
224
+ cd config/manager && $( KUSTOMIZE ) edit set image controller=${IMG}
225
+ $( KUSTOMIZE ) build config/default | kubectl apply -f -
214
226
215
227
# Generate manifests e.g. CRD, RBAC etc.
216
228
crds : controller-gen
@@ -291,7 +303,7 @@ ifeq (,$(VERSION))
291
303
endif
292
304
293
305
294
- manifest : semver release-manifests release-clusterctl release-cluster-template
306
+ manifest : kustomize semver release-manifests release-clusterctl release-cluster-template
295
307
296
308
release :
297
309
goreleaser release --rm-dist --snapshot --skip-publish --debug
@@ -301,7 +313,7 @@ release/publish:
301
313
302
314
release-manifests : semver $(RELEASE_MANIFEST ) $(RELEASE_METADATA ) $(RELEASE_CLUSTER_TEMPLATE )
303
315
$(RELEASE_MANIFEST ) : $(RELEASE_DIR ) # # Builds the manifests to publish with a release
304
- kustomize build config/default > $@
316
+ $( KUSTOMIZE ) build config/default > $@
305
317
306
318
$(RELEASE_METADATA ) : semver $(RELEASE_DIR ) $(METADATA_TEMPLATE )
307
319
cat $(METADATA_TEMPLATE ) | sed ' s/MAJOR/$(VERSION_MAJOR)/g' | sed ' s/MINOR/$(VERSION_MINOR)/g' | sed ' s/CONTRACT/$(VERSION_CONTRACT)/g' > $@
@@ -321,7 +333,7 @@ $(FULL_RELEASE_CLUSTERCTLYAML): $(RELEASE_DIR)
321
333
managerless : semver managerless-manifests managerless-clusterctl managerless-cluster-template
322
334
managerless-manifests : semver $(MANAGERLESS_MANIFEST ) $(MANAGERLESS_METADATA )
323
335
$(MANAGERLESS_MANIFEST ) : $(MANAGERLESS_DIR )
324
- kustomize build config/managerless > $@
336
+ $( KUSTOMIZE ) build config/managerless > $@
325
337
326
338
$(MANAGERLESS_METADATA ) : semver $(MANAGERLESS_DIR ) $(METADATA_TEMPLATE )
327
339
cat $(METADATA_TEMPLATE ) | sed ' s/MAJOR/$(VERSION_MAJOR)/g' | sed ' s/MINOR/$(VERSION_MINOR)/g' | sed ' s/CONTRACT/$(VERSION_CONTRACT)/g' > $@
0 commit comments