fluxcd/flux2

Flux HelmRelease not waiting for pre-delete hook job to get completed before uninstalling

MaharaJothi opened this issue · 2 comments

Describe the bug

I am trying to make use of helm pre-delete hook to clean up certain resources (via Job) before the helm chart is actually uninstalled.
When I run helm uninstall <package-name> the pre-delete hook seems to work fine, that is, the Job gets executed and upon completion the helm chart is uninstalled. However, the same helm chart via HelmRelease runs hook in parallel to helm deletion.

How can I configure HelmRelease to wait for hook to get executed before uninstalling helm chart?
Is it possible to wait for pre-delete hook job to get completed before deleting helm chart in HelmRelease?

Below is my HelmRelease file:

apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  name: test
  namespace: test
spec:
  chart:
    spec:
      chart: test-chart
      interval: 5m
      reconcileStrategy: ChartVersion
      sourceRef:
        kind: HelmRepository
        name: my-repo
        namespace: flux-system
      version: 0.1.0
  install:
    remediation:
      retries: 5
  interval: 5m
  uninstall:
    deletionPropagation: foreground
    disableHooks: false
    disableWait: false
    keepHistory: false
    timeout: 2m
  upgrade:
    remediation:
      remediateLastFailure: true
      retries: 5

Steps to reproduce

  1. Create a helm-chart with pre-delete hook of kind Job
  2. Install helm-chart via HelmRelease in Flux
  3. Delete the HelmRelease file

Expected behavior

Job should get executed and upon completion helm chart should get uninstalled

Screenshots and recordings

No response

OS / Distro

NA

Flux version

flux: v2.1.2

Flux check

NA

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

I think this is a duplicate of: fluxcd/helm-controller#1021

This was fixed in Flux 2.4.0