@@ -8,6 +8,10 @@ platform := $(shell uname | tr A-Z a-z)
88list : # # list Makefile targets
99 @grep -E ' ^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST ) | sort | awk ' BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
1010
11+ # ## Tools
12+ # Allows flexbility to use other build kits, like nerdctl
13+ BUILD_KIT ?= /usr/local/bin/docker
14+
1115define get_mod_code_generator
1216echo "Only go get & mod k8s.io/code-generator, but do not install it"
1317echo "⚠️ Keep it at the same version as captured in go.mod, otherwise we may end up with version inconsistencies"
@@ -30,6 +34,8 @@ export KUBEBUILDER_ASSETS = $(LOCAL_TESTBIN)/k8s/$(ENVTEST_K8S_VERSION)-$(platfo
3034$(KUBEBUILDER_ASSETS ) :
3135 setup-envtest --os $(platform ) --arch $(ARCHITECTURE ) --bin-dir $(LOCAL_TESTBIN ) use $(ENVTEST_K8S_VERSION )
3236
37+ # ## Targets
38+
3339.PHONY : unit-tests
3440unit-tests : install-tools $(KUBEBUILDER_ASSETS ) generate fmt vet manifests # # Run unit tests
3541 ginkgo -r --randomizeAllSpecs api/ internal/
@@ -38,6 +44,9 @@ unit-tests: install-tools $(KUBEBUILDER_ASSETS) generate fmt vet manifests ## Ru
3844integration-tests : install-tools $(KUBEBUILDER_ASSETS ) generate fmt vet manifests # # Run integration tests
3945 ginkgo -r --randomizeAllSpecs controllers/
4046
47+ just-integration-tests : $(KUBEBUILDER_ASSETS ) vet
48+ ginkgo -randomizeAllSpecs -r controllers/
49+
4150local-tests : unit-tests integration-tests # # Run all local tests (unit & integration)
4251
4352system-tests : # # run end-to-end tests against Kubernetes cluster defined in ~/.kube/config. Expects cluster operator and messaging topology operator to be installed in the cluster
@@ -82,7 +91,7 @@ deploy-dev: check-env-docker-credentials docker-build-dev manifests deploy-rbac
8291
8392# Load operator image and deploy operator into current KinD cluster
8493deploy-kind : manifests deploy-rbac
85- docker build --build-arg=GIT_COMMIT=$(GIT_COMMIT ) -t $(DOCKER_REGISTRY_SERVER ) /$(OPERATOR_IMAGE ) :$(GIT_COMMIT ) .
94+ $( BUILD_KIT ) build --build-arg=GIT_COMMIT=$(GIT_COMMIT ) -t $(DOCKER_REGISTRY_SERVER ) /$(OPERATOR_IMAGE ) :$(GIT_COMMIT ) .
8695 kind load docker-image $(DOCKER_REGISTRY_SERVER ) /$(OPERATOR_IMAGE ) :$(GIT_COMMIT )
8796 kustomize build config/default/overlays/kind | sed ' s@((operator_docker_image))@"$(DOCKER_REGISTRY_SERVER)/$(OPERATOR_IMAGE):$(GIT_COMMIT)"@' | kubectl apply -f -
8897
@@ -131,8 +140,8 @@ ifndef DOCKER_REGISTRY_SECRET
131140endif
132141
133142docker-build-dev : check-env-docker-repo git-commit-sha
134- docker build --build-arg=GIT_COMMIT=$(GIT_COMMIT ) -t $(DOCKER_REGISTRY_SERVER ) /$(OPERATOR_IMAGE ) :$(GIT_COMMIT ) .
135- docker push $(DOCKER_REGISTRY_SERVER ) /$(OPERATOR_IMAGE ) :$(GIT_COMMIT )
143+ $( BUILD_KIT ) build --build-arg=GIT_COMMIT=$(GIT_COMMIT ) -t $(DOCKER_REGISTRY_SERVER ) /$(OPERATOR_IMAGE ) :$(GIT_COMMIT ) .
144+ $( BUILD_KIT ) push $(DOCKER_REGISTRY_SERVER ) /$(OPERATOR_IMAGE ) :$(GIT_COMMIT )
136145
137146docker-registry-secret : check-env-docker-credentials operator-namespace
138147 echo " creating registry secret and patching default service account"
@@ -172,8 +181,8 @@ generate-manifests:
172181 kustomize build config/installation/cert-manager/ > releases/messaging-topology-operator-with-certmanager.yaml
173182
174183CERT_MANAGER_VERSION ?=v1.2.0
175- cert-manager :
184+ cert-manager : # # Deploys Cert Manager from JetStack repo. Use CERT_MANAGER_VERSION to customise version e.g. v1.2.0
176185 kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/$(CERT_MANAGER_VERSION ) /cert-manager.yaml
177186
178- destroy-cert-manager :
187+ destroy-cert-manager : # # Deletes Cert Manager deployment created by 'make cert-manager'
179188 kubectl delete -f https://github.com/jetstack/cert-manager/releases/download/$(CERT_MANAGER_VERSION ) /cert-manager.yaml
0 commit comments