argocd-helm/charts/argo-cd/templates/argocd-server/hpa.yaml
Daniel Nachtrub 9c245d4e65
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>
2022-07-14 15:02:52 +02:00

40 lines
1.4 KiB
YAML

{{- if .Values.server.autoscaling.enabled }}
apiVersion: {{ include "argo-cd.autoscaling.apiVersion" . }}
kind: HorizontalPodAutoscaler
metadata:
labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" (printf "%s-hpa" .Values.server.name)) | nindent 4 }}
name: {{ template "argo-cd.server.fullname" . }}-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ template "argo-cd.server.fullname" . }}
minReplicas: {{ .Values.server.autoscaling.minReplicas }}
maxReplicas: {{ .Values.server.autoscaling.maxReplicas }}
metrics:
{{- with .Values.server.autoscaling.targetMemoryUtilizationPercentage }}
- 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 }}