apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: restic
  labels:
    component: velero
spec:
  selector:
    matchLabels:
      name: restic
  template:
    metadata:
      labels:
        name: restic
        component: velero
    spec:
      serviceAccountName: velero
      securityContext:
        runAsUser: 0
      volumes:
        - name: host-pods
          hostPath:
            path: /var/lib/kubelet/pods
        - name: scratch
          emptyDir: {}
        - name: cloud-credentials
          secret:
            secretName: cloud-credentials
      containers:
        - name: velero
          image: velero/velero:v1.2.0
          command:
            - /velero
          args:
            - restic
            - server
          volumeMounts:
            - name: host-pods
              mountPath: /host_pods
              mountPropagation: HostToContainer
            - name: scratch
              mountPath: /scratch
            - name: cloud-credentials
              mountPath: /credentials
          env:
            - name: VELERO_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: NODE_NAME
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
            - name: VELERO_SCRATCH_DIR
              value: /scratch
            - name: GOOGLE_APPLICATION_CREDENTIALS
              value: /credentials/cloud
            - name: AWS_SHARED_CREDENTIALS_FILE
              value: /credentials/cloud
            - name: AZURE_CREDENTIALS_FILE
              value: /credentials/cloud
            - name: ALIBABA_CLOUD_CREDENTIALS_FILE
              value: /credentials/cloud
