maintenance: add restic init job

This commit is contained in:
Brad Stein 2026-02-06 03:48:45 -03:00
parent a6ceaa4cf1
commit e463674ca9
2 changed files with 76 additions and 0 deletions

View File

@ -20,6 +20,7 @@ resources:
- oneoffs/ariadne-migrate-job.yaml
- ariadne-service.yaml
- soteria-deployment.yaml
- soteria-restic-init-job.yaml
- disable-k3s-traefik-daemonset.yaml
- oneoffs/k3s-traefik-cleanup-job.yaml
- node-nofile-daemonset.yaml

View File

@ -0,0 +1,75 @@
# services/maintenance/soteria-restic-init-job.yaml
apiVersion: batch/v1
kind: Job
metadata:
name: soteria-restic-init
namespace: maintenance
labels:
app: soteria
app.kubernetes.io/name: soteria
app.kubernetes.io/component: restic-init
spec:
backoffLimit: 0
ttlSecondsAfterFinished: 300
template:
metadata:
labels:
app: soteria
app.kubernetes.io/name: soteria
app.kubernetes.io/component: restic-init
spec:
restartPolicy: Never
containers:
- name: restic
image: restic/restic:0.16.4
imagePullPolicy: IfNotPresent
command: ["/bin/sh", "-c"]
args:
- >
set -euo pipefail;
if restic snapshots >/dev/null 2>&1; then
echo "restic repo already initialized";
else
restic init;
fi
env:
- name: RESTIC_REPOSITORY
valueFrom:
configMapKeyRef:
name: soteria
key: SOTERIA_RESTIC_REPOSITORY
- name: RESTIC_PASSWORD
valueFrom:
secretKeyRef:
name: soteria-restic
key: RESTIC_PASSWORD
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: soteria-restic
key: AWS_ACCESS_KEY_ID
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: soteria-restic
key: AWS_SECRET_ACCESS_KEY
- name: RESTIC_S3_ENDPOINT
valueFrom:
configMapKeyRef:
name: soteria
key: SOTERIA_S3_ENDPOINT
- name: AWS_ENDPOINT
valueFrom:
configMapKeyRef:
name: soteria
key: SOTERIA_S3_ENDPOINT
- name: AWS_REGION
valueFrom:
configMapKeyRef:
name: soteria
key: SOTERIA_S3_REGION
- name: AWS_DEFAULT_REGION
valueFrom:
configMapKeyRef:
name: soteria
key: SOTERIA_S3_REGION