I don't see the hooks being called when I destroy a chart. I need it to call them though...can it be enabled?
Which types of hooks are you referring? (We have plenty of them like presync, postsync, cleanup etc
+1
None of the currently supported hooks (prepare, presync, postsync, cleanup) work with destroy.
exactly...no hooks at all work upon destroy
Ah that makes sense! And none of hooks doesn't fit with destroy.
So how about adding the predelete hook?
Not sure about predelete since delete is deprecated. May be predestroy?
May i know whether hooks while 'helmfile destroy' were available? like predestroy/postdestroy?
@vinayr FWIW, delete isn't deprecated. It is just a recommended alias for delete --purge!
@syenduri Not yet. But let's use this issue as a feature request to add predelete.
Ah hook that will be called when running helmfile destroy would be very helpful
+1
predestroy and postdestroy hooks would be great!
will this be implemented in the near future ?
I subscribe to adding predestroy and postdestroy pretty please :)
@mumoshu What about this:
hooks:
- events: ["presync"]
command: "/bin/sh"
args: ["-c", "kubectl get -R -f {{`{{ .Chart.Name }}`}}/crds/ >/dev/null 2>&1 || \
{ helm pull {{`{{ .Release.Chart }}`}} --version {{`{{ .Release.Version }}`}} && tar -Oxzf {{`{{ .Chart.Name }}`}}-{{`{{ .Release.Version }}`}}.tgz {{`{{ .Chart.Name }}`}}/crds/ | kubectl apply -R -f -; }"]
- events: ["postdestroy"]
command: "/bin/sh"
args: ["-c", "kubectl get -R -f {{`{{ .Chart.Name }}`}}/crds/ >/dev/null 2>&1 || \
{ helm pull {{`{{ .Release.Chart }}`}} --version {{`{{ .Release.Version }}`}} && tar -Oxzf {{`{{ .Chart.Name }}`}}-{{`{{ .Release.Version }}`}}.tgz {{`{{ .Chart.Name }}`}}/crds/ | kubectl delete -R --ignore-not-found -f -; }"]
{{ .Chart.Name }} interpolation is not available afaik ( {{ .Release.Name }} will not work in this case, but can be probably replaced by {{ (split \"/\" .Release.Chart)._1 }} )
Related: https://github.com/roboll/helmfile/issues/1124#issuecomment-626771771 https://github.com/roboll/helmfile/issues/1291#issuecomment-648358045
BTW I've named those hooks preuninstall and postuninstall following Helm 3. In Helm 3 helm delete is an alias to helm uninstall
Most helpful comment
I subscribe to adding
predestroyandpostdestroypretty please :)