Skip to content

Commit 0e0f0c8

Browse files
committed
fix: don't use protocol for ARGO_CD_URL in gitops-operator (#332)
1 parent 2b3386c commit 0e0f0c8

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

charts/gitops-runtime/templates/_helpers.tpl

+13-4
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,24 @@ Determine argocd server service port. Must be called with chart root context
135135
Determine argocd server url. Must be called with chart root context
136136
*/}}
137137
{{- define "codefresh-gitops-runtime.argocd.server.url" -}}
138-
{{- $argoCDValues := (get .Values "argo-cd") }}
139138
{{- $protocol := "https" }}
140-
{{- $serverName := include "codefresh-gitops-runtime.argocd.server.servicename" . }}
141139
{{- $port := include "codefresh-gitops-runtime.argocd.server.serviceport" . }}
142-
{{- $path := (get $argoCDValues.configs.params "server.rootpath") }}
143140
{{- if (eq $port "80") }}
144141
{{- $protocol = "http" }}
145142
{{- end }}
146-
{{- printf "%s://%s:%s%s" $protocol $serverName $port $path }}
143+
{{- $url := include "codefresh-gitops-runtime.argocd.server.no-protocol-url" . }}
144+
{{- printf "%s://%s" $protocol $url }}
145+
{{- end}}
146+
147+
{{/*
148+
Determine argocd server url witout the protocol. Must be called with chart root context
149+
*/}}
150+
{{- define "codefresh-gitops-runtime.argocd.server.no-protocol-url" -}}
151+
{{- $argoCDValues := (get .Values "argo-cd") }}
152+
{{- $serverName := include "codefresh-gitops-runtime.argocd.server.servicename" . }}
153+
{{- $port := include "codefresh-gitops-runtime.argocd.server.serviceport" . }}
154+
{{- $path := (get $argoCDValues.configs.params "server.rootpath") }}
155+
{{- printf "%s:%s%s" $serverName $port $path }}
147156
{{- end}}
148157

149158
{{/*

charts/gitops-runtime/templates/gitops-operator.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
{{/* Set argo-cd-server service and port */}}
2020
{{ if not (index .Values "gitops-operator").env.ARGO_CD_URL }}
21-
{{- $_ := set $gitopsOperatorContext.Values.env "ARGO_CD_URL" (include "codefresh-gitops-runtime.argocd.server.url" . ) }}
21+
{{- $_ := set $gitopsOperatorContext.Values.env "ARGO_CD_URL" (include "codefresh-gitops-runtime.argocd.server.no-protocol-url" . ) }}
2222
{{- end }}
2323

2424
{{/* Set workflows url */}}

charts/gitops-runtime/tests/gitops-controller-misc_test.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ tests:
329329
path: spec.template.spec.containers[1].env
330330
content:
331331
name: ARGO_CD_URL
332-
value: http://myargocd-server:80/some-path
332+
value: myargocd-server:80/some-path
333333

334334
- it: contains all resources for notifications controller
335335
template: gitops-operator.yaml
@@ -371,11 +371,11 @@ tests:
371371
argo-cd.configs.params:
372372
server.rootpath: /some-path
373373
argo-cd.fullnameOverride: myargocd
374-
gitops-operator.env.ARGO_CD_URL: http://some-other-url
374+
gitops-operator.env.ARGO_CD_URL: some-other-url:123
375375
asserts:
376376
- contains:
377377
path: spec.template.spec.containers[1].env
378378
content:
379379
name: ARGO_CD_URL
380-
value: http://some-other-url
380+
value: some-other-url:123
381381

0 commit comments

Comments
 (0)