76 lines
2.2 KiB
YAML
76 lines
2.2 KiB
YAML
# 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
|