@@ -173,6 +173,7 @@ verify-with-container:
173173verify-deps :
174174 hack/verify-deps.sh
175175
176+ .PHONY : local-run
176177local-run : build
177178 RELATED_IMAGE_CERT_MANAGER_WEBHOOK=quay.io/jetstack/cert-manager-webhook:$(CERT_MANAGER_VERSION ) \
178179 RELATED_IMAGE_CERT_MANAGER_CA_INJECTOR=quay.io/jetstack/cert-manager-cainjector:$(CERT_MANAGER_VERSION ) \
@@ -199,28 +200,40 @@ check-tools:
199200 @command -v $(CONTAINER_ENGINE ) > /dev/null 2>&1 || { echo " WARNING: $( CONTAINER_ENGINE) is not installed. Please install it to avoid issues." ; }
200201 @command -v kubectl > /dev/null 2>&1 || { echo " WARNING: kubectl is not installed. Please install it to avoid issues." ; }
201202
203+ .PHONY : build-operator
202204build-operator : # # Build operator binary, no additional checks or code generation
203205 @GOFLAGS=" -mod=vendor" source hack/go-fips.sh && $(GO ) build $(GOBUILD_VERSION_ARGS ) -o $(BIN )
204206
207+ .PHONY : build
205208build : check-tools generate fmt vet build-operator # # Build operator binary.
206209
210+ .PHONY : run
207211run : check-tools manifests generate fmt vet # # Run a controller from your host.
208212 go run $(PACKAGE )
209213
214+ .PHONY : image-build
210215image-build : check-tools # # Build container image with the operator.
211216 $(CONTAINER_ENGINE ) build -t ${IMG} .
212217
218+ .PHONY : image-push
213219image-push : check-tools # # Push container image with the operator.
214220 $(CONTAINER_ENGINE ) push ${IMG} ${CONTAINER_PUSH_ARGS}
215221
216222# #@ Deployment
217223
224+ .PHONY : deploy
218225deploy : manifests # # Deploy controller to the K8s cluster specified in ~/.kube/config.
226+ @kubectl get namespace cert-manager-operator > /dev/null 2>&1 || { \
227+ echo " Namespace 'cert-manager-operator' does not exist. Creating it..." ; \
228+ kubectl create namespace cert-manager-operator; \
229+ }
219230 cd config/manager && $(KUSTOMIZE ) edit set image controller=${IMG}
220- $(KUSTOMIZE ) build config/default | kubectl apply -f -
231+ $(KUSTOMIZE ) build config/default | kubectl apply -f -
221232
233+ .PHONY : undeploy
222234undeploy : # # Undeploy controller from the K8s cluster specified in ~/.kube/config.
223- $(KUSTOMIZE ) build config/default | kubectl delete -f -
235+ $(KUSTOMIZE ) build config/default | kubectl delete --ignore-not-found -f -
236+ kubectl delete namespace cert-manager-operator --ignore-not-found
224237
225238.PHONY : bundle
226239bundle : check-tools $(OPERATOR_SDK_BIN ) manifests
@@ -246,6 +259,7 @@ index-image-push: check-tools
246259 $(CONTAINER_ENGINE ) push ${INDEX_IMG}
247260
248261OPM =$(BIN_DIR ) /opm
262+ .PHONY : opm
249263opm : # # Download opm locally if necessary.
250264 $(call get-bin,$(OPM ) ,$(BIN_DIR ) ,https://github.com/operator-framework/operator-registry/releases/download/$(OPM_VERSION ) /linux-amd64-opm)
251265
@@ -270,15 +284,16 @@ test-e2e: test-e2e-wait-for-stable-state
270284 ./test/e2e \
271285 -ginkgo.label-filter=$(E2E_GINKGO_LABEL_FILTER )
272286
287+ .PHONY : test-e2e-wait-for-stable-state
273288test-e2e-wait-for-stable-state :
274289 @echo " ---- Waiting for stable state ----"
275290 # This ensures the test-e2e-debug-cluster is called if a timeout is reached.
276291 oc wait --for=condition=Available=true deployment/cert-manager-cainjector -n cert-manager --timeout=120s || $(MAKE ) test-e2e-debug-cluster
277292 oc wait --for=condition=Available=true deployment/cert-manager -n cert-manager --timeout=120s || $(MAKE ) test-e2e-debug-cluster
278293 oc wait --for=condition=Available=true deployment/cert-manager-webhook -n cert-manager --timeout=120s || $(MAKE ) test-e2e-debug-cluster
279294 @echo " ---- /Waiting for stable state ----"
280- .PHONY : test-e2e-wait-for-stable-state
281295
296+ .PHONY : test-e2e-debug-cluster
282297test-e2e-debug-cluster :
283298 @echo " ---- Debugging the current state ----"
284299 - oc get pod -n cert-manager-operator
@@ -289,11 +304,10 @@ test-e2e-debug-cluster:
289304 - oc get subscriptions --all-namespaces
290305 - oc logs deployment/cert-manager-operator -n cert-manager-operator
291306 @echo " ---- /Debugging the current state ----"
292- .PHONY : test-e2e-debug-cluster
293307
294308.PHONY : lint
295309lint :
296- $(GOLANGCI_LINT ) run --config .golangci.yaml
310+ $(GOLANGCI_LINT ) run --config .golangci.yaml
297311
298312$(GOLANGCI_LINT_BIN ) :
299313 mkdir -p $(BIN_DIR )
0 commit comments