diff --git a/scripts/helmcharts/openreplay/charts/utilities/templates/efs-cron.yaml b/scripts/helmcharts/openreplay/charts/utilities/templates/efs-cron.yaml index d859489b5..25babae06 100644 --- a/scripts/helmcharts/openreplay/charts/utilities/templates/efs-cron.yaml +++ b/scripts/helmcharts/openreplay/charts/utilities/templates/efs-cron.yaml @@ -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" diff --git a/scripts/helmcharts/openreplay/charts/utilities/values.yaml b/scripts/helmcharts/openreplay/charts/utilities/values.yaml index f383097ab..2266708ca 100644 --- a/scripts/helmcharts/openreplay/charts/utilities/values.yaml +++ b/scripts/helmcharts/openreplay/charts/utilities/values.yaml @@ -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.