-
Notifications
You must be signed in to change notification settings - Fork 226
Description
This issue has been identified as a feature request, it's not a bug.
Original issue description:
Describe the bug
When a Flux Kustomization resource is removed from the cluster, the Kubernetes resources managed by that Kustomization remain in the cluster ("orphaned") instead of being deleted.
It appears that the default value for
.spec.deletionPolicy=MirrorPruneis not working as expected to clean up resources upon deletion of the parent object. Explicitly setting.spec.deletionPolicy=Deleteis required to successfully garbage collect the resources.Note that setting
.spec.deletionPolicy: Deletewill not trigger garbage collection if the Kustomization is suspended (.spec.suspend: true) at the time of deletion. The Kustomization must be active for the finalizer to execute the prune logicSteps to reproduce
- Deploy a Flux Kustomization without .spec.deletionPolicy set.
- Observe that resources are synced to the cluster.
- Delete the Kustomization manifest/object.
- Observe that the child resources remain running in the cluster.
Expected behavior
When the Kustomization is deleted, all resources defined in the path should be garbage collected from the cluster.
Screenshots and recordings
No response
OS / Distro
k8s v1.33.9 - Linux 9.6 (Blue Onyx)
Flux version
2.7.3
Flux check
✗ flux 2.7.3 <2.8.1 (new CLI version is available, please upgrade) ✔ Kubernetes 1.33.9 >=1.32.0-0 ► checking version in cluster ✔ distribution: flux-v2.7.3 ✔ bootstrapped: true ► checking controllers ✔ helm-controller: deployment ready ► ghcr.io/fluxcd/helm-controller:v1.4.3 ✔ kustomize-controller: deployment ready ► ghcr.io/fluxcd/kustomize-controller:v1.7.2 ✔ notification-controller: deployment ready ► ghcr.io/fluxcd/notification-controller:v1.7.4 ✔ source-controller: deployment ready ► ghcr.io/fluxcd/source-controller:v1.7.3 ► checking crds ✔ alerts.notification.toolkit.fluxcd.io/v1beta3 ✔ buckets.source.toolkit.fluxcd.io/v1 ✔ externalartifacts.source.toolkit.fluxcd.io/v1 ✔ gitrepositories.source.toolkit.fluxcd.io/v1 ✔ helmcharts.source.toolkit.fluxcd.io/v1 ✔ helmreleases.helm.toolkit.fluxcd.io/v2 ✔ helmrepositories.source.toolkit.fluxcd.io/v1 ✔ kustomizations.kustomize.toolkit.fluxcd.io/v1 ✔ ocirepositories.source.toolkit.fluxcd.io/v1 ✔ providers.notification.toolkit.fluxcd.io/v1beta3 ✔ receivers.notification.toolkit.fluxcd.io/v1 ✔ all checks passed
Git provider
No response
Container Registry provider
No response
Additional context
No response
Code of Conduct
- I agree to follow this project's Code of Conduct