blob: 7fcc9931776de69bc7989729cd1a958df6a485a8 [file] [log] [blame]
Mohammed Naser9ad0d462023-01-15 20:36:37 -05001{{- if and (.Values.hpa.enabled) (not .Values.autoscaler.enabled) }}
2---
Mohammed Naser65cda132024-05-02 14:34:08 -04003{{- if .Capabilities.APIVersions.Has "autoscaling/v2" }}
4apiVersion: autoscaling/v2
5{{- else }}
Mohammed Naser9ad0d462023-01-15 20:36:37 -05006apiVersion: autoscaling/v2beta2
Mohammed Naser65cda132024-05-02 14:34:08 -04007{{- end }}
Mohammed Naser9ad0d462023-01-15 20:36:37 -05008kind: HorizontalPodAutoscaler
9metadata:
10 name: {{ template "coredns.fullname" . }}
Mohammed Naser65cda132024-05-02 14:34:08 -040011 namespace: {{ .Release.Namespace }}
12 labels: {{- include "coredns.labels" . | nindent 4 }}
Mohammed Naser9ad0d462023-01-15 20:36:37 -050013{{- if .Values.customLabels }}
14{{ toYaml .Values.customLabels | indent 4 }}
15{{- end }}
16{{- with .Values.customAnnotations }}
17 annotations:
18{{- toYaml . | nindent 4 }}
19{{- end }}
20spec:
21 scaleTargetRef:
22 apiVersion: apps/v1
23 kind: Deployment
24 name: {{ default (include "coredns.fullname" .) .Values.deployment.name }}
25 minReplicas: {{ .Values.hpa.minReplicas }}
26 maxReplicas: {{ .Values.hpa.maxReplicas }}
27 metrics:
28{{ toYaml .Values.hpa.metrics | indent 4 }}
29{{- if .Values.hpa.behavior }}
30 behavior:
31{{ toYaml .Values.hpa.behavior | indent 4 }}
32{{- end }}
33{{- end }}