-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove OLM webhooks when running 'make run-with-webhook' #372
Remove OLM webhooks when running 'make run-with-webhook' #372
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: abays The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@@ -87,3 +87,5 @@ webhooks: | |||
EOF_CAT | |||
|
|||
oc apply -n openstack -f ${TMPDIR}/patch_webhook_configurations.yaml | |||
|
|||
oc patch "$(oc get csv -n openstack-operators -l operators.coreos.com/horizon-operator.openstack-operators -o name)" -n openstack-operators --type=json -p="[{'op': 'remove', 'path': '/spec/webhookdefinitions'}]" || true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We document to remove webhooks along with the controller-manager in other operators though, rather than patching the csv in this script. Maybe we make it consistent across operators.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. That was my thinking: replicate the pattern in all operators. But first I wanted to get your feedback on this initial form. Thanks for the review!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rabi What would you think about adding another oc patch
to configure-local-webhooks.sh
to scale-down the CSV's deployment replicas to zero and then changing the comments here [1] to just mention the cleanup (since we will automatically be handling the scale-down and removal of OLM webhooks)? i.e. something like:
# The "configure-local-webhooks.sh" script below will remove any OLM
# webhooks for the operator and also scale its deployment replicas down
# to 0 so that the operator can run locally.
# Make sure to cleanup the webhook configuration for local testing
# before deplying with OLM again, i.e.
# $oc delete -n openstack validatingwebhookconfiguration/vhorizon.kb.io
# $oc delete -n openstack mutatingwebhookconfiguration/mhorizon.kb.io
[1]
Lines 356 to 361 in 506b284
# Please ensure the horizon-controller-manager deployment and | |
# webhook definitions are removed from the csv before running | |
# this. Also, cleanup the webhook configuration for local testing | |
# before deplying with olm again. | |
# $oc delete -n openstack validatingwebhookconfiguration/vhorizon.kb.io | |
# $oc delete -n openstack mutatingwebhookconfiguration/mhorizon.kb.io |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah sounds good, if we're automating it, we should do that as well. For local webhook cleanup there is a script already and we can just mention that. https://github.com/openstack-k8s-operators/horizon-operator/blob/main/hack/clean_local_webhook.sh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
506b284
into
openstack-k8s-operators:main
When using
make run-with-webhook
, local versions of the operator and its webhooks are added to the cluster. If the operator was previously installed via OLM, then there might be lingering webhooks from that installation. We've previously been assuming that the user would manually remove them, but we should just get rid of them ourselves since those OLM webhooks need to be deleted anyhow for the local webhooks to function unimpeded.