Skip to content

Commit a482b2b

Browse files
Migrating to CRD V1 API
* update operator-sdk * new crds generated * operator-sdk new layout * update docker builder image version * fix: lb-watcher: always set import annotation to 'true' for generated lbs * added events role * update helm chart * fix Makefile Co-authored-by: Artashes Balabekyan <[email protected]>
1 parent d200100 commit a482b2b

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

Makefile

+18-15
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ all: manager
2828
ENVTEST_ASSETS_DIR = $(shell pwd)/testbin
2929
test: generate fmt vet manifests
3030
mkdir -p $(ENVTEST_ASSETS_DIR)
31-
test -f $(ENVTEST_ASSETS_DIR)/setup-envtest.sh || curl -sSLo $(ENVTEST_ASSETS_DIR)/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.6.3/hack/setup-envtest.sh
31+
test -f $(ENVTEST_ASSETS_DIR)/setup-envtest.sh || curl -sSLo $(ENVTEST_ASSETS_DIR)/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.8.3/hack/setup-envtest.sh
3232
source $(ENVTEST_ASSETS_DIR)/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test ./... -coverprofile cover.out
3333

3434
# Build manager binary
@@ -84,20 +84,23 @@ CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
8484
controller-gen: ## Download controller-gen locally if necessary.
8585
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/[email protected])
8686

87-
kustomize:
88-
ifeq (, $(shell which kustomize))
89-
@{ \
90-
set -e ;\
91-
KUSTOMIZE_GEN_TMP_DIR=$$(mktemp -d) ;\
92-
cd $$KUSTOMIZE_GEN_TMP_DIR ;\
93-
go mod init tmp ;\
94-
go get sigs.k8s.io/kustomize/kustomize/[email protected] ;\
95-
rm -rf $$KUSTOMIZE_GEN_TMP_DIR ;\
96-
}
97-
KUSTOMIZE=$(GOBIN)/kustomize
98-
else
99-
KUSTOMIZE=$(shell which kustomize)
100-
endif
87+
KUSTOMIZE = $(shell pwd)/bin/kustomize
88+
kustomize: ## Download kustomize locally if necessary.
89+
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected])
90+
91+
# go-get-tool will 'go get' any package $2 and install it to $1.
92+
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
93+
define go-get-tool
94+
@[ -f $(1) ] || { \
95+
set -e ;\
96+
TMP_DIR=$$(mktemp -d) ;\
97+
cd $$TMP_DIR ;\
98+
go mod init tmp ;\
99+
echo "Downloading $(2)" ;\
100+
GOBIN=$(PROJECT_DIR)/bin go get $(2) ;\
101+
rm -rf $$TMP_DIR ;\
102+
}
103+
endef
101104

102105
release: generate fmt vet manifests kustomize
103106
$(KUSTOMIZE) build config/crd > deploy/netris-operator.crds.yaml

0 commit comments

Comments
 (0)