fix: check for resource existence before scheduling deletion#32216
Open
szubersk wants to merge 1 commit into
Open
fix: check for resource existence before scheduling deletion#32216szubersk wants to merge 1 commit into
szubersk wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a pre-check in waitForDelete to treat already-deleted Kubernetes resources as a no-op instead of attempting to watch them.
Changes:
- Import
k8s.io/apimachinery/pkg/api/errorsto detect NotFound errors. - Skip resources in
waitForDeletewhenGet()returns NotFound, with a debug log.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fix: helm#32214 Signed-off-by: szubersk <[email protected]>
Contributor
|
Thanks @szubersk We're gonna need some test to validate that it is fixing the issue. |
Author
It does - tested in my cluster. Unit-level testing seems too low-level for this kind of problem; I wonder if you guys considered adding integration-level tests (e.g., helm binary against a real k3s cluster). |
thc1006
added a commit
to thc1006/helm
that referenced
this pull request
Jun 24, 2026
WaitForDelete treated a resource as already gone whenever the kstatus watcher reported it as Unknown. But the watcher reports Unknown in two cases: a resource that is genuinely gone, which never emits a delete event, and a resource that still exists but whose status has not synced yet. Treating both as deleted let the watch cancel before any real status arrived, which is the TestStatusWaitForDelete flake in helm#32261. The earlier fix for that flake (helm#32081) deferred that decision, which made already-gone resources wait the full timeout (the hang in helm#32214). It was reverted in v4.2.2, so the flake returned. Check the cluster directly instead. Before watching, a resource that returns NotFound from a live GET is already gone and is skipped, and the observer no longer treats an Unknown status as deleted. Already-gone and never-created resources, such as before-hook-creation hooks, return immediately, while a resource that still exists is waited on until it is actually deleted or the timeout is reached. closes helm#32261 refs helm#32214 refs helm#32216 Signed-off-by: thc1006 <[email protected]>
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.
What this PR does / why we need it:
After upgrading from Helm v4.2.0 to v4.2.1, any helm upgrade --install --wait that deletes a resource and waits for it to be gone sits there for the entire --timeout instead of returning as soon as the resource is actually deleted.
closes: #32214
Special notes for your reviewer:
If applicable:
docs neededlabel should be applied if so)