1
0
Fork 0

xactfetch: Use separate CronJobs per bank

Usually, `xactfetch` will only fail for one bank or the other.  Rarely
do we want to redownload the data from both banks just because one
failed.  The latest version of `xactfetch` supports specifying a bank
name as a CLI argument, so now we can define separate jobs for each
bank.  Then, when one Job fails, only that one will be retried later.

It's kind of a bummer that it's so repetitive to define two CronJobs
that differ by only a single command-line argument.  I suppose that's
a good argument for using one of the preprocessor tools like Jsonnet
or KCL.
etcd
Dustin 2024-07-11 22:09:27 -05:00
parent c741d04d54
commit ee00412bf6
1 changed files with 106 additions and 3 deletions

View File

@ -1,9 +1,9 @@
apiVersion: batch/v1 apiVersion: batch/v1
kind: CronJob kind: CronJob
metadata: metadata:
name: xactfetch name: xactfetch-commerce
labels: labels:
app.kubernetes.io/name: xactfetch app.kubernetes.io/name: xactfetch-commerce
app.kubernetes.io/component: xactfetch app.kubernetes.io/component: xactfetch
app.kubernetes.io/part-of: xactfetch app.kubernetes.io/part-of: xactfetch
spec: spec:
@ -15,7 +15,7 @@ spec:
template: template:
metadata: metadata:
labels: labels:
app.kubernetes.io/name: xactfetch app.kubernetes.io/name: xactfetch-commerce
app.kubernetes.io/component: xactfetch app.kubernetes.io/component: xactfetch
app.kubernetes.io/part-of: xactfetch app.kubernetes.io/part-of: xactfetch
spec: spec:
@ -59,6 +59,109 @@ spec:
containers: containers:
- name: xactfetch - name: xactfetch
image: git.pyrocufflink.net/packages/xactfetch image: git.pyrocufflink.net/packages/xactfetch
args:
- commerce
envFrom:
- configMapRef:
name: xactfetch
securityContext:
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /etc/rbw
name: xactfetch-rbw
readOnly: true
- mountPath: /run/secrets/xactfetch
name: xactfetch-secrets
readOnly: true
- mountPath: /tmp
name: tmp
subPath: tmp
- mountPath: /var/lib/xactfetch
name: xactfetch-data
subPath: data
nodeSelector:
kubernetes.io/arch: amd64
securityContext:
fsGroup: 2468
runAsNonRoot: true
volumes:
- name: tmp
emptyDir:
medium: Memory
- name: xactfetch-data
persistentVolumeClaim:
claimName: xactfetch
- name: xactfetch-rbw
configMap:
name: xactfetch-rbw
- name: xactfetch-secrets
secret:
secretName: xactfetch
---
apiVersion: batch/v1
kind: CronJob
metadata:
name: xactfetch-chase
labels:
app.kubernetes.io/name: xactfetch-chase
app.kubernetes.io/component: xactfetch
app.kubernetes.io/part-of: xactfetch
spec:
schedule: 4 9 * * *
timeZone: America/Chicago
concurrencyPolicy: Forbid
jobTemplate:
spec:
template:
metadata:
labels:
app.kubernetes.io/name: xactfetch-chase
app.kubernetes.io/component: xactfetch
app.kubernetes.io/part-of: xactfetch
spec:
restartPolicy: Never
imagePullSecrets:
- name: imagepull-gitea
initContainers:
- name: wait
image: registry.fedoraproject.org/fedora-minimal
command:
- sh
- -c
- case ${HOSTNAME} in *-manual-*);; *)sleep $((RANDOM % 3600));; esac
securityContext:
readOnlyRootFilesystem: true
runAsGroup: 999
runAsUser: 999
- name: sync
image: git.pyrocufflink.net/packages/xactfetch
command:
- rbw
- sync
envFrom:
- configMapRef:
name: xactfetch
securityContext:
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /etc/rbw
name: xactfetch-rbw
readOnly: true
- mountPath: /run/secrets/xactfetch
name: xactfetch-secrets
readOnly: true
- mountPath: /tmp
name: tmp
subPath: tmp
- mountPath: /var/lib/xactfetch
name: xactfetch-data
subPath: data
containers:
- name: xactfetch
image: git.pyrocufflink.net/packages/xactfetch
args:
- chase
envFrom: envFrom:
- configMapRef: - configMapRef:
name: xactfetch name: xactfetch