blob: 49ea244bb3c74a74113a93b111a0fadcc1843a61 [file] [log] [blame]
Oleksandr Kozachenkob0093492023-09-06 21:43:47 +02001{{- /*
2Copyright VMware, Inc.
3SPDX-License-Identifier: APACHE-2.0
4*/}}
5
6{{- if .Values.autoscaling.enabled }}
7apiVersion: {{ include "common.capabilities.hpa.apiVersion" ( dict "context" $ ) }}
8kind: HorizontalPodAutoscaler
9metadata:
10 name: {{ template "common.names.fullname" . }}
11 namespace: {{ include "common.names.namespace" . | quote }}
Mohammed Naser65cda132024-05-02 14:34:08 -040012 labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
Oleksandr Kozachenkob0093492023-09-06 21:43:47 +020013 app.kubernetes.io/component: keycloak
Oleksandr Kozachenkob0093492023-09-06 21:43:47 +020014 {{- if .Values.commonAnnotations }}
15 annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
16 {{- end }}
17spec:
18 scaleTargetRef:
19 apiVersion: {{ include "common.capabilities.statefulset.apiVersion" . }}
20 kind: StatefulSet
21 name: {{ template "common.names.fullname" . }}
22 minReplicas: {{ .Values.autoscaling.minReplicas }}
23 maxReplicas: {{ .Values.autoscaling.maxReplicas }}
24 metrics:
25 {{- if .Values.autoscaling.targetCPU }}
26 - type: Resource
27 resource:
28 name: cpu
29 {{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
30 targetAverageUtilization: {{ .Values.autoscaling.targetCPU }}
31 {{- else }}
32 target:
33 type: Utilization
34 averageUtilization: {{ .Values.autoscaling.targetCPU }}
35 {{- end }}
36 {{- end }}
37 {{- if .Values.autoscaling.targetMemory }}
38 - type: Resource
39 resource:
40 name: memory
41 {{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
42 targetAverageUtilization: {{ .Values.autoscaling.targetMemory }}
43 {{- else }}
44 target:
45 type: Utilization
46 averageUtilization: {{ .Values.autoscaling.targetMemory }}
47 {{- end }}
48 {{- end }}
49{{- end }}