123456789101112131415161718192021222324252627282930313233 |
- {{- $name := .Chart.Name }}
- {{- range $index, $val := .Values.items }}
- {{- if and $val.autoscaling $val.autoscaling.enabled }}
- apiVersion: autoscaling/v2beta1
- kind: HorizontalPodAutoscaler
- metadata:
- name: {{ print $val.name | default (print $name "-autoscaller-" $index) }}
- labels:
- app: {{ $name }}
- tier: {{ $val.name | default (print $name "-autoscaller") }}
- spec:
- scaleTargetRef:
- apiVersion: apps/v1
- kind: Deployment
- name: {{ $val.name | default (print $name "-" $val.type "-" $index) }}
- minReplicas: {{ $val.autoscaling.minReplicas | default 1 }}
- maxReplicas: {{ $val.autoscaling.maxReplicas | default 10 }}
- metrics:
- {{- if $val.autoscaling.targetCPUUtilizationPercentage }}
- - type: Resource
- resource:
- name: cpu
- targetAverageUtilization: {{ $val.autoscaling.targetCPUUtilizationPercentage | default 50 }}
- {{- end }}
- {{- if $val.autoscaling.targetMemoryUtilizationPercentage }}
- - type: Resource
- resource:
- name: memory
- targetAverageUtilization: {{ $val.autoscaling.targetMemoryUtilizationPercentage | default 30}}
- {{- end }}
- {{ print "---" }}
- {{- end }}{{- end }}
|