Skip to content

Commit 2e8363a

Browse files
committed
added an affinity to the cronjob.
1 parent d20d076 commit 2e8363a

2 files changed

Lines changed: 19 additions & 34 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ for pvc in $BLUEAPI_PVCS; do
1313
#checking if its not null
1414
if [ -n "$LAST_USED" ]; then
1515
#check if last_used is older than 3 months
16-
if [ $(($NOW - LAST_USED)) -gt 2628000 ]; then
16+
if [ $(($NOW - LAST_USED)) -gt 7884000 ]; then
1717
#checking if the pvc is protected, if it is protected skip deletion
1818
if [ "$(kubectl get pvc $pvc -n $RELEASE_NAMESPACE -o=jsonpath='{.metadata.annotations.protected}')" = "true" ]; then
1919
echo "PVC $pvc is protected, skipping deletion"

helm/blueapi/templates/cronjob.yaml

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,19 @@ spec:
5454
tolerations:
5555
{{- toYaml . | nindent 12 }}
5656
{{- end }}
57-
57+
{{- with .Values.nodeSelector }}
58+
nodeSelector:
59+
{{- toYaml . | nindent 12 }}
60+
{{- end }}
61+
{{- with .Values.affinity }}
62+
affinity:
63+
{{- toYaml . | nindent 12 }}
64+
{{- end }}
5865
volumes:
59-
- name : {{include "blueapi.fullname" . }}-pvc-stamper-script
66+
- name: {{include "blueapi.fullname" . }}-pvc-stamper-script
6067
configMap:
6168
name: {{include "blueapi.fullname" . }}-pvc-stamper-script
6269
defaultMode: 0555
63-
64-
6570
containers:
6671
- name: last-used-stamper
6772
env:
@@ -75,18 +80,6 @@ spec:
7580
image: bitnami/kubectl:latest
7681
imagePullPolicy: IfNotPresent
7782
command: ["/scripts/time-stamper.sh"]
78-
{{- with .Values.nodeSelector }}
79-
nodeSelector:
80-
{{- toYaml . | nindent 8 }}
81-
{{- end }}
82-
{{- with .Values.affinity }}
83-
affinity:
84-
{{- toYaml . | nindent 8 }}
85-
{{- end }}
86-
{{- with .Values.tolerations }}
87-
tolerations:
88-
{{- toYaml . | nindent 8 }}
89-
{{- end }}
9083
restartPolicy: OnFailure
9184
{{- end }}
9285
{{- if .Values.pvcAutoDeletion.enabled }}
@@ -146,14 +139,19 @@ spec:
146139
tolerations:
147140
{{- toYaml . | nindent 12 }}
148141
{{- end }}
149-
142+
{{- with .Values.nodeSelector }}
143+
nodeSelector:
144+
{{- toYaml . | nindent 12 }}
145+
{{- end }}
146+
{{- with .Values.affinity }}
147+
affinity:
148+
{{- toYaml . | nindent 12 }}
149+
{{- end }}
150150
volumes:
151-
- name : {{include "blueapi.fullname" . }}-pvc-auto-deletion-script
151+
- name: {{include "blueapi.fullname" . }}-pvc-auto-deletion-script
152152
configMap:
153153
name: {{include "blueapi.fullname" . }}-pvc-auto-deletion-script
154154
defaultMode: 0555
155-
156-
157155
containers:
158156
- name: pvc-auto-deletion
159157
env:
@@ -167,18 +165,5 @@ spec:
167165
image: bitnami/kubectl:latest
168166
imagePullPolicy: IfNotPresent
169167
command: ["/scripts/pvc-deletion.sh"]
170-
{{- with .Values.nodeSelector }}
171-
nodeSelector:
172-
{{- toYaml . | nindent 8 }}
173-
{{- end }}
174-
{{- with .Values.affinity }}
175-
affinity:
176-
{{- toYaml . | nindent 8 }}
177-
{{- end }}
178-
{{- with .Values.tolerations }}
179-
tolerations:
180-
{{- toYaml . | nindent 8 }}
181-
{{- end }}
182168
restartPolicy: OnFailure
183-
184169
{{- end }}

0 commit comments

Comments
 (0)