---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: cloner
  namespace: cloner
spec:
  replicas: 3
  selector:
    matchLabels:
      app.kubernetes.io/name: cloner
  template:
    metadata:
      labels:
        app.kubernetes.io/name: cloner
    spec:
      serviceAccountName: cloner
      containers:
        - name: cloner
          image: imranpochi/cloner:0.0.1
          imagePullPolicy: Always
          command:
          - /cloner
          - --ignore-namespaces=kube-system
          - --enable-leader-election
          - -zap-encoder=console
          resources:
            requests:
              memory: "64Mi"
              cpu: "250m"
            limits:
              memory: "128Mi"
              cpu: "500m"
          env:
            - name: CONTROLLER_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: REGISTRY_PROVIDER
              valueFrom:
                secretKeyRef:
                  name: registry-credentials
                  key: REGISTRY_PROVIDER
            - name: REGISTRY_USERNAME
              valueFrom:
                secretKeyRef:
                  name: registry-credentials
                  key: REGISTRY_USERNAME
            - name: REGISTRY_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: registry-credentials
                  key: REGISTRY_PASSWORD
