apiVersion: batch/v1
kind: Job
metadata:
  name: baas-init
spec:
  parallelism: 1
  completions: 1
  template:
    metadata:
      name: baas
    spec:
      containers:
        - name: baas
          image: 172.30.1.1:5000/myproject/baas:latest
          command:
            - restic
            - init
          env:
          - name: AWS_SECRET_ACCESS_KEY
            valueFrom:
              secretKeyRef:
                name: baas
                key: AWS_SECRET_ACCESS_KEY
          - name: AWS_ACCESS_KEY_ID
            valueFrom:
              secretKeyRef:
                name: baas
                key: AWS_ACCESS_KEY_ID
          - name: RESTIC_PASSWORD
            valueFrom:
              secretKeyRef:
                name: baas
                key: RESTIC_PASSWORD
          - name: RESTIC_REPOSITORY
            value: s3:https://objects.cloudscale.ch/restic1/baas
          - name: RESTIC_TAG
            value: latest
          - name: XDG_CACHE_DIR
            value: /tmp
      restartPolicy: OnFailure
