blob: 5faebcbfa9e3b10f1adcb559aff7830bd76b278f [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 }}
12 labels: {{- include "common.labels.standard" . | nindent 4 }}
13 app.kubernetes.io/component: keycloak
14 {{- if .Values.commonLabels }}
15 {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
16 {{- end }}
17 {{- if .Values.commonAnnotations }}
18 annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
19 {{- end }}
20spec:
21 scaleTargetRef:
22 apiVersion: {{ include "common.capabilities.statefulset.apiVersion" . }}
23 kind: StatefulSet
24 name: {{ template "common.names.fullname" . }}
25 minReplicas: {{ .Values.autoscaling.minReplicas }}
26 maxReplicas: {{ .Values.autoscaling.maxReplicas }}
27 metrics:
28 {{- if .Values.autoscaling.targetCPU }}
29 - type: Resource
30 resource:
31 name: cpu
32 {{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
33 targetAverageUtilization: {{ .Values.autoscaling.targetCPU }}
34 {{- else }}
35 target:
36 type: Utilization
37 averageUtilization: {{ .Values.autoscaling.targetCPU }}
38 {{- end }}
39 {{- end }}
40 {{- if .Values.autoscaling.targetMemory }}
41 - type: Resource
42 resource:
43 name: memory
44 {{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
45 targetAverageUtilization: {{ .Values.autoscaling.targetMemory }}
46 {{- else }}
47 target:
48 type: Utilization
49 averageUtilization: {{ .Values.autoscaling.targetMemory }}
50 {{- end }}
51 {{- end }}
52{{- end }}