fix(openshift): delete operator webhooks before namespace cleanup on uninstall#3472
Merged
Conversation
Member
Author
|
/kind bug |
…uninstall During TektonConfig finalization, rbac.cleanUp() updates user namespaces to remove the openshift-pipelines.tekton.dev/namespace-reconcile-version label. The namespace.operator.tekton.dev ValidatingWebhookConfiguration intercepts every namespace update and calls the tekton-operator-proxy-webhook service in openshift-pipelines. When the UI uninstall removes that namespace (and its webhook service) before finalization completes, the webhook call fails and cleanUp() cannot finish, leaving the Subscription, CSV, and operator deployment behind. Fix: explicitly delete namespace.operator.tekton.dev (VWH) and proxy.operator.tekton.dev (MWH) at the start of openshiftExtension.Finalize, before cleanUp() runs. Also propagate the error from extension.Finalize so FinalizeKind retries instead of silently continuing on failure. The ownerRef-based GC introduced in SRVKP-8901 remains as the normal cleanup path; the explicit delete handles the race between namespace termination and finalization. Fixes: SRVKP-12010 Co-authored-by: Cursor <cursoragent@cursor.com>
Member
Author
|
/retest |
Contributor
|
/lgtm |
vdemeester
approved these changes
Jun 8, 2026
Contributor
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: vdemeester The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When uninstalling via the Console UI, `TektonConfig` finalization calls
`rbac.cleanUp()` which updates user namespaces to strip the
`openshift-pipelines.tekton.dev/namespace-reconcile-version` label.
The `namespace.operator.tekton.dev` ValidatingWebhookConfiguration
intercepts every namespace update and calls the
`tekton-operator-proxy-webhook` service in `openshift-pipelines`.
When the UI removes `openshift-pipelines` before finalization completes,
the VWH still exists (GC lag) but the backend service is already gone:
```
Failed to finalize platform resources failed to update namespace default:
failed calling webhook "namespace.operator.tekton.dev":
service "tekton-operator-proxy-webhook" not found
```
Result: finalization stuck → Subscription/CSV never deleted → operator pod,
deployments, CRDs and ClusterRoles remain in `openshift-operators`.
Root cause
The VWH/MWH are owned by the `openshift-pipelines` Namespace (SRVKP-8901)
and are GC'd when it is deleted — but there is a window where the namespace
is Terminating (services gone) while the webhook configs still exist.
`cleanUp()` namespace updates fail during that window.
Fix
Delete `namespace.operator.tekton.dev` (VWH) and `proxy.operator.tekton.dev`
(MWH) at the start of `openshiftExtension.Finalize`, before
`rbac.cleanUp()` runs. `NotFound` is ignored (already GC'd). The
ownerRef-based GC from SRVKP-8901 is kept as the normal cleanup path.
Also propagate errors from `extension.Finalize` in `FinalizeKind` so the
finalizer retries on failure instead of silently continuing.
Testing
Verified on OpenShift 4.20 (AWS) — installed OSP 1.22.2 via OperatorHub,
patched operator image with this fix, triggered UI uninstall. Confirmed:
Unit tests: `TestRemoveOperatorAdmissionWebhooks` (delete both, already-absent, delete-failure).
Fixes: SRVKP-12010
Made with Cursor