mirror of https://github.com/helm/helm
When `helm uninstall --wait` is called, the default deletion propagation is now "foreground" instead of "background". This ensures dependent resources (like Pods, ReplicaSets created by controllers) are fully cleaned up before the command returns. Previously, with background deletion, parent resources were deleted immediately while garbage collection handled dependents asynchronously. This caused subsequent namespace deletions to hang for 2+ minutes waiting for those dependent resources to be cleaned up. With foreground deletion, Kubernetes waits for all dependents to be deleted before removing the parent resource, ensuring `--wait` truly waits for all cleanup to complete. Cascade behavior by command: | Command | Cascade | |----------------------------------------------|------------| | `helm uninstall release` | background | | `helm uninstall release --wait` | foreground | | `helm uninstall release --wait=hookOnly` | background | | `helm uninstall release --wait --cascade=background` | background | Users can still explicitly set `--cascade=background` to restore the previous behavior if needed. Fixes #31651 Signed-off-by: Evans Mungai <mbuevans@gmail.com>pull/31658/head
parent
4d1150d2af
commit
5895a7e8f9
@ -0,0 +1,39 @@
|
||||
/*
|
||||
Copyright The Helm Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"helm.sh/helm/v4/pkg/kube"
|
||||
)
|
||||
|
||||
// CapturingKubeClient is a fake KubeClient that captures internal flags such as the
|
||||
// deletion propagation policy. It extends FailingKubeClient to provide dummy resources.
|
||||
type CapturingKubeClient struct {
|
||||
FailingKubeClient
|
||||
// CapturedDeletionPropagation stores the DeletionPropagation value passed to Delete
|
||||
CapturedDeletionPropagation *string
|
||||
}
|
||||
|
||||
// Delete captures the deletion propagation policy and returns success
|
||||
func (c *CapturingKubeClient) Delete(resources kube.ResourceList, policy metav1.DeletionPropagation) (*kube.Result, []error) {
|
||||
if c.CapturedDeletionPropagation != nil {
|
||||
*c.CapturedDeletionPropagation = string(policy)
|
||||
}
|
||||
return &kube.Result{Deleted: resources}, nil
|
||||
}
|
||||
Loading…
Reference in new issue