From b8253b369e50a0a3dbf3cc8bb726f9a511d7e776 Mon Sep 17 00:00:00 2001 From: dd di cesare Date: Thu, 16 Jun 2022 15:40:07 +0200 Subject: [PATCH] [makefile] kubebuilder-tools workaround for darwin/arm64 arch --- Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index aba3d239..8e254b36 100644 --- a/Makefile +++ b/Makefile @@ -42,6 +42,11 @@ IMAGE_TAG ?= latest else IMAGE_TAG ?= v$(VERSION) endif +# kubebuilder-tools still doesn't support darwin/arm64. This is a workaround (https://github.com/kubernetes-sigs/controller-runtime/issues/1657) +ARCH_PARAM = +ifeq ($(shell uname -sm),Darwin arm64) + ARCH_PARAM = --arch=amd64 +endif # BUNDLE_IMG defines the image:tag used for the bundle. # You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=/:) @@ -104,7 +109,7 @@ vet: ## Run go vet against code. go vet ./... test: manifests generate fmt vet envtest ## Run tests. - KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out + KUBEBUILDER_ASSETS="$(shell $(ENVTEST) $(ARCH_PARAM) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out ##@ Build