Skip to content

Commit bd32176

Browse files
Merge pull request #288 from karelyatin/openstack_init_resource
[run-with-webhook] Handle operator deploy by Openstack initialization
2 parents 5834ecd + 8f28875 commit bd32176

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

hack/run_with_local_webhook.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,17 @@ if [ -n "${CSV_NAME}" ]; then
148148

149149
oc patch "${CSV_NAME}" -n openstack-operators --type=json -p="[{'op': 'replace', 'path': '/spec/install/spec/deployments/0/spec/replicas', 'value': 0}]"
150150
oc patch "${CSV_NAME}" -n openstack-operators --type=json -p="[{'op': 'replace', 'path': '/spec/webhookdefinitions', 'value': []}]"
151+
else
152+
# Handle operator deployed by Openstack Initialization resource
153+
CSV_NAME="$(oc get csv -n openstack-operators -l operators.coreos.com/openstack-operator.openstack-operators -o name)"
154+
155+
printf \
156+
"\n\tNow patching openstack operator CSV to scale down deployment resource.
157+
To restore it, use:
158+
oc patch "${CSV_NAME}" -n openstack-operators --type=json -p=\"[{'op': 'replace', 'path': '/spec/install/spec/deployments/0/spec/replicas', 'value': 1}]\""
159+
160+
oc patch "${CSV_NAME}" -n openstack-operators --type=json -p="[{'op': 'replace', 'path': '/spec/install/spec/deployments/0/spec/replicas', 'value': 0}]"
161+
oc scale --replicas=0 -n openstack-operators deploy/openstack-baremetal-operator-controller-manager
151162
fi
152163

153164
go run ./main.go -metrics-bind-address ":${METRICS_PORT}" -health-probe-bind-address ":${HEALTH_PORT}"

0 commit comments

Comments
 (0)