feat(argo-cd): Set ARGOCD_CONTROLLER_REPLICAS automatically (#1413)

Signed-off-by: Petr Drastil <petr.drastil@gmail.com>
This commit is contained in:
Petr Drastil 2022-08-25 13:35:17 +02:00 committed by GitHub
parent 31e0156992
commit 4e9663c747
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 41 additions and 47 deletions

View file

@ -2,7 +2,7 @@ apiVersion: v2
appVersion: v2.4.11 appVersion: v2.4.11
description: A Helm chart for Argo CD, a declarative, GitOps continuous delivery tool for Kubernetes. description: A Helm chart for Argo CD, a declarative, GitOps continuous delivery tool for Kubernetes.
name: argo-cd name: argo-cd
version: 5.3.0 version: 5.3.1
home: https://github.com/argoproj/argo-helm home: https://github.com/argoproj/argo-helm
icon: https://argo-cd.readthedocs.io/en/stable/assets/logo.png icon: https://argo-cd.readthedocs.io/en/stable/assets/logo.png
keywords: keywords:
@ -21,5 +21,4 @@ dependencies:
condition: redis-ha.enabled condition: redis-ha.enabled
annotations: annotations:
artifacthub.io/changes: | artifacthub.io/changes: |
- "[Added]: Global configuration for logging" - "[Changed]: Env variable ARGOCD_CONTROLLER_REPLICAS is now automatically set by replica count"
- "[Added]: ApplicationSet configuration for logging"

View file

@ -437,7 +437,7 @@ NAME: my-release
| controller.readinessProbe.periodSeconds | int | `10` | How often (in seconds) to perform the [probe] | | controller.readinessProbe.periodSeconds | int | `10` | How often (in seconds) to perform the [probe] |
| controller.readinessProbe.successThreshold | int | `1` | Minimum consecutive successes for the [probe] to be considered successful after having failed | | controller.readinessProbe.successThreshold | int | `1` | Minimum consecutive successes for the [probe] to be considered successful after having failed |
| controller.readinessProbe.timeoutSeconds | int | `1` | Number of seconds after which the [probe] times out | | controller.readinessProbe.timeoutSeconds | int | `1` | Number of seconds after which the [probe] times out |
| controller.replicas | int | `1` | The number of application controller pods to run. If changing the number of replicas you must pass the number as `ARGOCD_CONTROLLER_REPLICAS` as an environment variable | | controller.replicas | int | `1` | The number of application controller pods to run. Additional replicas will cause sharding of managed clusters across number of replicas. |
| controller.resources | object | `{}` | Resource limits and requests for the application controller pods | | controller.resources | object | `{}` | Resource limits and requests for the application controller pods |
| controller.service.annotations | object | `{}` | Application controller service annotations | | controller.service.annotations | object | `{}` | Application controller service annotations |
| controller.service.labels | object | `{}` | Application controller service labels | | controller.service.labels | object | `{}` | Application controller service labels |

View file

@ -265,17 +265,13 @@ Return the default Argo CD app version
{{- end -}} {{- end -}}
{{- define "argo-cd.redisPasswordEnv" -}} {{- define "argo-cd.redisPasswordEnv" -}}
{{- if or .Values.externalRedis.password .Values.externalRedis.existingSecret }} {{- if or .Values.externalRedis.password .Values.externalRedis.existingSecret -}}
- name: REDIS_PASSWORD - name: REDIS_PASSWORD
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
{{- if .Values.externalRedis.existingSecret }} name: {{ default (include "argo-cd.redis.fullname" .) .Values.externalRedis.existingSecret }}
name: {{ .Values.externalRedis.existingSecret }}
{{- else }}
name: {{ template "argo-cd.redis.fullname" . }}
{{- end }}
key: redis-password key: redis-password
{{- end }} {{- end -}}
{{- end -}} {{- end -}}
{{/* {{/*

View file

@ -68,23 +68,25 @@ spec:
- {{ .Values.externalRedis.host }}:{{ .Values.externalRedis.port }} - {{ .Values.externalRedis.host }}:{{ .Values.externalRedis.port }}
{{- end }} {{- end }}
{{- with .Values.controller.extraArgs }} {{- with .Values.controller.extraArgs }}
{{- . | toYaml | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
image: {{ default .Values.global.image.repository .Values.controller.image.repository }}:{{ default (include "argo-cd.defaultTag" .) .Values.controller.image.tag }} image: {{ default .Values.global.image.repository .Values.controller.image.repository }}:{{ default (include "argo-cd.defaultTag" .) .Values.controller.image.tag }}
imagePullPolicy: {{ default .Values.global.image.imagePullPolicy .Values.controller.image.imagePullPolicy }} imagePullPolicy: {{ default .Values.global.image.imagePullPolicy .Values.controller.image.imagePullPolicy }}
name: {{ .Values.controller.name }} name: {{ .Values.controller.name }}
{{- if .Values.controller.containerSecurityContext }} {{- with .Values.controller.containerSecurityContext }}
securityContext: {{- toYaml .Values.controller.containerSecurityContext | nindent 10 }} securityContext:
{{- toYaml . | nindent 10 }}
{{- end }} {{- end }}
{{- if or .Values.controller.env .Values.externalRedis.password .Values.externalRedis.existingSecret }}
env: env:
{{- include "argo-cd.redisPasswordEnv" . | nindent 8 }}
{{- with .Values.controller.env }} {{- with .Values.controller.env }}
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 10 }}
{{- end }} {{- end }}
{{- end }} - name: ARGOCD_CONTROLLER_REPLICAS
value: {{ .Values.controller.replicas | quote }}
{{- include "argo-cd.redisPasswordEnv" . | nindent 10 }}
{{- with .Values.controller.envFrom }} {{- with .Values.controller.envFrom }}
envFrom: {{- toYaml . | nindent 8 }} envFrom:
{{- toYaml . | nindent 10 }}
{{- end }} {{- end }}
ports: ports:
- name: controller - name: controller
@ -121,29 +123,29 @@ spec:
{{- with .Values.controller.extraContainers }} {{- with .Values.controller.extraContainers }}
{{- toYaml . | nindent 6 }} {{- toYaml . | nindent 6 }}
{{- end }} {{- end }}
{{- if .Values.controller.nodeSelector }} {{- with .Values.controller.nodeSelector }}
nodeSelector: nodeSelector:
{{- toYaml .Values.controller.nodeSelector | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- if .Values.controller.tolerations }} {{- with .Values.controller.tolerations }}
tolerations: tolerations:
{{- toYaml .Values.controller.tolerations | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- if .Values.controller.affinity }} {{- with .Values.controller.affinity }}
affinity: affinity:
{{- toYaml .Values.controller.affinity | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.controller.topologySpreadConstraints }} {{- with .Values.controller.topologySpreadConstraints }}
topologySpreadConstraints: topologySpreadConstraints:
{{- range $constraint := . }} {{- range $constraint := . }}
- {{ toYaml $constraint | nindent 8 | trim }} - {{ toYaml $constraint | nindent 8 | trim }}
{{- if not $constraint.labelSelector }} {{- if not $constraint.labelSelector }}
labelSelector: labelSelector:
matchLabels: matchLabels:
{{- include "argo-cd.selectorLabels" (dict "context" $ "name" $.Values.controller.name) | nindent 12 }} {{- include "argo-cd.selectorLabels" (dict "context" $ "name" $.Values.controller.name) | nindent 12 }}
{{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }}
serviceAccountName: {{ template "argo-cd.controllerServiceAccountName" . }} serviceAccountName: {{ template "argo-cd.controllerServiceAccountName" . }}
{{- with .Values.global.hostAliases }} {{- with .Values.global.hostAliases }}
hostAliases: hostAliases:
@ -164,12 +166,12 @@ spec:
optional: true optional: true
secretName: argocd-repo-server-tls secretName: argocd-repo-server-tls
{{- with .Values.controller.volumes }} {{- with .Values.controller.volumes }}
{{- toYaml . | nindent 6 }} {{- toYaml . | nindent 6 }}
{{- end }} {{- end }}
{{- if .Values.controller.initContainers }} {{- with .Values.controller.initContainers }}
initContainers: initContainers:
{{- toYaml .Values.controller.initContainers | nindent 6 }} {{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.controller.priorityClassName }}
priorityClassName: {{ . }}
{{- end }} {{- end }}
{{- if .Values.controller.priorityClassName }}
priorityClassName: {{ .Values.controller.priorityClassName }}
{{- end }}

View file

@ -119,7 +119,7 @@ controller:
imagePullPolicy: "" imagePullPolicy: ""
# -- The number of application controller pods to run. # -- The number of application controller pods to run.
# If changing the number of replicas you must pass the number as `ARGOCD_CONTROLLER_REPLICAS` as an environment variable # Additional replicas will cause sharding of managed clusters across number of replicas.
replicas: 1 replicas: 1
## Application controller commandline flags ## Application controller commandline flags
@ -146,10 +146,7 @@ controller:
extraArgs: [] extraArgs: []
# -- Environment variables to pass to application controller # -- Environment variables to pass to application controller
env: env: []
[]
# - name: "ARGOCD_CONTROLLER_REPLICAS"
# value: ""
# -- envFrom to pass to application controller # -- envFrom to pass to application controller
# @default -- `[]` (See [values.yaml]) # @default -- `[]` (See [values.yaml])