feat(helm): Ability to change the retention on hours

Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>
This commit is contained in:
rjshrjndrn 2024-03-26 18:41:50 +01:00
parent 548930c5be
commit 4b3bbe1e8d
2 changed files with 7 additions and 1 deletions

View file

@ -35,7 +35,11 @@ spec:
set -x
echo "Cleaning NFS strorage for data older than {{.Values.efsCleaner.retention}} days"
storage=`du -sh /mnt/efs`
find /mnt/efs -type f -mtime +{{.Values.efsCleaner.retention}} -exec /bin/bash -c "ls -lah {}; rm {}" \;
{{- $time := mul .Values.efsCleaner.retention 1440 }}
{{- if .Values.efsCleaner.retentionHours }}
{{- $time = mul .Values.efsCleaner.retentionHours 60 }}
{{- end}}
find /mnt/efs -type f -mmin +{{ $time }} -exec /bin/bash -c "ls -lah {}; rm {}" \;
echo "Storage before cleaning"
echo ${storage}
echo "Storage after cleaning"

View file

@ -6,6 +6,8 @@ replicaCount: 1
efsCleaner:
retention: 1
# This value is the new convention, and has priority.
# retentionHours: 12
pvc:
# This can be either persistentVolumeClaim or hostPath.
# In case of pvc, you'll have to provide the pvc name.