diff --git a/Makefile b/Makefile index 9fdf869a51b..7ba0b5047ed 100644 --- a/Makefile +++ b/Makefile @@ -180,9 +180,16 @@ api-docs: crd-ref-docs ## Creates API docs using https://github.com/elastic/crd- build: generate fmt vet ## Build manager binary. go build -o bin/manager main.go +RUN_ARGS = --log-mode=devel +GO_RUN_MAIN = OPERATOR_NAMESPACE=$(OPERATOR_NAMESPACE) DEFAULT_MANIFESTS_PATH=$(DEFAULT_MANIFESTS_PATH) go run $(GO_RUN_ARGS) ./main.go $(RUN_ARGS) .PHONY: run run: manifests generate fmt vet ## Run a controller from your host. - OPERATOR_NAMESPACE=$(OPERATOR_NAMESPACE) DEFAULT_MANIFESTS_PATH=${DEFAULT_MANIFESTS_PATH} go run ./main.go --log-mode=devel + $(GO_RUN_MAIN) + +.PHONY: run-nowebhook +run-nowebhook: GO_RUN_ARGS += -tags nowebhook +run-nowebhook: manifests generate fmt vet ## Run a controller from your host without webhook enabled + $(GO_RUN_MAIN) .PHONY: image-build image-build: # unit-test ## Build image with the manager. diff --git a/controllers/webhook/nowebhook.go b/controllers/webhook/nowebhook.go new file mode 100644 index 00000000000..dc8eefe7533 --- /dev/null +++ b/controllers/webhook/nowebhook.go @@ -0,0 +1,7 @@ +//go:build nowebhook + +package webhook + +import ctrl "sigs.k8s.io/controller-runtime" + +func Init(mgr ctrl.Manager) {} diff --git a/controllers/webhook/webhook.go b/controllers/webhook/webhook.go index 29739e2af00..5a539667b91 100644 --- a/controllers/webhook/webhook.go +++ b/controllers/webhook/webhook.go @@ -1,3 +1,5 @@ +//go:build !nowebhook + /* Copyright 2023.