diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3907c295..96450b3b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -59,7 +59,6 @@ jobs: helm unittest --help - name: other tools installation run: | - go install sigs.k8s.io/controller-tools/cmd/controller-gen@${CONTROLLER_GEN_VERSION} go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest asdf reshim golang diff --git a/.tool-versions b/.tool-versions index bebef362..ed27bd91 100644 --- a/.tool-versions +++ b/.tool-versions @@ -22,3 +22,5 @@ kubeval v0.16.1 git-chglog 0.15.4 # https://github.com/golangci/golangci-lint/releases golangci-lint 1.55.2 +# https://github.com/kubernetes-sigs/controller-tools/releases +kube-controller-tools 0.13.0 diff --git a/Makefile b/Makefile index 6920bb74..01693934 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ # UPDATE_HERE GO := GOPROXY=https://proxy.golang.org go +CONTROLLER_GEN := controller-gen SOPS_SEC_OPERATOR_VERSION := 0.12.0 # https://github.com/kubernetes-sigs/controller-tools/releases @@ -132,7 +133,10 @@ vet: ## Run go vet against code. .PHONY: test test: clean generate fmt vet envtest ## Run tests. - SOPS_AGE_RECIPIENTS="age1pnmp2nq5qx9z4lpmachyn2ld07xjumn98hpeq77e4glddu96zvms9nn7c8" SOPS_AGE_KEY_FILE="${PWD}/config/age-test-key/key-file.txt" KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path --force)" $(GO) test ./... -coverpkg=./internal/controllers/... -coverprofile=$(TMP_COVER_FILE) + SOPS_AGE_RECIPIENTS="age1pnmp2nq5qx9z4lpmachyn2ld07xjumn98hpeq77e4glddu96zvms9nn7c8" \ + SOPS_AGE_KEY_FILE="${PWD}/config/age-test-key/key-file.txt" \ + KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path --force)" \ + $(GO) test ./... -coverpkg=./internal/controllers/... -coverprofile=$(TMP_COVER_FILE) cover: test ## Run tests with coverage. $(GO) tool cover -func=$(TMP_COVER_FILE) @@ -218,10 +222,10 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi ##@ Misc -CONTROLLER_GEN = $(shell pwd)/bin/controller-gen -.PHONY: controller-gen -controller-gen: ## Download controller-gen locally if necessary. - $(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@${CONTROLLER_GEN_VERSION}) +#CONTROLLER_GEN = $(shell pwd)/bin/controller-gen +#.PHONY: controller-gen +#controller-gen: ## Download controller-gen locally if necessary. +# $(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@${CONTROLLER_GEN_VERSION}) KUSTOMIZE = $(shell pwd)/bin/kustomize .PHONY: kustomize