From e115a797c5bb5715a2908d84cd4e6e3852b98de3 Mon Sep 17 00:00:00 2001
From: slaventius <slaventius@mail.ru>
Date: Mon, 27 Feb 2023 16:49:13 +0300
Subject: [PATCH] *

---
 deploy/helm/templates/hpa.yaml | 46 +++++++++++++++++++++++-----------
 1 file changed, 32 insertions(+), 14 deletions(-)

diff --git a/deploy/helm/templates/hpa.yaml b/deploy/helm/templates/hpa.yaml
index 28b49d2..b814d89 100644
--- a/deploy/helm/templates/hpa.yaml
+++ b/deploy/helm/templates/hpa.yaml
@@ -1,21 +1,39 @@
-apiVersion: autoscaling/v1
+# apiVersion: autoscaling/v1
+# kind: HorizontalPodAutoscaler
+# metadata:
+#   name: {{ .Release.Name }}-hpa
+# spec:
+#   scaleTargetRef:
+#     apiVersion: apps/v1
+#     kind: Deployment
+#     name: {{ .Release.Name }}-hpa
+#   minReplicas: 1
+#   maxReplicas: 5
+#   targetCPUUtilizationPercentage: 20
+#   # metrics:
+#   #   - type: Resource
+#   #     resource:
+#   #       name: cpu
+#   #       targetAverageUtilization: 80
+#   #   - type: Resource
+#   #     resource:
+#   #       name: memory
+#   #       targetAverageValue: 200Mi
+apiVersion: autoscaling/v2
 kind: HorizontalPodAutoscaler
 metadata:
   name: {{ .Release.Name }}-hpa
 spec:
+  minReplicas: 1
+  maxReplicas: 5
+  metrics:
+    - resource:
+        name: cpu
+        target:
+          averageUtilization: 50
+          type: Utilization
+      type: Resource
   scaleTargetRef:
     apiVersion: apps/v1
     kind: Deployment
-    name: {{ .Release.Name }}-hpa
-  minReplicas: 1
-  maxReplicas: 5
-  targetCPUUtilizationPercentage: 20
-  # metrics:
-  #   - type: Resource
-  #     resource:
-  #       name: cpu
-  #       targetAverageUtilization: 80
-  #   - type: Resource
-  #     resource:
-  #       name: memory
-  #       targetAverageValue: 200Mi
+    name: {{ .Release.Name }}-application