apiVersion: apps/v1
kind: Deployment
metadata:
  name: velero
  labels:
    app.kubernetes.io/name: velero
    component: velero
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: velero
      component: velero
  template:
    metadata:
      labels:
        app.kubernetes.io/name: velero
        component: velero
    spec:
      restartPolicy: Always
      serviceAccountName: velero
      initContainers:
      - image: velero/velero-plugin-for-aws:v1.0.0
        name: velero-plugin-for-aws
        volumeMounts:
        - mountPath: /target
          name: plugins
      - image: velero/velero-plugin-for-gcp:v1.0.0
        name: velero-plugin-for-gcp
        volumeMounts:
        - mountPath: /target
          name: plugins
      - image: velero/velero-plugin-for-microsoft-azure:v1.0.0
        name: velero-plugin-for-azure
        volumeMounts:
        - mountPath: /target
          name: plugins
      containers:
        - name: velero
          image: velero/velero:v1.2.0
          ports:
            - name: monitoring
              containerPort: 8085
          command:
            - /velero
          args:
            - server
          volumeMounts:
            - name: plugins
              mountPath: /plugins
            - name: aws-credentials
              mountPath: /credentials/aws
            - name: google-credentials
              mountPath: /credentials/google
            - name: azure-credentials
              mountPath: /credentials/azure
            - name: scratch
              mountPath: /scratch
          env:
            - name: VELERO_SCRATCH_DIR
              value: /scratch
            - name: VELERO_NAMESPACE
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: metadata.namespace
            - name: AWS_SHARED_CREDENTIALS_FILE
              value: /credentials/aws/cloud
            - name: GOOGLE_APPLICATION_CREDENTIALS
              value: /credentials/google/cloud
            - name: AZURE_CREDENTIALS_FILE
              value: /credentials/azure/cloud
      volumes:
        - name: aws-credentials
          secret:
            secretName: aws-credentials
            optional: true
        - name: google-credentials
          secret:
            secretName: google-credentials
            optional: true
        - name: azure-credentials
          secret:
            secretName: azure-credentials
            optional: true
        - name: plugins
          emptyDir: {}
        - name: scratch
          emptyDir: {}
