@@ -316,22 +316,27 @@ operator-lint: gowork ## Runs operator-lint
316316 GOBIN=
$(LOCALBIN ) go install github.com/gibizer/
[email protected] 317317 go vet -vettool=$(LOCALBIN ) /operator-lint ./... ./api/...
318318
319- # Used for webhook testing
320- # Please ensure the placement-controller-manager deployment and
321- # webhook definitions are removed from the csv before running
322- # this. Also, cleanup the webhook configuration for local testing
323- # before deplying with olm again.
324- # $oc delete -n openstack validatingwebhookconfiguration/vplacementapi.kb.io
325- # $oc delete -n openstack mutatingwebhookconfiguration/mplacementapi.kb.io
326319SKIP_CERT ?=false
327320.PHONY : run-with-webhook
328321run-with-webhook : export METRICS_PORT?=8080
329322run-with-webhook : export HEALTH_PORT?=8081
330- run-with-webhook : manifests generate fmt vet # # Run a controller from your host.
323+ run-with-webhook : manifests generate fmt vet scale-down-placement-controller-csv # # Run a controller from your host.
324+ /bin/bash hack/clean_local_webhook.sh
331325 /bin/bash hack/configure_local_webhook.sh
332326 go run ./main.go -metrics-bind-address " :$( METRICS_PORT) " -health-probe-bind-address " :$( HEALTH_PORT) "
333327
334328.PHONY : tidy
335329tidy : # # Run go mod tidy on every mod file in the repo
336330 go mod tidy
337331 cd ./api && go mod tidy
332+
333+ OPERATOR_NAMESPACE ?= openstack-operators
334+
335+ scale-down-placement-controller-csv :
336+ @echo " Scaling placement-controller-manager to 0 in CSV"
337+ oc patch csv -n $(OPERATOR_NAMESPACE ) placement-operator.v0.0.1 --type json -p=' [{"op": "replace", "path": "/spec/install/spec/deployments/0/spec/replicas", "value": 0}]'
338+ @echo " Removing olm installed webhooks from CSV"
339+ $(eval has_webhooks=$(shell oc get -o json csv placement-operator.v0.0.1 | jq ".spec.webhookdefinitions") )
340+ if [ " $( has_webhooks) " != " null" ]; then \
341+ oc patch csv -n $(OPERATOR_NAMESPACE ) placement-operator.v0.0.1 --type json -p=' [{"op": "remove", "path": "/spec/webhookdefinitions"}]' ; \
342+ fi
0 commit comments