Files
K3S/addons/harbor/role/defaults/main.yml
Sergey Antropoff 5dc0fbcd3a feat: harbor — proxy cache зеркалирование + tag retention policy
Proxy cache (harbor_proxy_cache_enabled: true):
- Автоматически создаёт registry endpoints + proxy cache проекты для:
  docker.io, gcr.io, quay.io, ghcr.io, registry.k8s.io, mcr.microsoft.com, public.ecr.aws
- При pull образа через harbor.example.com/<registry>/<image> он кэшируется
- Реализовано через alpine:3.19 + curl + jq Kubernetes Job (вызывает Harbor REST API изнутри кластера)

Tag retention (harbor_retention_enabled: true, harbor_retention_max_tags: 3):
- Политика "latestPushedN=3" применяется ко ВСЕМ проектам (включая proxy cache)
- Пропускает проекты с уже существующей политикой (idempotent)
- Запуск: ежедневно в 03:00 UTC (cron schedule в Harbor)

Механизм: Job запускается после Helm install, достучивается до harbor-core по
internal service DNS, ждёт API готовности (40 попыток × 15 сек = 10 мин max).
2026-04-25 11:54:43 +03:00

90 lines
3.9 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
harbor_version: "" # "" = автоматически последняя версия чарта
harbor_namespace: "harbor"
harbor_chart_repo: "https://helm.goharbor.io"
# Пароль администратора — задай в vault.yml: vault_harbor_admin_password
harbor_admin_password: "{{ vault_harbor_admin_password | default('Harbor12345') }}"
# Ingress (обязателен — Harbor требует корректный externalURL)
harbor_ingress_enabled: true
harbor_ingress_host: "harbor.local"
harbor_ingress_class: "{{ ingress_nginx_class_name | default('nginx') }}"
harbor_ingress_tls: false
harbor_ingress_cert_issuer: "{{ cert_manager_default_issuer_name | default('letsencrypt-prod') }}"
# Хранилище
harbor_registry_storage_size: "20Gi"
harbor_jobservice_storage_size: "1Gi"
harbor_trivy_storage_size: "5Gi"
harbor_storage_class: "" # "" = default StorageClass
# База данных
# internal — встроенная PostgreSQL (1Gi PVC)
# external — addon_postgresql (автоматически при addon_postgresql: true)
harbor_database_type: "{{ 'external' if addon_postgresql | default(false) | bool else 'internal' }}"
harbor_database_storage_size: "1Gi" # используется только при type: internal
harbor_db_host: "{{ postgresql_external_host | default('') }}"
harbor_db_port: "{{ postgresql_external_port | default(5432) }}"
harbor_db_name: "harbor"
harbor_db_username: "harbor"
harbor_db_password: "{{ vault_harbor_db_password | default('changeme-harbor') }}"
harbor_postgresql_admin_password: "{{ vault_postgresql_postgres_password | default('changeme-postgres') }}"
# Redis — всегда internal (отдельного Redis-аддона нет)
harbor_redis_storage_size: "1Gi"
# Метрики
harbor_metrics_enabled: true
# ServiceMonitor создаётся только когда addon_prometheus_stack: true
# ── Proxy Cache (зеркалирование публичных registry) ───────────────────────────
# При pull образа через Harbor он автоматически кэшируется в Harbor.
# Использование: docker pull harbor.example.com/dockerhub/library/nginx:latest
# ^^^^^^^^^ имя проекта ниже
harbor_proxy_cache_enabled: true
harbor_proxy_cache_registries:
- name: "dockerhub"
description: "Docker Hub"
type: "docker-hub"
url: "https://hub.docker.com"
- name: "gcr"
description: "Google Container Registry"
type: "gcr"
url: "https://gcr.io"
- name: "quay"
description: "Quay.io"
type: "quay"
url: "https://quay.io"
- name: "ghcr"
description: "GitHub Container Registry"
type: "docker-registry"
url: "https://ghcr.io"
- name: "k8s-registry"
description: "Kubernetes Registry (registry.k8s.io)"
type: "docker-registry"
url: "https://registry.k8s.io"
- name: "mcr"
description: "Microsoft Container Registry"
type: "docker-registry"
url: "https://mcr.microsoft.com"
- name: "ecr-public"
description: "Amazon ECR Public Gallery"
type: "docker-registry"
url: "https://public.ecr.aws"
# ── Tag Retention Policy ──────────────────────────────────────────────────────
# Автоматически удалять образы если их больше N штук для одного репозитория.
# Политика применяется ко ВСЕМ проектам (включая proxy cache).
# Запуск: ежедневно в 03:00 UTC.
harbor_retention_enabled: true
harbor_retention_max_tags: 3 # хранить последних N тегов по дате push
harbor_resources:
requests:
cpu: 100m
memory: 256Mi
limits:
cpu: 1000m
memory: 1Gi