# Gitea Helm values for Production environment
# This file overrides values.yaml for production deployment
#
# Installation:
#   helm upgrade --install gitea gitea/gitea -n gitea \
#     -f infrastructure/cicd/gitea/values.yaml \
#     -f infrastructure/cicd/gitea/values-prod.yaml

ingress:
  enabled: true
  className: nginx
  annotations:
    nginx.ingress.kubernetes.io/ssl-redirect: "true"
    nginx.ingress.kubernetes.io/proxy-body-size: "2G"
    nginx.ingress.kubernetes.io/proxy-connect-timeout: "600"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "600"
    cert-manager.io/cluster-issuer: "letsencrypt-production"
  hosts:
    - host: gitea.bakewise.ai
      paths:
        - path: /
          pathType: Prefix
    - host: registry.bakewise.ai
      paths:
        - path: /
          pathType: Prefix
  tls:
    - secretName: gitea-tls-cert
      hosts:
        - gitea.bakewise.ai
        - registry.bakewise.ai

# NOTE: The Gitea Helm chart (v12.4.0) does not natively support separate registry ingress.
# For registry access, we include registry.bakewise.ai in the main ingress above.
# This works because Gitea serves both UI and registry on the same port (3000).

gitea:
  admin:
    email: admin@bakewise.ai
  config:
    server:
      DOMAIN: gitea.bakewise.ai
      SSH_DOMAIN: gitea.bakewise.ai
      ROOT_URL: https://gitea.bakewise.ai

    # =============================================================================
    # PACKAGE/REGISTRY RETENTION POLICY
    # =============================================================================
    # Automatic cleanup of old container images and packages
    # This prevents the registry from growing indefinitely
    packages:
      ENABLED: true
      # Limit container image versions to prevent storage bloat
      # 0 = unlimited (default), set a reasonable limit for CI/CD
      LIMIT_TOTAL_OWNER_SIZE: 10737418240  # 10GB per owner/organization
      LIMIT_SIZE_CONTAINER: 2147483648      # 2GB per container image

    # Cron job for automatic package cleanup
    cron:
      ENABLED: true
    "cron.cleanup_packages":
      ENABLED: true
      # Run daily at 3 AM
      SCHEDULE: "0 3 * * *"
      # Keep packages newer than this (in hours) - 168h = 7 days
      OLDER_THAN: 168h
      # Number of versions to keep per package (0 = disabled)
      # This keeps the last 5 versions regardless of age
      NUMBER_TO_KEEP: 5
      # Also clean up unreferenced blobs
      REMOVE_UNUSED_ARTIFACTS: true

# Production resources - adjust based on expected load
resources:
  limits:
    cpu: 1000m
    memory: 1Gi
  requests:
    cpu: 200m
    memory: 512Mi

# Larger storage for production
persistence:
  size: 50Gi