Oleksandr Kozachenko | b009349 | 2023-09-06 21:43:47 +0200 | [diff] [blame] | 1 | {{- /* |
Mohammed Naser | 7d1623e | 2024-06-17 09:12:39 -0400 | [diff] [blame] | 2 | Copyright Broadcom, Inc. All Rights Reserved. |
Oleksandr Kozachenko | b009349 | 2023-09-06 21:43:47 +0200 | [diff] [blame] | 3 | SPDX-License-Identifier: APACHE-2.0 |
| 4 | */}} |
| 5 | |
| 6 | {{- if .Values.autoscaling.enabled }} |
| 7 | apiVersion: {{ include "common.capabilities.hpa.apiVersion" ( dict "context" $ ) }} |
| 8 | kind: HorizontalPodAutoscaler |
| 9 | metadata: |
| 10 | name: {{ template "common.names.fullname" . }} |
| 11 | namespace: {{ include "common.names.namespace" . | quote }} |
Mohammed Naser | 65cda13 | 2024-05-02 14:34:08 -0400 | [diff] [blame] | 12 | labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} |
Oleksandr Kozachenko | b009349 | 2023-09-06 21:43:47 +0200 | [diff] [blame] | 13 | app.kubernetes.io/component: keycloak |
Oleksandr Kozachenko | b009349 | 2023-09-06 21:43:47 +0200 | [diff] [blame] | 14 | {{- if .Values.commonAnnotations }} |
| 15 | annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} |
| 16 | {{- end }} |
| 17 | spec: |
| 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 }} |
Mohammed Naser | 7d1623e | 2024-06-17 09:12:39 -0400 | [diff] [blame] | 49 | {{- if or .Values.autoscaling.behavior.scaleDown.policies .Values.autoscaling.behavior.scaleUp.policies }} |
| 50 | behavior: |
| 51 | {{- if .Values.autoscaling.behavior.scaleDown.policies }} |
| 52 | scaleDown: |
| 53 | stabilizationWindowSeconds: {{ .Values.autoscaling.behavior.scaleDown.stabilizationWindowSeconds }} |
| 54 | selectPolicy: {{ .Values.autoscaling.behavior.scaleDown.selectPolicy }} |
| 55 | policies: |
| 56 | {{- toYaml .Values.autoscaling.behavior.scaleDown.policies | nindent 8 }} |
| 57 | {{- end }} |
| 58 | {{- if .Values.autoscaling.behavior.scaleUp.policies }} |
| 59 | scaleUp: |
| 60 | stabilizationWindowSeconds: {{ .Values.autoscaling.behavior.scaleUp.stabilizationWindowSeconds }} |
| 61 | selectPolicy: {{ .Values.autoscaling.behavior.scaleUp.selectPolicy }} |
| 62 | policies: |
| 63 | {{- toYaml .Values.autoscaling.behavior.scaleUp.policies | nindent 8 }} |
| 64 | {{- end }} |
| 65 | {{- end }} |
Oleksandr Kozachenko | b009349 | 2023-09-06 21:43:47 +0200 | [diff] [blame] | 66 | {{- end }} |