Skip to content

Commit f104aa4

Browse files
committed
inject username/password OR token into app-proxy env
1 parent a096f4d commit f104aa4

File tree

12 files changed

+205
-191
lines changed

12 files changed

+205
-191
lines changed

charts/gitops-runtime/templates/_components/cap-app-proxy/_config.yaml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
{{- define "cap-app-proxy.resources.configmap-documented-configs"}}
2-
argoCdUrl: {{ .Values.config.argoCdUrl }}
3-
argoCdUsername: {{ .Values.config.argoCdUsername }}
1+
{{- define "cap-app-proxy.resources.configmap-documented-configs" }}
42
argoWorkflowsInsecure: {{ .Values.config.argoWorkflowsInsecure | quote }}
5-
argoWorkflowsUrl: {{ default "" .Values.config.argoWorkflowsUrl }}
3+
clusterChunkSize: {{ .Values.config.clusterChunkSize | quote }}
64
cors: {{ .Values.global.codefresh.url }}
7-
{{- with .Values.config.clusterChunkSize }}
8-
clusterChunkSize: {{ . | quote }}
9-
{{- end }}
10-
env: {{ .Values.config.env | quote}}
115
isConfigurationRuntime: {{ .Values.global.runtime.isConfigurationRuntime | quote }}
126
isExternalArgoCD: {{ .Values.global.runtime.isExternalArgoCD | quote }}
137
runtimeName: {{ required "global.runtime.name is required" .Values.global.runtime.name | quote}}
8+
isNamespacedRuntime: {{ .Values.global.runtime.singleNamespace | quote }}
149
skipGitPermissionValidation: {{ .Values.config.skipGitPermissionValidation | quote }}
1510
logLevel: {{ .Values.config.logLevel | quote }}
1611
{{- $enrichmentValues := get .Values "image-enrichment" }}
@@ -30,7 +25,7 @@ enrichmentJiraEnrichmentImage: {{ printf "%s/%s:%s" $enrichmentValues.config.ima
3025

3126
{{- define "cap-app-proxy.resources.configmap" }}
3227
{{- $documentedConfigs := (include "cap-app-proxy.resources.configmap-documented-configs" . | fromYaml ) }}
33-
{{- $overrides := omit .Values.config "clusterChunkSize" }}
28+
{{- $overrides := omit .Values.config "argoWorkflowsInsecure" "clusterChunkSize" "cors" "singleNamespace" "skipGitPermissionValidation" }}
3429
{{- $mergedConfig := mergeOverwrite $documentedConfigs $overrides }}
3530
apiVersion: v1
3631
kind: ConfigMap

charts/gitops-runtime/templates/_components/cap-app-proxy/environment-variables/_main-container.yaml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ ARGO_CD_URL:
55
name: cap-app-proxy-cm
66
key: argoCdUrl
77
optional: true
8-
ARGO_CD_TOKEN: {{ include "codefresh-gitops-runtime.argocd.server.token" . | nindent 2 }}
9-
ARGO_CD_USERNAME: {{ include "codefresh-gitops-runtime.argocd.server.username-env-var" . | nindent 2 }}
10-
ARGO_CD_PASSWORD: {{ include "codefresh-gitops-runtime.argocd.server.password" . | nindent 2 }}
118
ARGO_WORKFLOWS_INSECURE:
129
valueFrom:
1310
configMapKeyRef:
@@ -224,8 +221,9 @@ LEADER_ID:
224221
Read defaults from the template above and merge with the values provided in values file
225222
*/}}
226223
{{- define "cap-app-proxy.environment-variables" -}}
227-
{{- $defaults := (include "cap-app-proxy.environment-variables.defaults" . | fromYaml) }}
228-
{{- $overrides := .Values.env }}
229-
{{- $mergedValues := mergeOverwrite $defaults $overrides }}
230-
{{- include "codefresh-gitops-runtime.components.common_helpers.container-templates.env-vars" $mergedValues }}
224+
{{- $defaults := (include "cap-app-proxy.environment-variables.defaults" . | fromYaml) }}
225+
{{- $argoCdAuth := (include "codefresh-gitops-runtime.argocd-auth" . | fromYaml) }}
226+
{{- $overrides := .Values.env }}
227+
{{- $mergedValues := mergeOverwrite $defaults $argoCdAuth $overrides }}
228+
{{- include "codefresh-gitops-runtime.components.common_helpers.container-templates.env-vars" $mergedValues }}
231229
{{- end -}}

charts/gitops-runtime/templates/_components/cf-argocd-extras/event-reporter/_statefulset.yaml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@
1515
{{- $_ := set $context.Values.container.env.REDIS_PASSWORD.valueFrom.secretKeyRef "key" (default "redis-password" $vals.externalRedis.existingSecretKeyRef.key) }}
1616
{{- end }}
1717

18-
{{- if and (eq (index $context.Values "global" "external-argo-cd" "auth" "type") "token") }}
19-
{{- if not (index $context.Values "global" "external-argo-cd" "auth" "token") }}
20-
{{- $_ := set $context.Values.container.env "ARGO_CD_TOKEN_SECRET_NAME" (required ".Values.global.external-argo-cd.auth.type is set to 'token' therefore .Values.global.external-argo-cd.auth.tokenSecretKeyRef.name is required" (index $context.Values "global" "external-argo-cd" "auth" "tokenSecretKeyRef" "name")) }}
21-
{{- $_ := set $context.Values.container.env "ARGO_CD_TOKEN_SECRET_KEY" (required ".Values.global.external-argo-cd.auth.type is set to 'token' therefore .Values.global.external-argo-cd.auth.tokenSecretKeyRef.key is required" (index $context.Values "global" "external-argo-cd" "auth" "tokenSecretKeyRef" "key" )) }}
18+
{{- $argoCdAuth := (index .Values "global" "external-argo-cd" "auth") }}
19+
{{- if (eq $argoCdAuth.type "token") }}
20+
{{- if $argoCdAuth.token }}
21+
{{- $_ := set $context.Values.container.env "ARGO_CD_TOKEN_SECRET_NAME" "gitops-runtime-argo-cd-token" }}
22+
{{- $_ := set $context.Values.container.env "ARGO_CD_TOKEN_SECRET_KEY" "token" }}
23+
{{- else if $argoCdAuth.tokenSecretKeyRef }}
24+
{{- $_ := set $context.Values.container.env "ARGO_CD_TOKEN_SECRET_NAME" (required ".Values.global.external-argo-cd.auth.type is set to 'token' therefore .Values.global.external-argo-cd.auth.tokenSecretKeyRef.name is required" $argoCdAuth.tokenSecretKeyRef.name) }}
25+
{{- $_ := set $context.Values.container.env "ARGO_CD_TOKEN_SECRET_KEY" (required ".Values.global.external-argo-cd.auth.type is set to 'token' therefore .Values.global.external-argo-cd.auth.tokenSecretKeyRef.key is required" $argoCdAuth.tokenSecretKeyRef.key) }}
2226
{{- else }}
23-
{{- $_ := set $context.Values.container.env "ARGO_CD_TOKEN_SECRET_NAME" "gitops-runtime-argo-cd-token" }}
24-
{{- $_ := set $context.Values.container.env "ARGO_CD_TOKEN_SECRET_KEY" "token" }}
27+
{{ fail ".Values.global.external-argo-cd.auth.type is 'token' and .Values.global.external-argo-cd.auth.token or .Values.global.external-argo-cd.auth.tokenSecretKeyRef are not set" }}
2528
{{- end }}
2629
{{- end }}
2730

charts/gitops-runtime/templates/_components/cf-argocd-extras/sources-server/_deployment.yaml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@
1515
{{- $_ := set $context.Values.container.env.REDIS_PASSWORD.valueFrom.secretKeyRef "key" (default "redis-password" $vals.externalRedis.existingSecretKeyRef.key) }}
1616
{{- end }}
1717

18-
{{- if and (eq (index $context.Values "global" "external-argo-cd" "auth" "type") "token") }}
19-
{{- if not (index $context.Values "global" "external-argo-cd" "auth" "token") }}
20-
{{- $_ := set $context.Values.container.env "ARGO_CD_TOKEN_SECRET_NAME" (required ".Values.global.external-argo-cd.auth.type is set to 'token' therefore .Values.global.external-argo-cd.auth.tokenSecretKeyRef.name is required" (index $context.Values "global" "external-argo-cd" "auth" "tokenSecretKeyRef" "name")) }}
21-
{{- $_ := set $context.Values.container.env "ARGO_CD_TOKEN_SECRET_KEY" (required ".Values.global.external-argo-cd.auth.type is set to 'token' therefore .Values.global.external-argo-cd.auth.tokenSecretKeyRef.key is required" (index $context.Values "global" "external-argo-cd" "auth" "tokenSecretKeyRef" "key" )) }}
18+
{{- $argoCdAuth := (index .Values "global" "external-argo-cd" "auth") }}
19+
{{- if (eq $argoCdAuth.type "token") }}
20+
{{- if $argoCdAuth.token }}
21+
{{- $_ := set $context.Values.container.env "ARGO_CD_TOKEN_SECRET_NAME" "gitops-runtime-argo-cd-token" }}
22+
{{- $_ := set $context.Values.container.env "ARGO_CD_TOKEN_SECRET_KEY" "token" }}
23+
{{- else if $argoCdAuth.tokenSecretKeyRef }}
24+
{{- $_ := set $context.Values.container.env "ARGO_CD_TOKEN_SECRET_NAME" (required ".Values.global.external-argo-cd.auth.type is set to 'token' therefore .Values.global.external-argo-cd.auth.tokenSecretKeyRef.name is required" $argoCdAuth.tokenSecretKeyRef.name) }}
25+
{{- $_ := set $context.Values.container.env "ARGO_CD_TOKEN_SECRET_KEY" (required ".Values.global.external-argo-cd.auth.type is set to 'token' therefore .Values.global.external-argo-cd.auth.tokenSecretKeyRef.key is required" $argoCdAuth.tokenSecretKeyRef.key) }}
2226
{{- else }}
23-
{{- $_ := set $context.Values.container.env "ARGO_CD_TOKEN_SECRET_NAME" "gitops-runtime-argo-cd-token" }}
24-
{{- $_ := set $context.Values.container.env "ARGO_CD_TOKEN_SECRET_KEY" "token" }}
27+
{{ fail ".Values.global.external-argo-cd.auth.type is 'token' and .Values.global.external-argo-cd.auth.token or .Values.global.external-argo-cd.auth.tokenSecretKeyRef are not set" }}
2528
{{- end }}
2629
{{- end }}
2730

charts/gitops-runtime/templates/_helpers.tpl

Lines changed: 48 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Determine argocd repo server service name. Must be called with chart root contex
9393
*/}}
9494
{{- define "codefresh-gitops-runtime.argocd.reposerver.servicename" -}}
9595
{{/* For now use template from ArgoCD chart until better approach */}}
96-
{{- if and (index .Subcharts "argo-cd") }}
96+
{{- if (index .Subcharts "argo-cd") }}
9797
{{- template "argo-cd.repoServer.fullname" (dict "Values" (get .Values "argo-cd") "Release" .Release ) }}
9898
{{- else }}
9999
{{- $repoServer := index .Values "global" "external-argo-cd" "repoServer" }}
@@ -107,7 +107,7 @@ Determine argocd argocd repo server port
107107
*/}}
108108
{{- define "codefresh-gitops-runtime.argocd.reposerver.serviceport" -}}
109109
{{/* For now use template from ArgoCD chart until better approach */}}
110-
{{- if and (index .Subcharts "argo-cd") }}
110+
{{- if (index .Subcharts "argo-cd") }}
111111
{{- index .Values "argo-cd" "repoServer" "service" "port" }}
112112
{{- else }}
113113
{{- $repoServer := index .Values "global" "external-argo-cd" "repoServer" }}
@@ -122,11 +122,11 @@ Determine argocd repoServer url
122122
*/}}
123123
{{- define "codefresh-gitops-runtime.argocd.reposerver.url" -}}
124124
{{- $argoCDValues := (get .Values "argo-cd") }}
125-
{{- if and (index .Values "argo-cd" "enabled") }}
125+
{{- if (index .Values "argo-cd" "enabled") }}
126126
{{- $serviceName := include "codefresh-gitops-runtime.argocd.reposerver.servicename" . }}
127127
{{- $port := include "codefresh-gitops-runtime.argocd.reposerver.serviceport" . }}
128128
{{- printf "%s:%s" $serviceName $port }}
129-
{{- else if and (index .Values "global" "external-argo-cd" "repoServer") }}
129+
{{- else if (index .Values "global" "external-argo-cd" "repoServer") }}
130130
{{- $repoServer := (index .Values "global" "external-argo-cd" "repoServer") }}
131131
{{- $svc := required "ArgoCD is not enabled and .Values.global.external-argo-cd.repoServer.svc is not set" $repoServer.svc }}
132132
{{- $port := required "ArgoCD is not enabled and .Values.global.external-argo-cd.repoServer.port is not set" $repoServer.port }}
@@ -149,7 +149,7 @@ Determine argocd servicename. Must be called with chart root context
149149
Determine rollouts name
150150
*/}}
151151
{{- define "codefresh-gitops-runtime.argo-rollouts.name" -}}
152-
{{- if and (index .Values "argo-rollouts" "enabled") }}
152+
{{- if (index .Values "argo-rollouts" "enabled") }}
153153
{{/* For now use template from rollouts chart until better approach */}}
154154
{{- template "argo-rollouts.fullname" (dict "Values" (get .Values "argo-rollouts")) }}
155155
{{- else }}
@@ -189,21 +189,21 @@ Determine argocd redis service port. Must be called with chart root context
189189
Determine argocd server url. Must be called with chart root context
190190
*/}}
191191
{{- define "codefresh-gitops-runtime.argocd.server.url" -}}
192-
{{- if and (index .Values "argo-cd" "enabled") }}
192+
{{- if (index .Values "argo-cd" "enabled") }}
193193
{{- $protocol := "https" }}
194194
{{- $port := include "codefresh-gitops-runtime.argocd.server.serviceport" . }}
195195
{{- if (eq $port "80") }}
196196
{{- $protocol = "http" }}
197197
{{- end }}
198198
{{- $url := include "codefresh-gitops-runtime.argocd.server.no-protocol-url" . }}
199199
{{- printf "%s://%s" $protocol $url }}
200-
{{- else if and (index .Values "global" "external-argo-cd" "server") }}
200+
{{- else if (index .Values "global" "external-argo-cd" "server") }}
201201
{{- $argoCDSrv := (index .Values "global" "external-argo-cd" "server") }}
202202
{{- $protocol := "http" }}
203203
{{- $svc := required "ArgoCD is not enabled and .Values.global.external-argo-cd.server.svc is not set" $argoCDSrv.svc }}
204204
{{- $port := (required "ArgoCD is not enabled and .Values.global.external-argo-cd.server.port is not port" $argoCDSrv.port) | toString }}
205205
{{- $rootpath := (index .Values "global" "external-argo-cd" "server" "rootpath") }}
206-
{{- if and (eq $port "80") }}
206+
{{- if (eq $port "80") }}
207207
{{- printf "%s://%s%s" $protocol $svc $rootpath }}
208208
{{- else }}
209209
{{- printf "%s://%s:%s%s" $protocol $svc $port $rootpath }}
@@ -218,12 +218,12 @@ Determine argocd server url witout the protocol. Must be called with chart root
218218
*/}}
219219
{{- define "codefresh-gitops-runtime.argocd.server.no-protocol-url" -}}
220220
{{- $argoCDValues := (get .Values "argo-cd") }}
221-
{{- if and (index .Values "argo-cd" "enabled") }}
221+
{{- if (index .Values "argo-cd" "enabled") }}
222222
{{- $serverName := include "codefresh-gitops-runtime.argocd.server.servicename" . }}
223223
{{- $port := include "codefresh-gitops-runtime.argocd.server.serviceport" . }}
224224
{{- $path := (get $argoCDValues.configs.params "server.rootpath") }}
225225
{{- printf "%s:%s%s" $serverName $port $path }}
226-
{{- else if and (index .Values "global" "external-argo-cd" "server") }}
226+
{{- else if (index .Values "global" "external-argo-cd" "server") }}
227227
{{- $argoCDSrv := (index .Values "global" "external-argo-cd" "server") }}
228228
{{- $svc := required "ArgoCD is not enabled and .Values.global.external-argo-cd.server.svc is not set" $argoCDSrv.svc }}
229229
{{- $port := required "ArgoCD is not enabled and .Values.global.external-argo-cd.server.port is not set" $argoCDSrv.port }}
@@ -234,95 +234,49 @@ Determine argocd server url witout the protocol. Must be called with chart root
234234
{{- end }}
235235
{{- end}}
236236

237-
{{/*
238-
Determine argocd server password.
239-
*/}}
240-
{{- define "codefresh-gitops-runtime.argocd.server.password" }}
241-
{{- if and (index .Values "argo-cd" "enabled") }}
242-
valueFrom:
243-
secretKeyRef:
244-
name: argocd-initial-admin-secret
245-
key: password
246-
{{- else if and (eq (index .Values "global" "external-argo-cd" "auth" "type") "password") (index .Values "global" "external-argo-cd" "auth" "passwordSecretKeyRef") }}
247-
valueFrom:
248-
secretKeyRef:
249-
{{- index .Values "global" "external-argo-cd" "auth" "passwordSecretKeyRef" | toYaml | nindent 4 }}
250-
{{- else if and (eq (index .Values "global" "external-argo-cd" "auth" "type") "password") (index .Values "global" "external-argo-cd" "auth" "password") }}
251-
valueFrom:
252-
secretKeyRef:
253-
name: gitops-runtime-argo-cd-password
254-
key: token
255-
{{- else if and (eq (index .Values "global" "external-argo-cd" "auth" "type") "token") (index .Values "global" "external-argo-cd" "auth" "token") }}
256-
valueFrom:
257-
secretKeyRef:
258-
name: gitops-runtime-argo-cd-token
259-
key: token
260-
{{- else if and (eq (index .Values "global" "external-argo-cd" "auth" "type") "token") (index .Values "global" "external-argo-cd" "auth" "tokenSecretKeyRef") }}
261-
valueFrom:
262-
secretKeyRef:
263-
{{- index .Values "global" "external-argo-cd" "auth" "tokenSecretKeyRef" | toYaml | nindent 4 }}
264-
optional: true
265-
{{- else }}
266-
{{ fail "ArgoCD is not enabled and .Values.global.external-argo-cd.auth.password or .Values.global.external-argo-cd.auth.passwordSecretKeyRef is not set" }}
267-
{{- end }}
268-
{{- end }}
269-
270-
271-
{{/*
272-
Determine argocd token password.
273-
*/}}
274-
{{- define "codefresh-gitops-runtime.argocd.server.token" }}
275-
{{- if and (eq (index .Values "global" "external-argo-cd" "auth" "type") "token") (index .Values "global" "external-argo-cd" "auth" "tokenSecretKeyRef" "name") (index .Values "global" "external-argo-cd" "auth" "tokenSecretKeyRef" "key")}}
276-
valueFrom:
277-
secretKeyRef:
278-
{{- index .Values "global" "external-argo-cd" "auth" "tokenSecretKeyRef" | toYaml | nindent 4 }}
279-
{{- else if and (eq (index .Values "global" "external-argo-cd" "auth" "type") "token") (index .Values "global" "external-argo-cd" "auth" "token") }}
280-
valueFrom:
281-
secretKeyRef:
282-
name: gitops-runtime-argo-cd-token
283-
key: token
284-
{{- else if or (eq (index .Values "global" "external-argo-cd" "auth" "type") "password") }}
285-
valueFrom:
286-
secretKeyRef:
287-
name: argocd-token
288-
key: token
289-
optional: true
290-
{{- else }}
291-
{{ fail (printf "Invalid value for .Values.global.external-argo-cd.auth.type: %s. Allowed values are: [password token]" (index .Values "global" "external-argo-cd" "auth" "type")) }}
292-
{{- end }}
293-
{{- end }}
294-
295-
{{/*
296-
Determine argocd server password.
297-
*/}}
298-
{{- define "codefresh-gitops-runtime.argocd.server.username-env-var" }}
299-
{{- if and (index .Values "argo-cd" "enabled") }}
300-
valueFrom:
301-
configMapKeyRef:
302-
name: cap-app-proxy-cm
303-
key: argoCdUsername
304-
optional: true
305-
{{- else if and (index .Values "global" "external-argo-cd" "auth" "usernameSecretKeyRef") }}
306-
valueFrom:
307-
secretKeyRef:
308-
{{- index .Values "global" "external-argo-cd" "auth" "usernameSecretKeyRef" | toYaml | nindent 4 }}
309-
{{- else if and (index .Values "global" "external-argo-cd" "auth" "username") }}
310-
{{- printf "%s" (index .Values "global" "external-argo-cd" "auth" "username") }}
237+
{{- define "codefresh-gitops-runtime.argocd-auth" -}}
238+
{{- $authValues := (index .Values "global" "external-argo-cd" "auth") }}
239+
{{- if (eq $authValues.type "password") }}
240+
ARGO_CD_USERNAME:
241+
valueFrom:
242+
configMapKeyRef:
243+
name: cap-app-proxy-cm
244+
key: argoCdUsername
245+
ARGO_CD_PASSWORD:
246+
valueFrom:
247+
secretKeyRef:
248+
{{- if $authValues.password }}
249+
name: gitops-runtime-argo-cd-password
250+
key: token
251+
{{- else if $authValues.passwordSecretKeyRef }}
252+
{{- $authValues.passwordSecretKeyRef | toYaml | nindent 6 }}
253+
{{- end }}
254+
{{- else if (eq $authValues.type "token") }}
255+
ARGO_CD_TOKEN:
256+
valueFrom:
257+
secretKeyRef:
258+
{{- if $authValues.token }}
259+
name: gitops-runtime-argo-cd-token
260+
key: token
261+
{{- else if $authValues.tokenSecretKeyRef }}
262+
{{- if and (hasKey $authValues.tokenSecretKeyRef "name") (hasKey $authValues.tokenSecretKeyRef "key") }}
263+
{{- $authValues.tokenSecretKeyRef | toYaml | nindent 6 }}
264+
{{- else }}
265+
{{- fail "Both 'name' and 'key' must be set in .Values.global.external-argo-cd.auth.tokenSecretKeyRef" }}
266+
{{- end }}
267+
{{- end }}
311268
{{- else }}
312-
{{ fail "ArgoCD is not enabled and .Values.global.external-argo-cd.auth.username or .Values.global.external-argo-cd.auth.usernameSecretKeyRef is not set" }}
269+
{{ fail (printf "Invalid value for .Values.global.external-argo-cd.auth.type: %s. Allowed values are: [password token]" $authValues.type) }}
313270
{{- end }}
314271
{{- end }}
315272

316273
{{/*
317-
Determine argocd server password.
274+
Determine argocd server username ConfigMap.
318275
*/}}
319276
{{- define "codefresh-gitops-runtime.argocd.server.username-cm" }}
320-
{{- if and (index .Values "argo-cd" "enabled") }}
321-
{{- printf "%s" (index .Values "app-proxy" "config" "argoCdUsername") }}
322-
{{- else if and (index .Values "global" "external-argo-cd" "auth" "username") }}
323-
{{- printf "%s" (index .Values "global" "external-argo-cd" "auth" "username") }}
324-
{{- else }}
325-
{{- fail "ArgoCD is not enabled and .Values.global.external-argo-cd.auth.username is not set" }}
277+
{{- $externalArgoCDValues := (index .Values "global" "external-argo-cd" "auth") }}
278+
{{- if (eq $externalArgoCDValues.type "password") }}
279+
{{- coalesce (index .Values "app-proxy" "config" "argoCdUsername") (index .Values "global" "external-argo-cd" "auth" "username") "" }}
326280
{{- end }}
327281
{{- end }}
328282

@@ -331,11 +285,11 @@ Determine argocd redis url
331285
*/}}
332286
{{- define "codefresh-gitops-runtime.argocd.redis.url" -}}
333287
{{- $argoCDValues := (get .Values "argo-cd") }}
334-
{{- if and (index .Values "argo-cd" "enabled") }}
288+
{{- if (index .Values "argo-cd" "enabled") }}
335289
{{- $serviceName := include "codefresh-gitops-runtime.argocd.redis.servicename" . }}
336290
{{- $port := include "codefresh-gitops-runtime.argocd.redis.serviceport" . }}
337291
{{- printf "%s:%s" $serviceName $port }}
338-
{{- else if and (index .Values "global" "external-argo-cd" "redis") }}
292+
{{- else if (index .Values "global" "external-argo-cd" "redis") }}
339293
{{- $redis := (index .Values "global" "external-argo-cd" "redis") }}
340294
{{- $svc := required "ArgoCD is not enabled and .Values.global.external-argo-cd.redis.svc is not set" $redis.svc }}
341295
{{- $port := required "ArgoCD is not enabled and .Values.global.external-argo-cd.redis.port is not set" $redis.port }}

charts/gitops-runtime/templates/app-proxy/config.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
{{- if not $appProxyContext.Values.config.argoCdUrl }}
88
{{ $_ := set $appProxyContext.Values.config "argoCdUrl" $argoCdUrl }}
99
{{- end }}
10-
{{- $_ := set $appProxyContext.Values.config "argoCdUsername" $argoCdUsername }}
10+
{{- if $argoCdUsername }}
11+
{{- $_ := set $appProxyContext.Values.config "argoCdUsername" $argoCdUsername }}
12+
{{- else }}
13+
{{ $_ := unset $appProxyContext.Values.config "argoCdUsername" }}
14+
{{- end }}
1115
{{- if index (get .Values "argo-workflows") "enabled" }}
1216
{{- if not $appProxyContext.Values.config.argoWorkflowsUrl }}
1317
{{- $argoWorkflowsUrl := include "codefresh-gitops-runtime.argo-workflows.server.url" . }}

0 commit comments

Comments
 (0)