helm: Deletion Policy before-hook-creation does not work as expected
The deletion policy before-hook-creation
does not work when the pod in question is in some “running” state. For example plain Running
but also ContainerCannotRun
when the cluster blocks the execution for some reason like enforced nonRoot.
Whenever another helm test RELEASE
is issued, the command fails with the message `Error: warning: Hook test […]/test-abborted-hook.yaml failed: object is being deleted: pods “rel-test-abort” already exists
Steps to reproduce:
- add this test to any chart and install the chart.
apiVersion: v1
kind: Pod
metadata:
name: "rel-test-abort"
annotations:
"helm.sh/hook": test-success
"helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation
spec:
containers:
- name: test
image: "alpine"
command: ['sh']
args:
- -c
- "sleep 60s"
restartPolicy: Never
-
run
helm test [RELNAME]
and hitCTRL
+C
before the test succeeded -
run
helm test [RELNAME]
again and observe that it fails with “resource already exists”
Expected behaviour: Helm deletes the present resource before creating the new one as it is defined in the docs for the deletion policy before-hook-creation
Output of helm version
:
version.BuildInfo{Version:"v3.0.0-rc.2", GitCommit:"82ea5aa774661cc6557cb57293571d06f94aff0c", GitTreeState:"clean", GoVersion:"go1.13.3"}
Output of kubectl version
:
Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.2", GitCommit:"c97fe5036ef3df2967d086711e6c0c405941e14b", GitTreeState:"clean", BuildDate:"2019-10-17T17:16:09Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.6", GitCommit:"96fac5cd13a5dc064f7d9f4f23030a6aeface6cc", GitTreeState:"clean", BuildDate:"2019-08-19T11:05:16Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
Cloud Provider/Platform (AKS, GKE, Minikube etc.): on prem
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 21 (2 by maintainers)
We are also affected by the bug behind this. We have a pre-install hook for a PVC that has delete-policy before-hook-creation.
The release fails when running
helm delete
andhelm install
in quick succession as there are pods in terminating state that are still using the PVC.I should mention that we are seeing the same error:
Error: failed pre-install: warning: Hook pre-install chart/templates/foo-pvc.yml failed: object is being deleted: persistentvolumeclaims "foo" already exists
Still an issue, running into this as well…
Turns out the new Github notifications features work quite nicely. 😄 I’ve added this to my backlog to investigate.