Repository navigation
Description
Output of helm version: version.BuildInfo{Version:"v3.6.0", GitCommit:"7f2df6467771a75f5646b7f12afb408590ed1755", GitTreeState:"clean", GoVersion:"go1.16.3"}
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:"darwin/amd64"} Server Version: version.Info{Major:"1", Minor:"17+", GitVersion:"v1.17.17-eks-087e67", GitCommit:"087e67e479962798594218dc6d99923f410c145e", GitTreeState:"clean", BuildDate:"2021-07-31T01:39:55Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}
Cloud Provider/Platform (AKS, GKE, Minikube etc.): AWS / EKS
This looks to be the same issue as this which was closed due to inactivity. That issue is for on helm 2, but I believe the same issue persists on helm 3.
Let's say I have 2 Job resources that i want to run during the helm test hook. I set both of them with "helm.sh/hook-delete-policy": "hook-succeeded,hook-failed".
Now if both succeed, they are both deleted. Perfect.
But, if the first one succeeds and the second one fails, then the first one is never deleted.
From looking at the code, it looks like if all hook resources succeed, we delete all of the ones with hook-succeeded at the very end of the process. But, if one of them fails, we only delete that 1 resource and immediately return with the error.
This isn't what I would expect, and believe it's probably not what most people would want.
In the case of Job resources specifically, this isn't much of an issue cause we can just set the ttlSecondsAfterFinished. But for things like Deployment resources, it causes more problems cause you end up with running pods sticking around when you don't want them to.
Here's a relatively simple demonstration.
apiVersion: batch/v1
kind: Job
metadata:
name: "successful-job"
labels:
"app": "hook-testing"
annotations:
"helm.sh/hook": "test"
"helm.sh/hook-weight": "1"
"helm.sh/hook-delete-policy": "hook-succeeded,hook-failed"
spec:
template:
spec:
restartPolicy: Never
containers:
- name: "successful-job"
command:
- bash
- -c
- exit 0
image: bash:latest
---
apiVersion: batch/v1
kind: Job
metadata:
name: "failure-job"
labels:
"app": "hook-testing"
annotations:
"helm.sh/hook": "test"
"helm.sh/hook-weight": "2"
"helm.sh/hook-delete-policy": "hook-succeeded,hook-failed"
spec:
backoffLimit: 0
template:
spec:
restartPolicy: Never
containers:
- name: "failure-job"
command:
- bash
- -c
- exit 1
image: bash:latest
---
apiVersion: v1
kind: Pod
metadata:
name: "non-hook-pod"
labels:
"app": "hook-testing"
spec:
containers:
- name: "sleeping-pod"
command:
- bash
- -c
- while :; do sleep 1; done
image: bash:latest
Activity
zonggen commentedon Nov 9, 2021
I can reproduce the behavior on:
version.BuildInfo{Version:"v3.7.1", GitCommit:"1d11fcb5d3f3bf00dbe6fe31b8412839a96b3dc4", GitTreeState:"dirty", GoVersion:"go1.16.6"}, Cloud Provider/Platform (AKS, GKE, Minikube etc.): Minikube.Steps to reproduce:
helm create issue-10279tests/test-connection.yamlwith above job definition.helm install issue-10279 .helm test issue-10279github-actions commentedon Feb 8, 2022
This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs.
himanshu-trilio commentedon Mar 28, 2022
hit the same issue and still reproducible
himanshu-trilio commentedon Mar 28, 2022
can we reopen this ticket and get this bug resolved? @bacongobbler
bacongobbler commentedon Mar 28, 2022
Hi @himanshu-trilio, we’d welcome a patch to fix this behaviour. Please feel free to submit something.
himanshu-trilio commentedon Apr 4, 2022
@bacongobbler patch fix for the above issue is created by @prafull01 . can we get that reviewed and merged quick?
prafull01 commentedon Apr 6, 2022
@bacongobbler I have raised a PR to fix this behaviour. Kindly review.
github-actions commentedon Jul 6, 2022
This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs.
fschmied commentedon Oct 30, 2022
@bacongobbler @hickeyma Would it be possible to reopen this issue (and mark it not stale) as long as the bug is still not fixed? That would enable us to subscribe to the issue in order to be notified when it is fixed.
github-actions commentedon Feb 7, 2023
This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs.
jerryguowei commentedon Feb 29, 2024
Is there any progress on this issue. its causing the resource not deleted when any failures in my cluster.
jtackaberry commentedon May 29, 2024
AFAICT #11334 is the fix but that has stalled out