forked from nixys/nxs-universal-chart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hpa.yaml
50 lines (50 loc) · 1.68 KB
/
hpa.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{{- range $name, $hpa := .Values.hpas }}
---
kind: HorizontalPodAutoscaler
apiVersion: {{ .apiVersion | default "autoscaling/v2" }}
metadata:
name: {{ include "helpers.app.fullname" (dict "name" $name "context" $) }}
namespace: {{ $.Release.Namespace | quote }}
labels:
{{- include "helpers.app.labels" $ | nindent 4 }}
{{- with .labels }}{{- include "helpers.tplvalues.render" (dict "value" . "context" $) | nindent 4 }}{{- end }}
annotations:
{{- with .annotations }}{{- include "helpers.tplvalues.render" (dict "value" . "context" $) | nindent 4 }}{{- end }}
spec:
{{- with .scaleTargetRef }}
scaleTargetRef:
apiVersion: {{ .apiVersion | default "apps/v1" }}
kind: {{ .kind | default "Deployment" }}
name: {{ include "helpers.app.fullname" (dict "name" .name "context" $) }}
{{- end }}
minReplicas: {{ .minReplicas | default "2" }}
maxReplicas: {{ .maxReplicas | default "3" }}
metrics:
{{- if not (empty .targetCPU) }}
- type: Resource
resource:
name: cpu
{{- if eq .apiVersion "autoscaling/v2beta1" }}
targetAverageUtilization: {{ .targetCPU }}
{{- else }}
target:
type: Utilization
averageUtilization: {{ .targetCPU }}
{{- end }}
{{- end }}
{{- if not (empty .targetMemory) }}
- type: Resource
resource:
name: memory
{{- if eq .apiVersion "autoscaling/v2beta1" }}
targetAverageUtilization: {{ .targetMemory }}
{{- else }}
target:
type: Utilization
averageUtilization: {{ .targetMemory }}
{{- end }}
{{- end }}
{{- if .metrics }}
{{- toYaml .metrics | nindent 4 }}
{{- end }}
{{- end -}}