diff --git a/README.md b/README.md index cb10a3a..15c2d25 100644 --- a/README.md +++ b/README.md @@ -399,7 +399,7 @@ To use the Kubernetes Helm Chart: 1. Ensure you have [Helm](https://helm.sh/docs/intro/install/) `>=3.0.0` installed 2. Clone this repository 3. Update [charts/whoogle/values.yaml](./charts/whoogle/values.yaml) as desired -4. Run `helm install whoogle ./charts/whoogle` +4. Run `helm upgrade --install whoogle ./charts/whoogle` ___ diff --git a/charts/whoogle/templates/hpa.yaml b/charts/whoogle/templates/hpa.yaml index 74be742..b402fe7 100644 --- a/charts/whoogle/templates/hpa.yaml +++ b/charts/whoogle/templates/hpa.yaml @@ -1,5 +1,9 @@ {{- if .Values.autoscaling.enabled }} +{{- if semverCompare ">=1.23-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: autoscaling/v2 +{{- else -}} apiVersion: autoscaling/v2beta1 +{{- end }} kind: HorizontalPodAutoscaler metadata: name: {{ include "whoogle.fullname" . }} @@ -17,12 +21,24 @@ spec: - type: Resource resource: name: cpu + {{- if semverCompare ">=1.23-0" .Capabilities.KubeVersion.GitVersion }} + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- else -}} targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} {{- end }} {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - type: Resource resource: name: memory + {{- if semverCompare ">=1.23-0" .Capabilities.KubeVersion.GitVersion }} + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- else -}} targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} {{- end }} {{- end }}