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

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