From 6b6e7210e6cec09f4cd49a304cbda8b4689c558e Mon Sep 17 00:00:00 2001 From: SeanOMik Date: Sat, 8 Apr 2023 22:53:04 -0400 Subject: [PATCH] Add cronjob to clear mylar3 cache --- .../apps/download/mylar3/cache-cronjob.yaml | 31 +++++++++++++++++++ .../apps/download/mylar3/kustomization.yaml | 3 +- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 cluster/apps/download/mylar3/cache-cronjob.yaml diff --git a/cluster/apps/download/mylar3/cache-cronjob.yaml b/cluster/apps/download/mylar3/cache-cronjob.yaml new file mode 100644 index 0000000..74a665d --- /dev/null +++ b/cluster/apps/download/mylar3/cache-cronjob.yaml @@ -0,0 +1,31 @@ +apiVersion: batch/v1 +kind: CronJob +metadata: + name: clear-mylar3-cache + namespace: download +spec: + # 4am every day + schedule: "0 4 * * *" + jobTemplate: + spec: + template: + spec: + containers: + - name: clear-mylar3-cache + image: frolvlad/alpine-bash + imagePullPolicy: IfNotPresent + command: + - /bin/bash + - -c + - find /config/mylar/cache/* -maxdepth 1 ! -name "*.jpg" -delete + volumeMounts: + - name: mylar3-config + mountPath: /config + securityContext: + runAsNonRoot: true + runAsUser: 1000 + restartPolicy: OnFailure + volumes: + - name: mylar3-config + hostPath: + path: /mnt/MainPool/Kubernetes/mylar3 \ No newline at end of file diff --git a/cluster/apps/download/mylar3/kustomization.yaml b/cluster/apps/download/mylar3/kustomization.yaml index ea3145d..ebd0b6f 100644 --- a/cluster/apps/download/mylar3/kustomization.yaml +++ b/cluster/apps/download/mylar3/kustomization.yaml @@ -1,4 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- ./helm-release.yaml \ No newline at end of file +- ./helm-release.yaml +- ./cache-cronjob.yaml \ No newline at end of file