feat(argo-cd): Added apiVersion switch for autoscaling resources (#1375)

* Added apiVersion switch for autoscaling

Signed-off-by: dn <dn@nuvotex.de>

* bumped chart version
added changelog

Signed-off-by: dn <dn@nuvotex.de>

* updated docs with helm-docs 1.9.1

Signed-off-by: dn <dn@nuvotex.de>

* added new line end of file (lint issue)

Signed-off-by: dn <dn@nuvotex.de>

* replaced linebreaks in chart.yaml with LF

Signed-off-by: dn <dn@nuvotex.de>

* Apply changes from code review

Signed-off-by: Marco Kilchhofer <mkilchhofer@users.noreply.github.com>

Co-authored-by: Marco Kilchhofer <mkilchhofer@users.noreply.github.com>
This commit is contained in:
Daniel Nachtrub 2022-07-14 15:02:52 +02:00 committed by GitHub
parent 1fda562239
commit 9c245d4e65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 44 additions and 4 deletions

View file

@ -219,6 +219,19 @@ Return the appropriate apiVersion for ingress
{{- end -}}
{{- end -}}
{{/*
Return the appropriate apiVersion for autoscaling
*/}}
{{- define "argo-cd.autoscaling.apiVersion" -}}
{{- if .Values.apiVersionOverrides.autoscaling -}}
{{- print .Values.apiVersionOverrides.autoscaling -}}
{{- else if semverCompare "<1.23-0" (include "argo-cd.kubeVersion" $) -}}
{{- print "autoscaling/v2beta1" -}}
{{- else -}}
{{- print "autoscaling/v2" -}}
{{- end -}}
{{- end -}}
{{/*
Return the target Kubernetes version
*/}}

View file

@ -1,5 +1,5 @@
{{- if .Values.repoServer.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
apiVersion: {{ include "argo-cd.autoscaling.apiVersion" . }}
kind: HorizontalPodAutoscaler
metadata:
labels:
@ -17,12 +17,24 @@ spec:
- type: Resource
resource:
name: memory
{{- if eq (include "argo-cd.autoscaling.apiVersion" $) "autoscaling/v2beta1" }}
targetAverageUtilization: {{ . }}
{{- else }}
target:
averageUtilization: {{ . }}
type: Utilization
{{- end }}
{{- end }}
{{- with .Values.repoServer.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
{{- if eq (include "argo-cd.autoscaling.apiVersion" $) "autoscaling/v2beta1" }}
targetAverageUtilization: {{ . }}
{{- else }}
target:
averageUtilization: {{ . }}
type: Utilization
{{- end }}
{{- end }}
{{- end }}

View file

@ -1,5 +1,5 @@
{{- if .Values.server.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
apiVersion: {{ include "argo-cd.autoscaling.apiVersion" . }}
kind: HorizontalPodAutoscaler
metadata:
labels:
@ -17,12 +17,24 @@ spec:
- type: Resource
resource:
name: memory
{{- if eq (include "argo-cd.autoscaling.apiVersion" $) "autoscaling/v2beta1" }}
targetAverageUtilization: {{ . }}
{{- else }}
target:
averageUtilization: {{ . }}
type: Utilization
{{- end }}
{{- end }}
{{- with .Values.server.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
{{- if eq (include "argo-cd.autoscaling.apiVersion" $) "autoscaling/v2beta1" }}
targetAverageUtilization: {{ . }}
{{- else }}
target:
averageUtilization: {{ . }}
type: Utilization
{{- end }}
{{- end }}
{{- end }}