From 37d39ffa5c1bd5004a1c75276f59b43b67ec54d1 Mon Sep 17 00:00:00 2001 From: Yatin Karel Date: Tue, 21 Apr 2026 16:59:40 +0530 Subject: [PATCH] Use OpenStack CR operatorOverrides to scale down nova operator Switch from CSV-based scaling to using OpenStack CR operatorOverrides feature for scaling down the nova operator. This avoids the need to disable the openstack init operator and provides better integration with the OpenStack operator management system. Signed-off-by: Yatin Karel --- hack/run_with_local_webhook.sh | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/hack/run_with_local_webhook.sh b/hack/run_with_local_webhook.sh index edf927594..c573a89ab 100755 --- a/hack/run_with_local_webhook.sh +++ b/hack/run_with_local_webhook.sh @@ -516,16 +516,14 @@ if [ -n "${CSV_NAME}" ]; then oc patch "${CSV_NAME}" -n openstack-operators --type=json -p="[{'op': 'replace', 'path': '/spec/install/spec/deployments/0/spec/replicas', 'value': 0}]" oc patch "${CSV_NAME}" -n openstack-operators --type=json -p="[{'op': 'replace', 'path': '/spec/webhookdefinitions', 'value': []}]" else - # Handle operator deployed by Openstack Initialization resource - CSV_NAME="$(oc get csv -n openstack-operators -l operators.coreos.com/openstack-operator.openstack-operators -o name)" - - printf \ - "\n\tNow patching openstack operator CSV to scale down deployment resource. - To restore it, use: - oc patch "${CSV_NAME}" -n openstack-operators --type=json -p=\"[{'op': 'replace', 'path': '/spec/install/spec/deployments/0/spec/replicas', 'value': 1}]\"" + if CR_NAME=$(oc get openstack -n openstack-operators -o name); then + printf \ + "\n\tNow patching openstack CR to scale down deployment resource. + To restore it, use: + oc patch ${CR_NAME} -n openstack-operators --type=merge -p '{\"spec\": {\"operatorOverrides\": [{\"name\": \"nova\", \"replicas\": 1}]}}'\n" - oc patch "${CSV_NAME}" -n openstack-operators --type=json -p="[{'op': 'replace', 'path': '/spec/install/spec/deployments/0/spec/replicas', 'value': 0}]" - oc scale --replicas=0 -n openstack-operators deploy/nova-operator-controller-manager + oc patch ${CR_NAME} -n openstack-operators --type=merge -p '{"spec": {"operatorOverrides": [{"name": "nova", "replicas": 0}]}}' + fi fi go run ./cmd/main.go -metrics-bind-address ":${METRICS_PORT}" -health-probe-bind-address ":${HEALTH_PORT}" -pprof-bind-address ":${PPROF_PORT}" -webhook-bind-address "${WEBHOOK_PORT}"