I have one pre-install hook which creates a dynamic PVC and looks like this
kind: PersistentVolumeClaim
metadata:
name: my-dynamic-pv
annotations:
"helm.sh/resource-policy": keep
"helm.sh/hook": "pre-install"
spec:
storageClassName: {{ .Values.persistence.storageClass }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
I want to preserve the same PVC across restarts that's why I have provided "helm.sh/resource-policy": keep
. I am able to create the PVC with the pre-install hook the very first time I start my service. But the subsequent installs/restarts are failing with error Error: persistentvolumeclaims "my-dynamic-pv" already exists
.
Is there a way to ignore this failure and continue with the helm installation?