| Giorgi Lekveishvili | ec6b3cc | 2023-12-01 16:30:04 +0400 | [diff] [blame^] | 1 | {{- if and (.Values.hpa.enabled) (not .Values.autoscaler.enabled) }} |
| 2 | --- |
| 3 | {{- if .Capabilities.APIVersions.Has "autoscaling/v2" }} |
| 4 | apiVersion: autoscaling/v2 |
| 5 | {{- else }} |
| 6 | apiVersion: autoscaling/v2beta2 |
| 7 | {{- end }} |
| 8 | kind: HorizontalPodAutoscaler |
| 9 | metadata: |
| 10 | name: {{ template "coredns.fullname" . }} |
| 11 | labels: {{- include "coredns.labels" . | nindent 4 }} |
| 12 | {{- if .Values.customLabels }} |
| 13 | {{ toYaml .Values.customLabels | indent 4 }} |
| 14 | {{- end }} |
| 15 | {{- with .Values.customAnnotations }} |
| 16 | annotations: |
| 17 | {{- toYaml . | nindent 4 }} |
| 18 | {{- end }} |
| 19 | spec: |
| 20 | scaleTargetRef: |
| 21 | apiVersion: apps/v1 |
| 22 | kind: Deployment |
| 23 | name: {{ default (include "coredns.fullname" .) .Values.deployment.name }} |
| 24 | minReplicas: {{ .Values.hpa.minReplicas }} |
| 25 | maxReplicas: {{ .Values.hpa.maxReplicas }} |
| 26 | metrics: |
| 27 | {{ toYaml .Values.hpa.metrics | indent 4 }} |
| 28 | {{- if .Values.hpa.behavior }} |
| 29 | behavior: |
| 30 | {{ toYaml .Values.hpa.behavior | indent 4 }} |
| 31 | {{- end }} |
| 32 | {{- end }} |