From 8f9ef82fc9c3ad24a54ada9a3ed9639875b14665 Mon Sep 17 00:00:00 2001 From: Plux Stahre Date: Sun, 29 Sep 2024 03:39:22 +0200 Subject: [PATCH 1/4] Update k8s-cronjob.md Fix formatting of yaml example. --- examples/k8s-cronjob.md | 78 ++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 44 deletions(-) diff --git a/examples/k8s-cronjob.md b/examples/k8s-cronjob.md index f42dc14..1c4c739 100644 --- a/examples/k8s-cronjob.md +++ b/examples/k8s-cronjob.md @@ -20,52 +20,42 @@ kind: CronJob metadata: name: fedifetcher spec: - schedule: "*/15 * * * *" - failedJobsHistoryLimit: 5 - successfulJobsHistoryLimit: 5 - concurrencyPolicy: Forbid + schedule: "*/15 * * * *" # Run every 15 minutes + failedJobsHistoryLimit: 5 # Keep history of failed jobs + successfulJobsHistoryLimit: 5 # Keep history of successful jobs + concurrencyPolicy: Forbid # Do not allow concurrent jobs jobTemplate: spec: - template: - spec: - restartPolicy: Never - containers: - - name: fedifetcher - image: ghcr.io/nanos/fedifetcher:latest - imagePullPolicy: IfNotPresent - env: - - name: FF_HOME_TIMELINE_LENGTH - value: "200" - - name: FF_MAX_FOLLOWERS - value: "10" - - # Add any other options below as described in in the README.md file - - # If you don't want to use a PVC you may comment the next two lines, but that will significantly - # affect performance, and is NOT recommended - - name: FF_STATE_DIR - value: "/data/" - - name: FF_SERVER - valueFrom: - secretKeyRef: - name: fedifetcher - key: server_domain - optional: false - - name: FF_ACCESS_TOKEN - valueFrom: - secretKeyRef: - name: fedifetcher - key: token - optional: false - # Comment the lines below if you do not use a PVC, but that will significantly - # affect performance and is NOT recommended - volumeMounts: - - mountPath: /data + template: + spec: + restartPolicy: Never + containers: + - name: fedifetcher + image: ghcr.io/nanos/fedifetcher:latest + imagePullPolicy: IfNotPresent + env: + - name: FF_HOME_TIMELINE_LENGTH + value: "200" + - name: FF_MAX_FOLLOWERS + value: "10" + - name: FF_STATE_DIR + value: "/data/" + - name: FF_SERVER + valueFrom: + secretKeyRef: + name: fedifetcher + key: server_domain + - name: FF_ACCESS_TOKEN + valueFrom: + secretKeyRef: name: fedifetcher - readOnly: false - volumes: - - name: fedifetcher - persistentVolumeClaim: - claimName: fedifetcher + key: token + volumeMounts: + - name: fedifetcher-storage + mountPath: /data + volumes: + - name: fedifetcher-storage + persistentVolumeClaim: + claimName: fedifetcher-pvc ``` From 1bf5615e69837dc4e5c9ee3b5d591ef91f5950c6 Mon Sep 17 00:00:00 2001 From: Plux Stahre Date: Sun, 29 Sep 2024 03:44:30 +0200 Subject: [PATCH 2/4] Update k8s-cronjob.md Add back the explanation comments. --- examples/k8s-cronjob.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/examples/k8s-cronjob.md b/examples/k8s-cronjob.md index 1c4c739..3d3c203 100644 --- a/examples/k8s-cronjob.md +++ b/examples/k8s-cronjob.md @@ -38,6 +38,10 @@ spec: value: "200" - name: FF_MAX_FOLLOWERS value: "10" + # Add any other options below as described in in the README.md file + + # If you don't want to use a PVC you may comment the next two lines, but that will significantly + # affect performance, and is NOT recommended - name: FF_STATE_DIR value: "/data/" - name: FF_SERVER @@ -50,6 +54,8 @@ spec: secretKeyRef: name: fedifetcher key: token + # Comment the lines below if you do not use a PVC, but that will significantly + # affect performance and is NOT recommended volumeMounts: - name: fedifetcher-storage mountPath: /data From 3729f0a0df431c267ac645fe7d6147e85f180844 Mon Sep 17 00:00:00 2001 From: Plux Stahre Date: Sun, 29 Sep 2024 03:46:17 +0200 Subject: [PATCH 3/4] Update k8s-cronjob.md Add an PVC example. --- examples/k8s-cronjob.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/examples/k8s-cronjob.md b/examples/k8s-cronjob.md index 3d3c203..3810e6f 100644 --- a/examples/k8s-cronjob.md +++ b/examples/k8s-cronjob.md @@ -12,6 +12,21 @@ kubectl create secret generic fedifetcher \ --from-literal=token="" ``` +Define a PVC, for example: + +```yaml +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: fedifetcher-pvc +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi +``` + Now define the cronjob, and don't forget to define your PVCs: ```yaml From c7d694d57f08a92dc5ca4bc2a5a5bb532c96c9f9 Mon Sep 17 00:00:00 2001 From: Plux Stahre Date: Fri, 4 Oct 2024 18:36:13 +0200 Subject: [PATCH 4/4] Update k8s-cronjob.md Readd a couple of options that was removed temporarily for testing --- examples/k8s-cronjob.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/k8s-cronjob.md b/examples/k8s-cronjob.md index 3810e6f..cd88fa7 100644 --- a/examples/k8s-cronjob.md +++ b/examples/k8s-cronjob.md @@ -69,11 +69,13 @@ spec: secretKeyRef: name: fedifetcher key: token + optional: false # Comment the lines below if you do not use a PVC, but that will significantly # affect performance and is NOT recommended volumeMounts: - name: fedifetcher-storage mountPath: /data + readOnly: false volumes: - name: fedifetcher-storage persistentVolumeClaim: