github.com/Racer159/jackal@v0.32.7-0.20240401174413-0bd2339e4f2e/packages/jackal-registry/chart/templates/hpa.yaml (about)

     1  {{- if .Values.autoscaling.enabled }}
     2  apiVersion: autoscaling/v2
     3  kind: HorizontalPodAutoscaler
     4  metadata:
     5    name: {{ template "docker-registry.fullname" . }}
     6    labels:
     7      app: {{ template "docker-registry.name" . }}
     8      chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
     9      release: {{ .Release.Name }}
    10      heritage: {{ .Release.Service }}
    11  spec:
    12    scaleTargetRef:
    13      apiVersion: apps/v1
    14      kind: Deployment
    15      name: {{ template "docker-registry.fullname" . }}
    16    minReplicas: {{ .Values.autoscaling.minReplicas }}
    17    maxReplicas: {{ .Values.autoscaling.maxReplicas }}
    18    metrics:
    19      - type: Resource
    20        resource:
    21          name: cpu
    22          target:
    23            type: Utilization
    24            averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
    25    behavior:
    26      scaleDown:
    27        # Use 60 second stabilization window becuase jackal will freeze scale down during deploys
    28        stabilizationWindowSeconds: 60
    29        # Initially disable scale down - this gets set to Min later by Jackal (src/test/e2e/20_jackal_init_test.go)
    30        selectPolicy: Disabled
    31        # Scale down one pod per minute
    32        policies:
    33          - type: Pods
    34            value: 1
    35            periodSeconds: 60
    36      scaleUp:
    37        # Delay initial checks by 30 seconds
    38        stabilizationWindowSeconds: 30
    39        # Scale up as much as is needed
    40        selectPolicy: Max
    41        # Scale up one pod per minute
    42        policies:
    43          - type: Pods
    44            value: 1
    45            periodSeconds: 60
    46  {{- end }}