This is an automated email from the ASF dual-hosted git repository.

lewismc pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tika-helm.git


The following commit(s) were added to refs/heads/main by this push:
     new 231dfaf  bugfix(hpa): Fix hpa structure when the v2 apiVersion is set 
(#11)
231dfaf is described below

commit 231dfafc4db09dcb6091187b6fa17cba78ef149f
Author: Stijn Brouwers <[email protected]>
AuthorDate: Sun Mar 19 23:28:09 2023 +0100

    bugfix(hpa): Fix hpa structure when the v2 apiVersion is set (#11)
---
 templates/hpa.yaml | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/templates/hpa.yaml b/templates/hpa.yaml
index 178c189..3c162ed 100644
--- a/templates/hpa.yaml
+++ b/templates/hpa.yaml
@@ -31,6 +31,24 @@ spec:
   minReplicas: {{ .Values.autoscaling.minReplicas }}
   maxReplicas: {{ .Values.autoscaling.maxReplicas }}
   metrics:
+    {{- if eq .Values.autoscaling.apiVersion "autoscaling/v2" }}
+    {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
+    - type: Resource
+      resource:
+        name: memory
+        target: 
+          type: Utilization
+          averageUtilization: {{ 
.Values.autoscaling.targetMemoryUtilizationPercentage }}
+    {{- end }}
+    {{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
+    - type: Resource
+      resource:
+        name: cpu
+        target: 
+          type: Utilization
+          averageUtilization: {{ 
.Values.autoscaling.targetCPUUtilizationPercentage }}
+    {{- end }}
+    {{- else }}
     {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
     - type: Resource
       resource:
@@ -43,4 +61,5 @@ spec:
         name: cpu
         targetAverageUtilization: {{ 
.Values.autoscaling.targetCPUUtilizationPercentage }}
     {{- end }}
+    {{- end }}
 {{- end }}

Reply via email to