feat(argo-cd): Replace Application Controller StatefullSet with a Deployment and enabled autoscaling

Signed-off-by: SIRICA1 <ricardo.silva@mercedes-benz.io>
This commit is contained in:
SIRICA1 2023-03-10 16:58:08 +00:00
parent 9781abdfd8
commit 8f57e93b3d
4 changed files with 62 additions and 16 deletions

View file

@ -3,7 +3,7 @@ appVersion: v2.6.4
kubeVersion: ">=1.22.0-0"
description: A Helm chart for Argo CD, a declarative, GitOps continuous delivery tool for Kubernetes.
name: argo-cd
version: 5.25.0
version: 5.25.1
home: https://github.com/argoproj/argo-helm
icon: https://argo-cd.readthedocs.io/en/stable/assets/logo.png
sources:
@ -23,5 +23,5 @@ dependencies:
condition: redis-ha.enabled
annotations:
artifacthub.io/changes: |
- kind: added
description: Add parameter env to redis exporter
- kind: changed
description: Replace Application Controller StatefullSet with a Deployment and enabled autoscaling

View file

@ -29,7 +29,9 @@ redis-ha:
enabled: true
controller:
replicas: 1
autoscaling:
enabled: true
minReplicas: 2
server:
autoscaling:
@ -72,7 +74,7 @@ When installing Argo CD using this helm chart the user should have a similar exp
To update the templates and default settings in `values.yaml` it may come in handy to look up the diff of the `manifests/install.yaml` between two versions accordingly. This can either be done directly via github and look for `manifests/install.yaml`:
https://github.com/argoproj/argo-cd/compare/v1.8.7...v2.0.0#files_bucket
<https://github.com/argoproj/argo-cd/compare/v1.8.7...v2.0.0#files_bucket>
Or you clone the repository and do a local `git-diff`:
@ -171,9 +173,9 @@ done
This version **removes support for**:
- deprecated repository credentials (parameter `configs.repositoryCredentials`)
- option to run application controller as a Deployment
- the parameters `server.additionalApplications` and `server.additionalProjects`
* deprecated repository credentials (parameter `configs.repositoryCredentials`)
* option to run application controller as a Deployment
* the parameters `server.additionalApplications` and `server.additionalProjects`
Please carefully read the following section if you are using these parameters!
@ -351,8 +353,8 @@ server:
## Prerequisites
- Kubernetes: `>=1.22.0-0`
- Helm v3.0.0+
* Kubernetes: `>=1.22.0-0`
* Helm v3.0.0+
## Installing the Chart
@ -956,7 +958,7 @@ server:
### Option 2 - Redis HA
This option uses the following third-party chart to bootstrap a clustered Redis: https://github.com/DandyDeveloper/charts/tree/master/charts/redis-ha.
This option uses the following third-party chart to bootstrap a clustered Redis: <https://github.com/DandyDeveloper/charts/tree/master/charts/redis-ha>.
For all available configuration options, please read upstream README and/or chart source.
The main options are listed here:

View file

@ -1,7 +1,7 @@
apiVersion: apps/v1
kind: StatefulSet
kind: Deployment
metadata:
{{- with (mergeOverwrite (deepCopy .Values.global.statefulsetAnnotations) .Values.controller.statefulsetAnnotations) }}
{{- with (mergeOverwrite (deepCopy .Values.global.deploymentAnnotations) .Values.controller.deploymentAnnotations) }}
annotations:
{{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }}
@ -11,10 +11,10 @@ metadata:
labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.controller.name "name" .Values.controller.name) | nindent 4 }}
spec:
{{- if not .Values.controller.autoscaling.enabled }}
replicas: {{ .Values.controller.replicas }}
# TODO: Remove for breaking release as history limit cannot be patched
revisionHistoryLimit: 5
serviceName: {{ include "argo-cd.controller.fullname" . }}
{{- end }}
revisionHistoryLimit: {{ .Values.global.revisionHistoryLimit }}
selector:
matchLabels:
{{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.controller.name) | nindent 6 }}

View file

@ -0,0 +1,44 @@
{{- if .Values.controller.autoscaling.enabled }}
apiVersion: {{ include "argo-cd.apiVersion.autoscaling" . }}
kind: HorizontalPodAutoscaler
metadata:
labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.controller.name "name" (printf "%s-hpa" .Values.controller.name)) | nindent 4 }}
name: {{ template "argo-cd.controller.fullname" . }}-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ template "argo-cd.controller.fullname" . }}
minReplicas: {{ .Values.controller.autoscaling.minReplicas }}
maxReplicas: {{ .Values.controller.autoscaling.maxReplicas }}
metrics:
{{- with .Values.controller.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
{{- if eq (include "argo-cd.apiVersion.autoscaling" $) "autoscaling/v2beta1" }}
targetAverageUtilization: {{ . }}
{{- else }}
target:
averageUtilization: {{ . }}
type: Utilization
{{- end }}
{{- end }}
{{- with .Values.controller.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
{{- if eq (include "argo-cd.apiVersion.autoscaling" $) "autoscaling/v2beta1" }}
targetAverageUtilization: {{ . }}
{{- else }}
target:
averageUtilization: {{ . }}
type: Utilization
{{- end }}
{{- end }}
{{- with .Values.controller.autoscaling.behavior }}
behavior:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}