|
@@ -1,5 +1,11 @@
|
|
|
{{- if .Values.autoscaling.enabled }}
|
|
|
+{{- $kubeCapabilityVersion := semver .Capabilities.KubeVersion.Version -}}
|
|
|
+{{- $isHigher1p25 := ge (semver "1.25" | $kubeCapabilityVersion.Compare) 0 -}}
|
|
|
+{{- if and ($.Capabilities.APIVersions.Has "autoscaling/v2") $isHigher1p25 -}}
|
|
|
+apiVersion: autoscaling/v2
|
|
|
+{{- else }}
|
|
|
apiVersion: autoscaling/v2beta1
|
|
|
+{{- end }}
|
|
|
kind: HorizontalPodAutoscaler
|
|
|
metadata:
|
|
|
name: {{ include "kafka-ui.fullname" . }}
|
|
@@ -17,12 +23,24 @@ spec:
|
|
|
- type: Resource
|
|
|
resource:
|
|
|
name: cpu
|
|
|
+ {{- if $isHigher1p25 }}
|
|
|
+ target:
|
|
|
+ type: Utilization
|
|
|
+ averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
|
|
|
+ {{- else }}
|
|
|
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
|
|
|
+ {{- end }}
|
|
|
{{- end }}
|
|
|
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
|
|
- type: Resource
|
|
|
resource:
|
|
|
name: memory
|
|
|
+ {{- if $isHigher1p25 }}
|
|
|
+ target:
|
|
|
+ type: Utilization
|
|
|
+ averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
|
|
+ {{- else }}
|
|
|
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
|
|
{{- end }}
|
|
|
+ {{- end }}
|
|
|
{{- end }}
|