| 1234567891011121314151617181920212223242526272829303132333435 |
- {{- range $name, $component := .Values.components }}
- {{- if $component.autoscaling.enabled }}
- ---
- apiVersion: autoscaling/v2
- kind: HorizontalPodAutoscaler
- metadata:
- name: {{ include "chart.componentFullname" (dict "root" $ "name" $name) }}
- labels:
- {{- include "chart.componentLabels" (dict "root" $ "name" $name) | nindent 4 }}
- spec:
- scaleTargetRef:
- apiVersion: apps/v1
- kind: Deployment
- name: {{ include "chart.componentFullname" (dict "root" $ "name" $name) }}
- minReplicas: {{ $component.autoscaling.minReplicas }}
- maxReplicas: {{ $component.autoscaling.maxReplicas }}
- metrics:
- {{- if $component.autoscaling.targetCPUUtilizationPercentage }}
- - type: Resource
- resource:
- name: cpu
- target:
- type: Utilization
- averageUtilization: {{ $component.autoscaling.targetCPUUtilizationPercentage }}
- {{- end }}
- {{- if $component.autoscaling.targetMemoryUtilizationPercentage }}
- - type: Resource
- resource:
- name: memory
- target:
- type: Utilization
- averageUtilization: {{ $component.autoscaling.targetMemoryUtilizationPercentage }}
- {{- end }}
- {{- end }}
- {{- end }}
|