Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Commit 7ca4537

Browse files
authored
Merge pull request #83 from gianarb/install-kustomize
install kustomize via hack dir
2 parents 234b1c2 + 361f500 commit 7ca4537

File tree

3 files changed

+552
-9
lines changed

3 files changed

+552
-9
lines changed

Makefile

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,21 @@ REPO_URL ?= https://github.com/packethost/cluster-api-provider-packet
3131
BUILDARCH ?= $(shell uname -m)
3232
BUILDOS ?= $(shell uname -s | tr A-Z a-z)
3333

34-
TEST_E2E_DIR := test/e2e
3534
E2E_FOCUS := "functional tests"
3635

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+
3749
# canonicalized names for host architecture
3850
ifeq ($(BUILDARCH),aarch64)
3951
BUILDARCH=arm64
@@ -201,16 +213,16 @@ run: generate fmt vet crds
201213

202214
# Install CRDs into a cluster
203215
install: crds
204-
kustomize build config/crd | kubectl apply -f -
216+
$(KUSTOMIZE) build config/crd | kubectl apply -f -
205217

206218
# Uninstall CRDs from a cluster
207219
uninstall: crds
208-
kustomize build config/crd | kubectl delete -f -
220+
$(KUSTOMIZE) build config/crd | kubectl delete -f -
209221

210222
# Deploy controller in the configured Kubernetes cluster in ~/.kube/config
211223
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 -
214226

215227
# Generate manifests e.g. CRD, RBAC etc.
216228
crds: controller-gen
@@ -291,7 +303,7 @@ ifeq (,$(VERSION))
291303
endif
292304

293305

294-
manifest: semver release-manifests release-clusterctl release-cluster-template
306+
manifest: kustomize semver release-manifests release-clusterctl release-cluster-template
295307

296308
release:
297309
goreleaser release --rm-dist --snapshot --skip-publish --debug
@@ -301,7 +313,7 @@ release/publish:
301313

302314
release-manifests: semver $(RELEASE_MANIFEST) $(RELEASE_METADATA) $(RELEASE_CLUSTER_TEMPLATE)
303315
$(RELEASE_MANIFEST): $(RELEASE_DIR) ## Builds the manifests to publish with a release
304-
kustomize build config/default > $@
316+
$(KUSTOMIZE) build config/default > $@
305317

306318
$(RELEASE_METADATA): semver $(RELEASE_DIR) $(METADATA_TEMPLATE)
307319
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)
321333
managerless: semver managerless-manifests managerless-clusterctl managerless-cluster-template
322334
managerless-manifests: semver $(MANAGERLESS_MANIFEST) $(MANAGERLESS_METADATA)
323335
$(MANAGERLESS_MANIFEST): $(MANAGERLESS_DIR)
324-
kustomize build config/managerless > $@
336+
$(KUSTOMIZE) build config/managerless > $@
325337

326338
$(MANAGERLESS_METADATA): semver $(MANAGERLESS_DIR) $(METADATA_TEMPLATE)
327339
cat $(METADATA_TEMPLATE) | sed 's/MAJOR/$(VERSION_MAJOR)/g' | sed 's/MINOR/$(VERSION_MINOR)/g' | sed 's/CONTRACT/$(VERSION_CONTRACT)/g' > $@

hack/tools/go.mod

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@ module github.com/packethost/cluster-api-provider-packet/hack/tools
22

33
go 1.14
44

5-
require github.com/onsi/ginkgo v1.12.0 // indirect
5+
require (
6+
github.com/onsi/ginkgo v1.12.0
7+
sigs.k8s.io/kustomize/kustomize/v3 v3.5.4
8+
)

0 commit comments

Comments
 (0)