# Forgejo Horizontal Pod Autoscaler # RFC 0040: Self-Hosted Core Services # ADR 0004: Set It and Forget It - auto-scaling required apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: forgejo namespace: forgejo labels: app.kubernetes.io/name: forgejo app.kubernetes.io/part-of: core-services spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: forgejo minReplicas: 2 maxReplicas: 10 metrics: # Scale on CPU utilization - type: Resource resource: name: cpu target: type: Utilization averageUtilization: 70 # Scale on memory utilization - type: Resource resource: name: memory target: type: Utilization averageUtilization: 80 behavior: scaleUp: stabilizationWindowSeconds: 60 policies: - type: Pods value: 2 periodSeconds: 60 scaleDown: # Conservative scale-down stabilizationWindowSeconds: 300 policies: - type: Pods value: 1 periodSeconds: 120