Skip to content

Commit 7f64544

Browse files
authored
fix(hpa) Add autoscaling v2 support (#152)
* feat(env-vars) Add extra env vars and envFrom * Switch to main * fix(hpa) Add autoscaling v2 support
1 parent e400850 commit 7f64544

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

chart/templates/hpa.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
{{- if not .Values.useStatefulset.enabled -}}
22
{{- if .Values.autoscaling.enabled }}
3+
{{- if .Capabilities.APIVersions.Has "autoscaling/v2" }}
4+
apiVersion: autoscaling/v2
5+
{{- else if .Capabilities.APIVersions.Has "autoscaling/v2beta2" }}
6+
apiVersion: autoscaling/v2beta2
7+
{{- else }}
38
apiVersion: autoscaling/v2beta1
9+
{{- end }}
410
kind: HorizontalPodAutoscaler
511
metadata:
612
name: {{ include "kube-httpcache.fullname" . }}
@@ -18,13 +24,25 @@ spec:
1824
- type: Resource
1925
resource:
2026
name: cpu
27+
{{- if or (.Capabilities.APIVersions.Has "autoscaling/v2") (.Capabilities.APIVersions.Has "autoscaling/v2beta2") }}
28+
target:
29+
type: Utilization
30+
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
31+
{{- else }}
2132
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
33+
{{- end }}
2234
{{- end }}
2335
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
2436
- type: Resource
2537
resource:
2638
name: memory
39+
{{- if or (.Capabilities.APIVersions.Has "autoscaling/v2") (.Capabilities.APIVersions.Has "autoscaling/v2beta2") }}
40+
target:
41+
type: Utilization
42+
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
43+
{{- else }}
2744
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
45+
{{- end }}
2846
{{- end }}
2947
{{- end }}
3048
{{- end }}

0 commit comments

Comments
 (0)