apiVersion: apps/v1
kind: Deployment
metadata:
  name: velero
  labels:
    component: velero
spec:
  replicas: 1
  selector:
    matchLabels:
      deploy: velero
  template:
    metadata:
      labels:
        deploy: 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
      containers:
        - name: velero
          image: velero/velero:v1.2.0
          ports:
            - name: monitoring
              containerPort: 8085
          command:
            - /velero
          args:
            - server
          volumeMounts:
            - name: plugins
              mountPath: /plugins
            - name: scratch
              mountPath: /scratch
            - name: cloud-credentials
              mountPath: /credentials
          env:
            - name: VELERO_SCRATCH_DIR
              value: /scratch
            - name: VELERO_NAMESPACE
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: metadata.namespace
            - name: LD_LIBRARY_PATH
              value: /plugins
            - name: AWS_SHARED_CREDENTIALS_FILE
              value: /credentials/cloud
            - name: GOOGLE_APPLICATION_CREDENTIALS
              value: /credentials/cloud
            - name: AZURE_CREDENTIALS_FILE
              value: /credentials/cloud
            - name: ALIBABA_CLOUD_CREDENTIALS_FILE
              value: /credentials/cloud
          resources:
            requests:
              cpu: 500m
              memory: 128Mi
            limits:
              cpu: 1000m
              memory: 256Mi

      volumes:
        - name: plugins
          emptyDir: {}
        - name: scratch
          emptyDir: {}
        - name: cloud-credentials
          secret:
            secretName: cloud-credentials
