apiVersion: apps/v1
kind: Deployment
metadata:
  name: image-mirror
  labels:
    app.kubernetes.io/name: image-mirror
    app.kubernetes.io/instance: default
    app.kubernetes.io/version: 0.0.0
    app.kubernetes.io/managed-by: kustomize
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: image-mirror
      app.kubernetes.io/instance: default
  template:
    metadata:
      labels:
        app.kubernetes.io/name: image-mirror
        app.kubernetes.io/instance: default
        app.kubernetes.io/version: 0.0.0
        app.kubernetes.io/managed-by: kustomize
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/path: "/metrics"
        prometheus.io/port: "8080"
    spec:
      serviceAccountName: image-mirror
      # securityContext:
      #   runAsUser: 0 # TODO: move to own $HOME w/ docker creds
      containers:
        - name: image-mirror
          image: index.docker.io/seankhliao/image-mirror:latest
          imagePullPolicy: IfNotPresent
          # livenessProbe:
          #   httpGet:
          #     path: /healthz
          #     port: 8081
          # readinessProbe:
          #   httpGet:
          #     path: /readyz
          #     port: 8081
          resources:
            limits:
              cpu: 100m
              memory: 500Mi
            requests:
              cpu: 10m
              memory: 50Mi
          volumeMounts:
            - mountPath: /root/.docker
              name: dockerconfig
      volumes:
        - name: dockerconfig
          secret:
            secretName: image-mirror-creds
            items:
              - key: .dockerconfigjson
                path: config.json
