@@ -99,6 +99,8 @@ CONTROLLER_TOOLS_VERSION ?= v0.18.0
9999# renovate: datasource=github-releases depName=golangci/golangci-lint
100100GOLANGCI_LINT_VERSION ?= v2.3.0
101101
102+ CERT_MANAGER_VERSION ?= v1.19.2
103+
102104# # Envtest
103105# ENVTEST_VERSION is the version of controller-runtime release branch to fetch the envtest setup script (i.e. release-0.20)
104106ENVTEST_VERSION ?= $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller-runtime | awk -F'[v.]' '{printf "release-% d.% d", $$2, $$3}')
@@ -134,11 +136,10 @@ help: ## Display this help.
134136
135137.PHONY : manifests
136138manifests : controller-gen # # Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
137- $(CONTROLLER_GEN ) rbac:roleName=manager-role crd webhook paths=" ./api/..." output:crd:artifacts:config=config/crd/bases output:rbac:artifacts:config=config/rbac
138-
139+ $(CONTROLLER_GEN ) rbac:roleName=manager-role crd webhook paths=" ./api/...;./pkg/webhook/..." output:crd:artifacts:config=config/crd/bases output:rbac:artifacts:config=config/rbac output:webhook:artifacts:config=config/webhook
139140.PHONY : generate
140141generate : controller-gen # # Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
141- $(CONTROLLER_GEN ) object paths=" ./api/..."
142+ $(CONTROLLER_GEN ) object paths=" ./api/...;./pkg/webhook/... "
142143# $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
143144
144145.PHONY : fmt
@@ -427,6 +428,30 @@ kind-deploy: kind-up manifests kustomize kind-load ## Deploy operator to kind cl
427428 @echo " ==> Deployment complete!"
428429 @echo " Check status: KUBECONFIG=$( KIND_KUBECONFIG) kubectl get pods -n multigres-operator"
429430
431+ .PHONY : kind-deploy-certmanager
432+ kind-deploy-certmanager : kind-up install-certmanager manifests kustomize kind-load
433+ @echo " ==> Installing CRDs..."
434+ KUBECONFIG=$(KIND_KUBECONFIG ) $(KUSTOMIZE ) build config/crd | \
435+ KUBECONFIG=$(KIND_KUBECONFIG ) $(KUBECTL ) apply --server-side -f -
436+ @echo " ==> Deploying operator (Cert-Manager Mode)..."
437+ cd config/manager && $(KUSTOMIZE ) edit set image controller=$(IMG )
438+ # POINT TO THE OVERLAY:
439+ KUBECONFIG=$(KIND_KUBECONFIG ) $(KUSTOMIZE ) build config/deploy-certmanager | \
440+ KUBECONFIG=$(KIND_KUBECONFIG ) $(KUBECTL ) apply --server-side -f -
441+ @echo " ==> Deployment complete!"
442+ @echo " Check status: KUBECONFIG=$( KIND_KUBECONFIG) kubectl get pods -n multigres-operator"
443+
444+ .PHONY : kind-deploy-no-webhook
445+ kind-deploy-no-webhook : kind-up install-certmanager manifests kustomize kind-load # # Deploy controller to Kind without the webhook enabled.
446+ @echo " ==> Installing CRDs..."
447+ KUBECONFIG=$(KIND_KUBECONFIG ) $(KUSTOMIZE ) build config/crd | KUBECONFIG=$(KIND_KUBECONFIG ) $(KUBECTL ) apply --server-side -f -
448+ @echo " ==> Deploying operator..."
449+ cd config/manager && $(KUSTOMIZE ) edit set image controller=$(IMG )
450+ KUBECONFIG=$(KIND_KUBECONFIG ) $(KUSTOMIZE ) build config/no-webhook | KUBECONFIG=$(KIND_KUBECONFIG ) $(KUBECTL ) apply --server-side -f -
451+ @echo " ==> Deployment complete!"
452+ @echo " Check status: KUBECONFIG=$( KIND_KUBECONFIG) kubectl get pods -n multigres-operator"
453+
454+
430455.PHONY : kind-redeploy
431456kind-redeploy : kind-load # # Rebuild image, reload to kind, and restart pods
432457 @echo " ==> Restarting operator pods..."
@@ -469,6 +494,13 @@ golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
469494$(GOLANGCI_LINT ) : $(LOCALBIN )
470495 $(call go-install-tool,$(GOLANGCI_LINT ) ,github.com/golangci/golangci-lint/v2/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION ) )
471496
497+ .PHONY : install-certmanager
498+ install-certmanager : # # Install Cert-Manager into the cluster
499+ @echo " ==> Installing Cert-Manager $( CERT_MANAGER_VERSION) ..."
500+ $(KUBECTL ) apply -f https://github.com/cert-manager/cert-manager/releases/download/$(CERT_MANAGER_VERSION ) /cert-manager.yaml
501+ @echo " ==> Waiting for Cert-Manager to be ready..."
502+ $(KUBECTL ) wait --for=condition=Available deployment --all -n cert-manager --timeout=300s
503+
472504# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
473505# $1 - target path with name of binary
474506# $2 - package url which can be installed
0 commit comments