From 679c4b45d0f13132bef5d99d958b75f6ac248bac Mon Sep 17 00:00:00 2001 From: harshv1995 <136332331+harshv1995@users.noreply.github.com> Date: Wed, 13 Mar 2024 15:36:04 +0530 Subject: [PATCH] dev: add hpa (#15) --- cr.yaml | 2 +- squadcast-helm/Chart.yaml | 2 +- squadcast-helm/templates/hpa.yaml | 24 ++++++++++++++---------- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/cr.yaml b/cr.yaml index 75778f5..6e11c67 100644 --- a/cr.yaml +++ b/cr.yaml @@ -5,4 +5,4 @@ charts-dir: squadcast-helm sign: false charts_repo_url: https://squadcasthub.github.io/helm-infra index-path: . -version: 0.2.4 +version: 0.2.5 diff --git a/squadcast-helm/Chart.yaml b/squadcast-helm/Chart.yaml index facde7c..e6aaf4e 100644 --- a/squadcast-helm/Chart.yaml +++ b/squadcast-helm/Chart.yaml @@ -3,6 +3,6 @@ name: squadcast-helm description: A Helm chart for Kubernetes type: application -version: 0.2.4 +version: 0.2.5 appVersion: "1.16.0" diff --git a/squadcast-helm/templates/hpa.yaml b/squadcast-helm/templates/hpa.yaml index b02ca8f..eb93524 100644 --- a/squadcast-helm/templates/hpa.yaml +++ b/squadcast-helm/templates/hpa.yaml @@ -1,30 +1,34 @@ {{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 +apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: - name: {{ include "squadcast-helm.fullname" . }} - labels: + name: {{ include "squadcast-helm.fullname" . }} + labels: {{- include "squadcast-helm.labels" . | nindent 4 }} - namespace: {{ .Values.namespace }} + namespace: {{ .Values.namespace }} spec: - scaleTargetRef: + scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: {{ include "squadcast-helm.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - type: Resource resource: name: cpu - targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} {{- end }} {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - type: Resource resource: name: memory - targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} {{- end }} {{- end }}