---
kind: Deployment
apiVersion: apps/v1
metadata:
  namespace: registry
  name: registry
  labels:
    app: registry

spec:
  replicas: 1
  selector:
    matchLabels:
      app: registry
  template:
    metadata:
      labels:
        app: registry
    spec:
      containers:
        - name: registry
          image: registry:2.7.1
          ports:
            - name: registry
              containerPort: 5000
          volumeMounts:
            - name: credentials
              mountPath: /auth
              readOnly: true
          env:
            - name: REGISTRY_LOG_ACCESSLOG_DISABLED
              value: "true"
            - name: REGISTRY_LOG_LEVEL
              value: info
            - name: REGISTRY_HTTP_SECRET
              value: registry-http-secret
            - name: REGISTRY_AUTH_HTPASSWD_REALM
              value: homelab
            - name: REGISTRY_AUTH_HTPASSWD_PATH
              value: /auth/htpasswd
            - name: REGISTRY_STORAGE
              value: s3
            - name: REGISTRY_STORAGE_S3_REGION
              value: ignored-cos-minio
            - name: REGISTRY_STORAGE_S3_REGIONENDPOINT
              value: https://minio.homelab.io
            - name: REGISTRY_STORAGE_S3_BUCKET
              value: docker-registry
            - name: REGISTRY_STORAGE_DELETE_ENABLED
              value: "true"
            - name: REGISTRY_HEALTH_STORAGEDRIVER_ENABLED
              value: "false"
            - name: REGISTRY_STORAGE_S3_ACCESSKEY
              valueFrom:
                secretKeyRef:
                  name: s3
                  key: REGISTRY_STORAGE_S3_ACCESSKEY
            - name: REGISTRY_STORAGE_S3_SECRETKEY
              valueFrom:
                secretKeyRef:
                  name: s3
                  key: REGISTRY_STORAGE_S3_SECRETKEY
      volumes:
        - name: credentials
          secret:
            secretName: basic-auth
