helm: Helm test --logs fails with hook-delete-policy "hook-failed" or "hook-succeed"

When I execute:

helm test <release> --logs

I get the following error:

unable to get pod logs for <release>: pods "<release>" not found

This only happens, if I set helm.sh/hook-delete-policy to hook-failed or hook-succeeded

While in general, it makes sense that no logs can be retrieved, if the test pod was deleted, in Helm2 this used to work. The logs were retrieved before deletion of the pods.

Output of helm version: version.BuildInfo{Version:“v3.2.0”, GitCommit:“e11b7ce3b12db2941e90399e874513fbd24bcb71”, GitTreeState:“clean”, GoVersion:“go1.13.10”}

Output of kubectl version: Client Version: version.Info{Major:“1”, Minor:“19”, GitVersion:“v1.19.3”, GitCommit:“1e11e4a2108024935ecfcb2912226cedeafd99df”, GitTreeState:“clean”, BuildDate:“2020-10-14T12:50:19Z”, GoVersion:“go1.15.2”, Compiler:“gc”, Platform:“linux/amd64”} Server Version: version.Info{Major:“1”, Minor:“18+”, GitVersion:“v1.18.9-eks-d1db3c”, GitCommit:“d1db3c46e55f95d6a7d3e5578689371318f95ff9”, GitTreeState:“clean”, BuildDate:“2020-10-20T22:18:07Z”, GoVersion:“go1.13.15”, Compiler:“gc”, Platform:“linux/amd64”}

Cloud Provider/Platform (AKS, GKE, Minikube etc.): EKS

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 14
  • Comments: 29 (3 by maintainers)

Commits related to this issue

Most upvoted comments

I also reproduced this issue in the latest version of helm

https://github.com/helm/helm/blob/master/pkg/action/hooks.go#L101-L105

It should be caused by this piece of code. Executing execHook and deleting deleteHookByPolicy are executed in the same method. This logic may be split ideally, so that some other operations can be inserted in the middle, such as get logs

Give me some time, I will try

/assign

Hi, I have submitted a PR a year ago 😉 https://github.com/helm/helm/pull/10603 Someone just needs to look into it!

Still an issue with Helm v3.8.1

Hi @torrescd, the PR should solve the issue. Someone needs to verify and approve it.

For a workaround: I don’t know of any feature how to deactivate the hooks on dependent charts.

Best, Michelle

We can use this “helm.sh/hook-delete-policy” : “before-hook-creation”. It will not delete the job and we can check logs.

Still an issue with Version:“v3.7.0”