Files
amplify-fusion/templates/postdeploy/cleanup-cache.yaml
2026-01-21 17:37:42 +11:00

72 lines
2.8 KiB
YAML

{{- if .Values.postdeploy.enabled }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "postdeploy.appName" . }}-cleanup-cache
labels:
ampint.ddplane: "clean-up-job"
spec:
ttlSecondsAfterFinished: {{ .Values.postdeploy.job_ttl }}
template:
metadata:
labels:
ampint.ddplane: "clean-up-job"
spec:
{{- with .Values.global.image.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.postdeploy.serviceAccount.enabled }}
serviceAccountName: {{ include "postdeploy.serviceAccountName" . }}
{{- end }}
{{- if .Values.postdeploy.podSecurityContextEnabled }}
securityContext: {{- toYaml .Values.postdeploy.podSecurityContext | nindent 8 }}
{{- end }}
containers:
- name: cleanup-cache
securityContext: {{- toYaml .Values.postdeploy.securityContext | nindent 12 }}
image: "{{ default .Values.global.image.repository .Values.global.alpinetools.image.repository }}/{{ .Values.global.alpinetools.image.name }}:{{ .Values.global.alpinetools.image.tag }}"
command:
- "/bin/sh"
- "-c"
- |
if [ -d "/efs/component-cache" ]; then
echo "Deleting deprecated folder /efs/component-cache/!";
rm -rf /efs/component-cache;
fi
if [ -d "/efs/event-cache" ]; then
echo "Deleting deprecated folder /efs/event-cache/!";
rm -rf /efs/event-cache;
fi
if [ -d "/efs/libraries/shared-libraries" ]; then
echo "Deleting deprecated folder /efs/libraries/shared-libraries/!";
rm -rf /efs/libraries/shared-libraries;
fi
if [ -d "/efs/clusters/$clusterRefId/libraries/shared-libraries/" ]; then
echo "Deleting deprecated folder /efs/clusters/$clusterRefId/libraries/shared-libraries/!";
rm -rf /efs/clusters/$clusterRefId/libraries/shared-libraries;
fi
imagePullPolicy: Always
envFrom:
- configMapRef:
name: configmap-common
volumeMounts:
- name: {{ .Values.global.volumeStorageName }}
mountPath: /efs
volumes:
- name: {{ .Values.global.volumeStorageName }}
persistentVolumeClaim:
claimName: {{ .Release.Namespace }}-{{ .Values.global.claimName }}
restartPolicy: Never
{{- with .Values.postdeploy.nodeSelector }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.postdeploy.affinity }}
affinity: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.postdeploy.tolerations }}
tolerations: {{- toYaml . | nindent 8 }}
{{- end -}}
{{- end }}