From 0137bb19534e75d39cec732bff2f9fffc1533990 Mon Sep 17 00:00:00 2001 From: "Waylon S. Walker" Date: Mon, 12 Feb 2024 09:24:03 -0600 Subject: [PATCH] make it a cronjob --- active/cronjob.yaml | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/active/cronjob.yaml b/active/cronjob.yaml index cf3ce8f..2c40f8e 100644 --- a/active/cronjob.yaml +++ b/active/cronjob.yaml @@ -1,22 +1,27 @@ -apiVersion: batch/v1 -kind: Job +apiVersion: batch/v1beta1 +kind: CronJob metadata: - name: timestamp-job + name: timestamp-cronjob spec: - template: - metadata: - name: timestamp-job + schedule: "*/1 * * * *" + jobTemplate: spec: - containers: - - name: timestamp-container - image: busybox - command: ["sh", "-c", "while true; do date >> /logs/runs.log; sleep 60; done"] - volumeMounts: - - name: data - mountPath: /logs - subPath: logs - restartPolicy: Never - volumes: - - name: data - persistentVolumeClaim: - claimName: data + template: + metadata: + labels: + app: timestamp-job + spec: + containers: + - name: timestamp-container + image: busybox + command: ["sh", "-c", "date >> /logs/runs.log"] + volumeMounts: + - name: logs-volume + mountPath: /logs + subPath: logs + restartPolicy: OnFailure + volumes: + - name: logs-volume + persistentVolumeClaim: + claimName: data + subPath: logs