Skip to content

Commit e75534e

Browse files
KelvinVenancioJonsy13git
authored
fix(litmus): add HPA API version compatibility for multiple k8s versions (#455)
* fix(litmus): add HPA API version compatibility for multiple k8s versions Add dynamic HPA apiVersion detection to support both older and newer Kubernetes versions. The implementation checks for autoscaling/v2 availability (K8s 1.23+) and falls back to autoscaling/v2beta2 for older clusters. Changes: - Add litmus-portal.hpa.apiVersion helper in _helpers.tpl - Update frontend-hpa.yaml to use dynamic apiVersion - Update auth-server-hpa.yaml to use dynamic apiVersion This ensures compatibility across Kubernetes versions while maintaining the existing metrics specification format. Signed-off-by: Kelvin V. Soares <[email protected]> * Updating MongoDB repository to bitnamilegacy (#457) * Added fixes Signed-off-by: git <[email protected]> * Added fixes Signed-off-by: git <[email protected]> --------- Signed-off-by: git <[email protected]> Co-authored-by: git <[email protected]> Signed-off-by: Kelvin V. Soares <[email protected]> --------- Signed-off-by: Kelvin V. Soares <[email protected]> Signed-off-by: git <[email protected]> Co-authored-by: Vedant Shrotria <[email protected]> Co-authored-by: git <[email protected]>
1 parent c0b31bc commit e75534e

File tree

5 files changed

+17
-6
lines changed

5 files changed

+17
-6
lines changed

charts/litmus/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
appVersion: "3.21.0"
33
description: A Helm chart to install ChaosCenter
44
name: litmus
5-
version: 3.21.1
5+
version: 3.21.2
66
kubeVersion: ">=1.16.0-0"
77
home: https://litmuschaos.io
88
sources:

charts/litmus/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# litmus
22

3-
![Version: 3.21.1](https://img.shields.io/badge/Version-3.21.1-informational?style=flat-square) ![AppVersion: 3.21.0](https://img.shields.io/badge/AppVersion-3.21.0-informational?style=flat-square)
3+
![Version: 3.21.2](https://img.shields.io/badge/Version-3.21.2-informational?style=flat-square) ![AppVersion: 3.21.0](https://img.shields.io/badge/AppVersion-3.21.0-informational?style=flat-square)
44

55
A Helm chart to install ChaosCenter
66

charts/litmus/templates/_helpers.tpl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,4 +162,15 @@ mongodb://{{ trimSuffix "," $hosts }}/admin
162162
{{- if .Values.portal.frontend.podAnnotations }}
163163
{{ toYaml .Values.portal.frontend.podAnnotations }}
164164
{{- end }}
165-
{{- end -}}
165+
{{- end -}}
166+
167+
{{/*
168+
Return the appropriate apiVersion for HorizontalPodAutoscaler.
169+
*/}}
170+
{{- define "litmus-portal.hpa.apiVersion" -}}
171+
{{- if $.Capabilities.APIVersions.Has "autoscaling/v2/HorizontalPodAutoscaler" }}
172+
{{- print "autoscaling/v2" }}
173+
{{- else }}
174+
{{- print "autoscaling/v2beta2" }}
175+
{{- end }}
176+
{{- end }}

charts/litmus/templates/auth-server-hpa.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{- if .Values.portal.server.authServer.autoscaling.enabled -}}
2-
apiVersion: autoscaling/v2beta2
2+
apiVersion: {{ include "litmus-portal.hpa.apiVersion" . }}
33
kind: HorizontalPodAutoscaler
44
metadata:
55
labels:

charts/litmus/templates/frontend-hpa.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{- if .Values.portal.frontend.autoscaling.enabled -}}
2-
apiVersion: autoscaling/v2beta2
2+
apiVersion: {{ include "litmus-portal.hpa.apiVersion" . }}
33
kind: HorizontalPodAutoscaler
44
metadata:
55
labels:
@@ -34,4 +34,4 @@ spec:
3434
type: Utilization
3535
averageUtilization: {{ . }}
3636
{{- end }}
37-
{{- end }}
37+
{{- end }}

0 commit comments

Comments
 (0)