feat(argo-cd): Add ability to use an external redis instance (#1150)

Signed-off-by: Marco Kilchhofer <mkilchhofer@users.noreply.github.com>
This commit is contained in:
Marco Kilchhofer 2022-03-31 14:18:54 +02:00 committed by GitHub
parent f47bab3acc
commit 58926e3d79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 88 additions and 10 deletions

View file

@ -270,3 +270,17 @@ Create the name of the configmap to use
{{ default "argocd-notifications-cm" .Values.notifications.cm.name }}
{{- end -}}
{{- end -}}
{{- define "argo-cd.redisPasswordEnv" -}}
{{- if or .Values.externalRedis.password .Values.externalRedis.existingSecret }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
{{- if .Values.externalRedis.existingSecret }}
name: {{ .Values.externalRedis.existingSecret }}
{{- else }}
name: {{ template "argo-cd.redis.fullname" . }}
{{- end }}
key: redis-password
{{- end }}
{{- end -}}

View file

@ -65,6 +65,9 @@ spec:
{{- if or (and .Values.redis.enabled (not $redisHa.enabled)) (and $redisHa.enabled $redisHa.haproxy.enabled) }}
- --redis
- {{ template "argo-cd.redis.fullname" . }}:{{ .Values.redis.servicePort }}
{{- else if and .Values.externalRedis.host .Values.externalRedis.port }}
- --redis
- {{ .Values.externalRedis.host }}:{{ .Values.externalRedis.port }}
{{- end }}
{{- with .Values.controller.extraArgs }}
{{- . | toYaml | nindent 8 }}
@ -75,9 +78,12 @@ spec:
{{- if .Values.controller.containerSecurityContext }}
securityContext: {{- toYaml .Values.controller.containerSecurityContext | nindent 10 }}
{{- end }}
{{- if .Values.controller.env }}
{{- if or .Values.controller.env .Values.externalRedis.password .Values.externalRedis.existingSecret }}
env:
{{- toYaml .Values.controller.env | nindent 8 }}
{{- include "argo-cd.redisPasswordEnv" . | nindent 8 }}
{{- with .Values.controller.env }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- with .Values.controller.envFrom }}
envFrom: {{- toYaml . | nindent 8 }}

View file

@ -0,0 +1,11 @@
{{- if and .Values.externalRedis.password (not .Values.externalRedis.existingSecret) }}
apiVersion: v1
kind: Secret
metadata:
name: {{ template "argo-cd.redis.fullname" . }}
labels:
{{- include "argo-cd.labels" (dict "context" $) | nindent 4 }}
type: Opaque
data:
redis-password: {{ .Values.externalRedis.password | b64enc }}
{{- end }}

View file

@ -47,6 +47,9 @@ spec:
{{- if or (and .Values.redis.enabled (not $redisHa.enabled)) (and $redisHa.enabled $redisHa.haproxy.enabled) }}
- --redis
- {{ template "argo-cd.redis.fullname" . }}:{{ .Values.redis.servicePort }}
{{- else if and .Values.externalRedis.host .Values.externalRedis.port }}
- --redis
- {{ .Values.externalRedis.host }}:{{ .Values.externalRedis.port }}
{{- end }}
- --logformat
- {{ .Values.repoServer.logFormat }}
@ -65,9 +68,10 @@ spec:
value: /helm-working-dir
- name: HELM_DATA_HOME
value: /helm-working-dir
{{- if .Values.repoServer.env }}
{{- toYaml .Values.repoServer.env | nindent 8 }}
{{- end }}
{{- include "argo-cd.redisPasswordEnv" . | nindent 8 }}
{{- with .Values.repoServer.env }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.openshift.enabled }}
- name: USER_NAME
value: argocd

View file

@ -59,6 +59,9 @@ spec:
{{- if or (and .Values.redis.enabled (not $redisHa.enabled)) (and $redisHa.enabled $redisHa.haproxy.enabled) }}
- --redis
- {{ template "argo-cd.redis.fullname" . }}:{{ .Values.redis.servicePort }}
{{- else if and .Values.externalRedis.host .Values.externalRedis.port }}
- --redis
- {{ .Values.externalRedis.host }}:{{ .Values.externalRedis.port }}
{{- end }}
{{- with .Values.server.extraArgs }}
{{- . | toYaml | nindent 8 }}
@ -66,9 +69,12 @@ spec:
{{- if .Values.server.containerSecurityContext }}
securityContext: {{- toYaml .Values.server.containerSecurityContext | nindent 10 }}
{{- end }}
{{- if .Values.server.env }}
{{- if or .Values.server.env .Values.externalRedis.password .Values.externalRedis.existingSecret }}
env:
{{- toYaml .Values.server.env | nindent 8 }}
{{- include "argo-cd.redisPasswordEnv" . | nindent 8 }}
{{- with .Values.server.env }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- with .Values.server.envFrom }}
envFrom: {{- toYaml . | nindent 8 }}