Skip to content

Commit d167f3d

Browse files
committed
del s
1 parent caa5a4a commit d167f3d

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

helm/blueapi/files/scripts/pvc-deletion.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
#!/bin/sh
22
# Get all PVCs by running pods
33
ALL_PVCS=$(kubectl get pvc -n $RELEASE_NAMESPACE -o=jsonpath='{.items[*].metadata.name}' | tr ' ' '\n' | sort -u)
4-
Now=$(date +%s)
4+
NOW=$(date +%s)
55
#loop through all pvcs.
66
for pvc in $ALL_PVCS; do
77
#check if pvc has last-used annotation
8-
if get $pvc last-used -n $RELEASE_NAMESPACE -o=jsonpath='{.metadata.annotations.last-used}'
8+
if kubectl get pvc $pvc -n $RELEASE_NAMESPACE -o=jsonpath='{.metadata.annotations.last-used}'
99
then
1010
#get last used annotation and check if it is more than three months ago (2628000 seconds)
11-
LAST_USED=$(get $pvc last-used -n $RELEASE_NAMESPACE -o=jsonpath='{.metadata.annotations.last-used}')
12-
if [ $((NOW - LAST_USED)) -gt 2628000 ]; then
11+
LAST_USED=$(kubectl get pvc $pvc -n $RELEASE_NAMESPACE -o=jsonpath='{.metadata.annotations.last-used}')
12+
if [ $(($NOW - LAST_USED)) -gt 2628000 ]; then
1313
#checking if the pvc is protected, if it is protected skip deletion
14-
if [ get $pvc protected -n $RELEASE_NAMESPACE -o=jsonpath='{.metadata.annotations.protected}' = "true" ]; then
14+
if [ "$(kubectl get pvc $pvc -n $RELEASE_NAMESPACE -o=jsonpath='{.metadata.annotations.protected}')" = "true" ]; then
1515
echo "PVC $pvc is protected, skipping deletion"
1616
continue
1717
fi

helm/blueapi/templates/cronjob.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ spec:
7777
command: ["/scripts/time-stamper.sh"]
7878
restartPolicy: OnFailure
7979
{{- end }}
80-
8180
{{- if .Values.pvcautodeletion.enabled }}
81+
---
8282
apiVersion: v1
8383
kind: ServiceAccount
8484
metadata:

0 commit comments

Comments
 (0)