-
Notifications
You must be signed in to change notification settings - Fork 38
NO-ISSUE: UPSTREAM: <carry>: Enhance clenup cluster catalog created for webhook… #459
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
NO-ISSUE: UPSTREAM: <carry>: Enhance clenup cluster catalog created for webhook… #459
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: camilamacedo86 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@camilamacedo86: This pull request explicitly references no jira issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
Add AfterAll hook to cleanup leftover ClusterCatalog resource using EnsureCleanupClusterCatalog helper function. Assisted-by: Cursor
337ed7c to
a478980
Compare
| }) | ||
|
|
||
| AfterAll(func(ctx SpecContext) { | ||
| helpers.EnsureCleanupClusterCatalog(ctx, webhookCatalogName) |
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.
I have one concern:
The only way to clean it is with AfterALL
However, can we really use AfterAll with OTE?
If I remember correctly, I read in a comment that it might not work well, which is why it was not added in the first place.
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.
What are you trying to clean up here? The catalogs are not all cleaned up?
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.
For the webhook tests, we create a Catalog.
This Catalog is shared across all tests. That is why we can only clean AfterAll
By design, it was not cleaned up before.
(I am not sure if we can use AfterAll, but if we can, that might be the only way.)
Please see EnsureCleanupClusterCatalog.
This helper makes sure the Catalog is cleaned up:
operator-framework-operator-controller/openshift/tests-extension/pkg/helpers/cluster_catalog.go
Lines 55 to 77 in 9319f22
| func EnsureCleanupClusterCatalog(ctx context.Context, name string) { | |
| k8s := env.Get().K8sClient | |
| cc := &olmv1.ClusterCatalog{} | |
| key := client.ObjectKey{Name: name} | |
| if err := k8s.Get(ctx, key, cc); err != nil { | |
| if !errors.IsNotFound(err) { | |
| fmt.Fprintf(GinkgoWriter, "Warning: failed to get ClusterCatalog %q during cleanup: %v\n", name, err) | |
| } | |
| return | |
| } | |
| By(fmt.Sprintf("deleting lingering ClusterCatalog %q", name)) | |
| if err := k8s.Delete(ctx, cc); err != nil && !errors.IsNotFound(err) { | |
| fmt.Fprintf(GinkgoWriter, "Warning: failed to delete ClusterCatalog %q: %v\n", name, err) | |
| } | |
| Eventually(func() bool { | |
| err := k8s.Get(ctx, key, &olmv1.ClusterCatalog{}) | |
| return errors.IsNotFound(err) | |
| }).WithTimeout(3*time.Minute).WithPolling(2*time.Second). | |
| Should(BeTrue(), "ClusterCatalog %q failed to delete", name) | |
| } |
Why was this not added earlier?
There is some history here:
👉 openshift/origin#30059 (comment)
Because of that, I am not sure if it is completely safe to add now.
I think we need confirm.
So, for now, I would suggest:
- Put this PR on /hold
- It doesn’t seem safe to take the risk before TDB
- Our checks already confirm that everything is cleaned properly
|
/hold |
|
@camilamacedo86: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
Closing this one |


To validate the cleanup of the solution Cursor was used to generate a comprehensive script.
Before the changes

After we cleanup the webhook catalog
See attached the scripts used:
comprehensive_cleanup_validation.sh
output.result.txt