# Source: registry-credential-helper/templates/main.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: registry-credential-helper
  namespace: registry-credential-helper
  labels:
    app: registry-credential-helper
  annotations:

    reloader.stakater.com/auto: "true"
spec:
  replicas: 1
  selector:
    matchLabels:
      app: registry-credential-helper
  template:
    metadata:
      annotations:
        ## add-dep-hash-annotations
        dep.secret.hash/config: "fa63201cebf34e04b1c73fc011dc057c705aadba7dcf1134501f69280aa6ec27"
      labels:
        app: registry-credential-helper
    spec:
      serviceAccountName: registry-credential-helper
      # affinity for best effort to assign pod across nodes
      # ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - weight: 100
              podAffinityTerm:
                labelSelector:
                  matchExpressions:
                    - key: app
                      operator: In
                      values:
                        - registry-credential-helper
                topologyKey: "kubernetes.io/hostname"
      volumes:
        - name: config
          secret:
            secretName: config
      #
      containers:
        - name: registry-credential-helper
          # port
          ports:
            - containerPort: 80
              name: http
          image: "cccfs/registry-credential-helper:v1.5"
          imagePullPolicy: Always
          env:
            - name: "CONFIG_ALLSERVICEACCOUNT"
              value: "true"
            - name: "CONFIG_EXCLUDED_NAMESPACES"
              value: "kube-system"
            - name: "CONFIG_FORCE"
              value: "true"
            - name: "CONFIG_LOOP_DURATION"
              value: "5s"
            - name: "CONFIG_PATH"
              value: "/srv/secrets/config.ini"
          volumeMounts:
            - mountPath: /srv/secrets
              name: config

          # add-resources
          resources:
            # micro-resources

            limits:
              cpu: 100m
              memory: 512Mi
            requests:
              cpu: 10m
              memory: 128Mi
