apiVersion: apps/v1
kind: Deployment
metadata:
  name: docker-mirror-proxy
spec:
  selector:
    matchLabels:
      app: docker-mirror-proxy
  replicas: 1
  template:
    metadata:
      labels:
        app: docker-mirror-proxy
    spec:
      terminationGracePeriodSeconds: 180
      serviceAccountName: "caches"
      nodeSelector:
        type: bare-metal-external
        ci.kubevirt.io/cachenode: "true"
      tolerations:
      - key: "cachenode"
        operator: "Exists"
        effect: "NoSchedule"
      containers:
      - name: mirror-proxy
        image: rpardini/docker-registry-proxy:0.6.2
        env:
        - name: ENABLE_MANIFEST_CACHE
          value: "true"
        - name: ALLOW_PUSH
          value: "true"
        - name: PROXY_CONNECT_TIMEOUT
          value: "1200s"
        - name: PROXY_CONNECT_READ_TIMEOUT
          value: "1200s"
        - name: PROXY_CONNECT_CONNECT_TIMEOUT
          value: "1200s"
        - name: PROXY_CONNECT_SEND_TIMEOUT
          value: "1200s"
        - name: SEND_TIMEOUT
          value: "1200s"
        - name: CLIENT_BODY_TIMEOUT
          value: "1200s"
        - name: CLIENT_HEADER_TIMEOUT
          value: "1200s"
        - name: PROXY_READ_TIMEOUT
          value: "1200s"
        - name: PROXY_CONNECT_TIMEOUT
          value: "1200s"
        - name: PROXY_SEND_TIMEOUT
          value: "1200s"
        volumeMounts:
        - name: storage
          mountPath: /docker_mirror_cache
        - name: ca-public
          mountPath: /ca/ca.crt
          subPath: ca.crt
          readOnly: true
        - name: ca-private
          mountPath: /ca/ca.key
          subPath: ca.key
          readOnly: true
        ports:
          - name: http
            containerPort: 3128
        resources:
          requests:
            memory: 3Gi
          limits:
            memory: 3Gi
      volumes:
      - name: ca-public
        configMap:
          name: mirror-proxy-config
      - name: ca-private
        secret:
          secretName: docker-mirror-proxy
      - name: storage
        hostPath:
          path: /var/lib/docker-mirror/proxy
