apiVersion: apps/v1
kind: Deployment
metadata:
  name: harbor-core
  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.15.0"
    component: core
    app.kubernetes.io/component: core
spec:
  replicas: 2
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      release: harbor
      app: "harbor"
      component: core
  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.15.0"
        component: core
        app.kubernetes.io/component: core
      annotations:
        checksum/configmap: 3a3a6fd7af975efc25037ad550cb4d2cf4ce9f4578a7833e1b9186631fcb7675
        checksum/secret: 7d184289f51bc7b1001e976c80693ff24befaa3ccfb2146ab9c4051b61ae385d
        checksum/secret-jobservice: 388df16a5ce670284aaa57126ada65df238ddadbad14c5aaa94a384592da2e7d
    spec:
      securityContext:
        runAsUser: 10000
        fsGroup: 10000
      automountServiceAccountToken: false
      terminationGracePeriodSeconds: 120
      containers:
        - name: core
          image: ghcr.io/goharbor/harbor-core:v2.15.1@sha256:887a85b8ea98b76bfc9f715f1a0785bb99f9a1034241513902dd6e95be922a83
          imagePullPolicy: IfNotPresent
          startupProbe:
            httpGet:
              path: /api/v2.0/ping
              scheme: HTTP
              port: 8080
            initialDelaySeconds: 10
            periodSeconds: 10
            timeoutSeconds: 1
            failureThreshold: 360
            successThreshold: 1
          livenessProbe:
            httpGet:
              path: /api/v2.0/ping
              scheme: HTTP
              port: 8080
            initialDelaySeconds: 0
            periodSeconds: 10
            timeoutSeconds: 1
            failureThreshold: 2
            successThreshold: 1
          readinessProbe:
            httpGet:
              path: /api/v2.0/ping
              scheme: HTTP
              port: 8080
            initialDelaySeconds: 0
            periodSeconds: 10
            timeoutSeconds: 1
            failureThreshold: 2
            successThreshold: 1
          envFrom:
            - configMapRef:
                name: "harbor-core"
            - secretRef:
                name: "harbor-core"
          env:
            - name: CORE_SECRET
              valueFrom:
                secretKeyRef:
                  name: harbor-secret
                  key: secret
            - name: JOBSERVICE_SECRET
              valueFrom:
                secretKeyRef:
                  name: harbor-secret
                  key: JOBSERVICE_SECRET
            - name: HARBOR_ADMIN_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: harbor-secret
                  key: HARBOR_ADMIN_PASSWORD
            - name: POSTGRESQL_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: harbor-postgresql-18-cluster-app
                  key: password
            - name: REGISTRY_CREDENTIAL_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: harbor-secret
                  key: REGISTRY_PASSWD
            - name: CSRF_KEY
              valueFrom:
                secretKeyRef:
                  name: harbor-secret
                  key: CSRF_KEY
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop:
                - ALL
            privileged: false
            runAsNonRoot: true
            seccompProfile:
              type: RuntimeDefault
          ports:
            - containerPort: 8080
          volumeMounts:
            - name: config
              mountPath: /etc/core/app.conf
              subPath: app.conf
            - name: secret-key
              mountPath: /etc/core/key
              subPath: key
            - name: token-service-private-key
              mountPath: /etc/core/private_key.pem
              subPath: tls.key
            - name: psc
              mountPath: /etc/core/token
      volumes:
        - name: config
          configMap:
            name: harbor-core
            items:
              - key: app.conf
                path: app.conf
        - name: secret-key
          secret:
            secretName: harbor-secret
            items:
              - key: secretKey
                path: key
        - name: token-service-private-key
          secret:
            secretName: harbor-secret
        - name: psc
          emptyDir: {}
