apiVersion: apps/v1
kind: Deployment
metadata:
  name: image-clone-controller
  namespace: image-clone-controller
  labels:
    app: image-clone-controller
spec:
  replicas: 1
  selector:
    matchLabels:
      app: image-clone-controller
  template:
    metadata:
      name: image-clone-controller
      labels:
        app: image-clone-controller
    spec:
      containers:
        - name: controller
          image: ghcr.io/mbtamuli/image-clone-controller:0.0.1
          imagePullPolicy: IfNotPresent
          args:
            - -registry=$(REGISTRY)
            - -registry-username=$(REGISTRY_USERNAME)
            - -registry-password=$(REGISTRY_PASSWORD)
            - -exclude-namespaces="kube-system,local-path-storage,image-clone-controller"
          resources:
            limits:
              memory: 50Mi
              cpu: 300m
            requests:
              memory: 00Mi
              cpu: 300m
          env:
            - name: REGISTRY
              valueFrom:
                secretKeyRef:
                  name: registry-cred
                  key: registry
            - name: REGISTRY_USERNAME
              valueFrom:
                secretKeyRef:
                  name: registry-cred
                  key: registry-username
            - name: REGISTRY_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: registry-cred
                  key: registry-password
      serviceAccountName: controller
