apiVersion: apps/v1
kind: Deployment
metadata:
  name: "harbor-registry"
  namespace: "harbor"
  labels:
    heritage: Helm
    release: harbor
    chart: harbor
    app: "harbor"
    app.kubernetes.io/instance: harbor
    app.kubernetes.io/name: harbor
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/part-of: harbor
    app.kubernetes.io/version: "2.14.2"
    component: registry
    app.kubernetes.io/component: registry
spec:
  replicas: 1
  revisionHistoryLimit: 10
  strategy:
    type: Recreate
    rollingUpdate: null
  selector:
    matchLabels:
      release: harbor
      app: "harbor"
      component: registry
  template:
    metadata:
      labels:
        heritage: Helm
        release: harbor
        chart: harbor
        app: "harbor"
        app.kubernetes.io/instance: harbor
        app.kubernetes.io/name: harbor
        app.kubernetes.io/managed-by: Helm
        app.kubernetes.io/part-of: harbor
        app.kubernetes.io/version: "2.14.2"
        component: registry
        app.kubernetes.io/component: registry
      annotations:
        checksum/configmap: 09248f8f683f624ab07d08786a9f8aaa38d03fa22c6b81d4ad32c3ddf25509ec
        checksum/secret: 532881bd1d1d6c57ab80f3b04a516655345de38da400ba7e22511f263226bd48
        checksum/secret-jobservice: d997909ea151f04cd3c6ce0da2b1e4b09ab6eecdc3d048c0d3aedf21b23285ba
        checksum/secret-core: ea96175d9d13685272268c622197e7f602ef7f436c55dafd8e625f468586290d
    spec:
      securityContext:
        runAsUser: 10000
        fsGroup: 10000
        fsGroupChangePolicy: OnRootMismatch
      automountServiceAccountToken: false
      terminationGracePeriodSeconds: 120
      containers:
        - name: registry
          image: goharbor/registry-photon:v2.14.2
          imagePullPolicy: IfNotPresent
          livenessProbe:
            httpGet:
              path: /
              scheme: HTTP
              port: 5000
            initialDelaySeconds: 300
            periodSeconds: 10
          readinessProbe:
            httpGet:
              path: /
              scheme: HTTP
              port: 5000
            initialDelaySeconds: 1
            periodSeconds: 10
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop:
                - ALL
            privileged: false
            runAsNonRoot: true
            seccompProfile:
              type: RuntimeDefault
          envFrom:
            - secretRef:
                name: "harbor-registry"
          env:
            - name: REGISTRY_HTTP_SECRET
              valueFrom:
                secretKeyRef:
                  name: harbor-secret
                  key: REGISTRY_HTTP_SECRET
          ports:
            - containerPort: 5000
            - containerPort: 8001
          volumeMounts:
            - name: registry-data
              mountPath: /storage
              subPath:
            - name: registry-htpasswd
              mountPath: /etc/registry/passwd
              subPath: passwd
            - name: registry-config
              mountPath: /etc/registry/config.yml
              subPath: config.yml
        - name: registryctl
          image: goharbor/harbor-registryctl:v2.14.2
          imagePullPolicy: IfNotPresent
          livenessProbe:
            httpGet:
              path: /api/health
              scheme: HTTP
              port: 8080
            initialDelaySeconds: 300
            periodSeconds: 10
          readinessProbe:
            httpGet:
              path: /api/health
              scheme: HTTP
              port: 8080
            initialDelaySeconds: 1
            periodSeconds: 10
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop:
                - ALL
            privileged: false
            runAsNonRoot: true
            seccompProfile:
              type: RuntimeDefault
          envFrom:
            - configMapRef:
                name: "harbor-registryctl"
            - secretRef:
                name: "harbor-registry"
            - secretRef:
                name: "harbor-registryctl"
          env:
            - name: REGISTRY_HTTP_SECRET
              valueFrom:
                secretKeyRef:
                  name: harbor-secret
                  key: REGISTRY_HTTP_SECRET
            - name: CORE_SECRET
              valueFrom:
                secretKeyRef:
                  name: harbor-secret
                  key: secret
            - name: JOBSERVICE_SECRET
              valueFrom:
                secretKeyRef:
                  name: harbor-secret
                  key: JOBSERVICE_SECRET
          ports:
            - containerPort: 8080
          volumeMounts:
            - name: registry-data
              mountPath: /storage
              subPath:
            - name: registry-config
              mountPath: /etc/registry/config.yml
              subPath: config.yml
            - name: registry-config
              mountPath: /etc/registryctl/config.yml
              subPath: ctl-config.yml
      volumes:
        - name: registry-htpasswd
          secret:
            secretName: harbor-secret
            items:
              - key: REGISTRY_HTPASSWD
                path: passwd
        - name: registry-config
          configMap:
            name: "harbor-registry"
        - name: registry-data
          persistentVolumeClaim:
            claimName: harbor-registry
