Skip to content

Commit

Permalink
fix(hpa) Add autoscaling v2 support (#152)
Browse files Browse the repository at this point in the history
* feat(env-vars) Add extra env vars and envFrom

* Switch to main

* fix(hpa) Add autoscaling v2 support
  • Loading branch information
sarasensible authored Apr 12, 2023
1 parent e400850 commit 7f64544
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions chart/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{{- if not .Values.useStatefulset.enabled -}}
{{- if .Values.autoscaling.enabled }}
{{- if .Capabilities.APIVersions.Has "autoscaling/v2" }}
apiVersion: autoscaling/v2
{{- else if .Capabilities.APIVersions.Has "autoscaling/v2beta2" }}
apiVersion: autoscaling/v2beta2
{{- else }}
apiVersion: autoscaling/v2beta1
{{- end }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "kube-httpcache.fullname" . }}
Expand All @@ -18,13 +24,25 @@ spec:
- type: Resource
resource:
name: cpu
{{- if or (.Capabilities.APIVersions.Has "autoscaling/v2") (.Capabilities.APIVersions.Has "autoscaling/v2beta2") }}
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- else }}
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
{{- if or (.Capabilities.APIVersions.Has "autoscaling/v2") (.Capabilities.APIVersions.Has "autoscaling/v2beta2") }}
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- else }}
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

0 comments on commit 7f64544

Please sign in to comment.