forked from mtusi2026/mtusi2026lab3
34 lines
777 B
YAML
34 lines
777 B
YAML
{{- if .Values.autoscaling.enabled }}
|
|
apiVersion: autoscaling/v2
|
|
kind: HorizontalPodAutoscaler
|
|
metadata:
|
|
name: api
|
|
spec:
|
|
scaleTargetRef:
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
name: api
|
|
minReplicas: {{ .Values.autoscaling.minReplicas }}
|
|
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
|
|
metrics:
|
|
- type: Resource
|
|
resource:
|
|
name: cpu
|
|
target:
|
|
type: Utilization
|
|
averageUtilization: {{ .Values.autoscaling.cpuPercent }}
|
|
behavior:
|
|
scaleUp:
|
|
stabilizationWindowSeconds: 15
|
|
policies:
|
|
- type: Pods
|
|
value: 1
|
|
periodSeconds: 30
|
|
scaleDown:
|
|
stabilizationWindowSeconds: 120
|
|
policies:
|
|
- type: Pods
|
|
value: 1
|
|
periodSeconds: 60
|
|
{{- end }}
|