How goharbor/harbor-helm works
Project Type and Purpose
• This is a Kubernetes Helm chart whose purpose is to deploy the full Harbor registry stack in a Kubernetes cluster. It is an “infrastructure-as-code” project that templatizes and configures multiple microservices (Core, Portal, Registry, Jobservice, Trivy, Exporter, Nginx, Database, Redis, etc.) along with their Services, StatefulSets, Deployments, ConfigMaps, Secrets, PVCs, and Ingress/LoadBalancer exposures.
File Structure Highlights
• Chart.yaml & values.yaml: chart metadata and default configuration.
• templates/…: subdirectories for each component (core, database, registry, portal, jobservice, trivy, exporter, nginx, ingress, etc.).
• templates/*-cm.yaml: ConfigMaps for environment variables or configuration.
• templates/*-dpl.yaml or *-sts.yaml: Deployments or StatefulSets for each service.
• templates/*-svc.yaml: Kubernetes Services exposing components internally.
• templates/*-pvc.yaml: PersistentVolumeClaims for stateful data (registry storage, database, Redis, job logs, Trivy cache).
• docs/: guidance on high availability, upgrades.
• .github/workflows: CI tests (lint, unit, integration, e2e).
README Insights
• Describes prerequisites (K8s 1.20+, Helm 3.2+).
• Explains how to configure service exposure (Ingress, ClusterIP, NodePort, LoadBalancer).
• Enumerates every configurable parameter, revealing the architectural pieces (internal TLS, persistence backend, metrics, tracing).
a. Main Components
• External Traffic Layer: Ingress Controller (or LoadBalancer) → optional Nginx reverse-proxy Deployment.
• Harbor Core Stack:
• Core API Pods (Deployment + Service)
• Portal UI Pods (Deployment + Service)
• Jobservice Pods (Deployment + Service)
• Registry Pods (StatefulSet + Service) + Registry-Controller (registryctl)
• Trivy Adapter Pods (StatefulSet + Service)
• Exporter Pods (Deployment + Service)
• Backing Data Stores:
• PostgreSQL (StatefulSet + Service + PVC)
• Redis (StatefulSet + Service + PVC)
• Supporting Objects:
• ConfigMaps & Secrets (for TLS certs, env vars, credentials)
• PersistentVolumeClaims (registry data, DB, Redis, job logs, Trivy cache)
• Observability (optional):
• Metrics ServiceMonitor & Prometheus
• Tracing (Jaeger or OpenTelemetry)
b. Relationships & Data Flows
• Users → Ingress/LoadBalancer → (optional) Nginx → Portal UI & Core API
• Portal UI ↔ Core API
• Core API ↔ Database (PostgreSQL)
• Core API ↔ Redis (session/cache, quota provider)
• Core API → Registry Service (for image pushes/pulls)
• Registry Service → PVC (object storage)
• Core API ↔ Jobservice (async jobs such as garbage-collection, replication)
• Trivy Pod ↔ Registry Service (to scan images)
• Exporter Pod → harvest metrics from Core, Registry, etc. → Prometheus
• All internal mTLS connections if internalTLS.enabled
c. Architectural Patterns & Principles
• Microservices: each Harbor component runs in its own Deployment/StatefulSet.
• Statefulsets for services requiring stable network IDs and storage (DB, Redis, Registry, Trivy).
• Twelve-Factor config: use ConfigMaps & Secrets for environment and credentials.
• High-availability: configurable replicas, StatefulSet partitioning, persistence policies.
• Clear separation of control plane (Core, Portal, Jobservice) vs. data plane (Registry, PVC).
• Observability hooks (metrics, tracing) as first-class integrations.
d. Key Technologies & Frameworks
• Helm v3 chart templating
• Kubernetes primitives (Deployments, StatefulSets, Services, Ingresses, PVCs)
• PostgreSQL & Redis running as in-cluster services
• Trivy for vulnerability scanning
• Prometheus + ServiceMonitor for metrics
• Optional: Jaeger/OpenTelemetry for tracing