Skip to content

Commit 8cfb23a

Browse files
feat: external argocd unders .values.global.integrations (#808)
1 parent b591709 commit 8cfb23a

File tree

12 files changed

+147
-161
lines changed

12 files changed

+147
-161
lines changed

charts/gitops-runtime/README.md

Lines changed: 42 additions & 19 deletions
Large diffs are not rendered by default.

charts/gitops-runtime/README.md.gotmpl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,4 +399,25 @@ argo-gateway:
399399
...
400400
```
401401

402+
- `.Values.global.external-argo-cd` was changed to `.Values.global.integrations.argo-cd`
403+
404+
```yaml
405+
# Before:
406+
global:
407+
external-argo-cd:
408+
server:
409+
svc: argocd-server
410+
port: 80
411+
...
412+
413+
# After:
414+
global:
415+
integrations:
416+
argo-cd:
417+
server:
418+
svc: argocd-server
419+
port: 80
420+
...
421+
```
422+
402423
{{ template "chart.valuesSection" . }}

charts/gitops-runtime/templates/_helpers.tpl

Lines changed: 37 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -77,28 +77,18 @@ Create the name of the service account to use
7777
Determine argocd server service name. Must be called with chart root context
7878
*/}}
7979
{{- define "codefresh-gitops-runtime.argocd.server.servicename" -}}
80-
{{/* For now use template from ArgoCD chart until better approach */}}
81-
{{- template "argo-cd.server.fullname" (dict "Values" (get .Values "argo-cd") "Release" .Release ) }}
82-
{{- end }}
83-
84-
{{/*
85-
Determine argocd redis service name. Must be called with chart root context
86-
*/}}
87-
{{- define "codefresh-gitops-runtime.argocd.redis.servicename" -}}
88-
{{/* For now use template from ArgoCD chart until better approach */}}
89-
{{- template "argo-cd.redis.fullname" (dict "Values" (get .Values "argo-cd") "Release" .Release ) }}
80+
{{- printf "%s-%s" (index .Values "argo-cd" "fullnameOverride") (index .Values "argo-cd" "server" "name") }}
9081
{{- end }}
9182

9283
{{/*
9384
Determine argocd repo server service name. Must be called with chart root context
9485
*/}}
9586
{{- define "codefresh-gitops-runtime.argocd.reposerver.servicename" -}}
96-
{{/* For now use template from ArgoCD chart until better approach */}}
9787
{{- if (index .Subcharts "argo-cd") }}
98-
{{- template "argo-cd.repoServer.fullname" (dict "Values" (get .Values "argo-cd") "Release" .Release ) }}
88+
{{- printf "%s-%s" (index .Values "argo-cd" "fullnameOverride") (index .Values "argo-cd" "repoServer" "name") }}
9989
{{- else }}
100-
{{- $repoServer := index .Values "global" "external-argo-cd" "repoServer" }}
101-
{{- $svc := required "ArgoCD is not enabled and .Values.global.external-argo-cd.repoServer.svc is not set" $repoServer.svc }}
90+
{{- $repoServer := index .Values "global" "integrations" "argo-cd" "repoServer" }}
91+
{{- $svc := required ".Values.global.integrations.argo-cd.repoServer.svc is not set" $repoServer.svc }}
10292
{{- printf "%s" $svc }}
10393
{{- end }}
10494
{{- end }}
@@ -107,12 +97,11 @@ Determine argocd repo server service name. Must be called with chart root contex
10797
Determine argocd argocd repo server port
10898
*/}}
10999
{{- define "codefresh-gitops-runtime.argocd.reposerver.serviceport" -}}
110-
{{/* For now use template from ArgoCD chart until better approach */}}
111100
{{- if (index .Subcharts "argo-cd") }}
112101
{{- index .Values "argo-cd" "repoServer" "service" "port" }}
113102
{{- else }}
114-
{{- $repoServer := index .Values "global" "external-argo-cd" "repoServer" }}
115-
{{- $port := required "ArgoCD is not enabled and .Values.global.external-argo-cd.repoServer.svc is not set" $repoServer.port }}
103+
{{- $repoServer := index .Values "global" "integrations" "argo-cd" "repoServer" }}
104+
{{- $port := required ".Values.global.integrations.argo-cd.repoServer.svc is not set" $repoServer.port }}
116105
{{- printf "%v" $port }}
117106
{{- end }}
118107
{{- end }}
@@ -122,30 +111,18 @@ Determine argocd argocd repo server port
122111
Determine argocd repoServer url
123112
*/}}
124113
{{- define "codefresh-gitops-runtime.argocd.reposerver.url" -}}
125-
{{- $argoCDValues := (get .Values "argo-cd") }}
126-
{{- if (index .Values "argo-cd" "enabled") }}
127-
{{- $serviceName := include "codefresh-gitops-runtime.argocd.reposerver.servicename" . }}
128-
{{- $port := include "codefresh-gitops-runtime.argocd.reposerver.serviceport" . }}
129-
{{- printf "%s:%s" $serviceName $port }}
130-
{{- else if (index .Values "global" "external-argo-cd" "repoServer") }}
131-
{{- $repoServer := (index .Values "global" "external-argo-cd" "repoServer") }}
132-
{{- $svc := required "ArgoCD is not enabled and .Values.global.external-argo-cd.repoServer.svc is not set" $repoServer.svc }}
133-
{{- $port := required "ArgoCD is not enabled and .Values.global.external-argo-cd.repoServer.port is not set" $repoServer.port }}
134-
{{- printf "%s:%v" $svc $port }}
135-
{{- else }}
136-
{{- fail "ArgoCD is not enabled and .Values.global.external-argo-cd.repoServer is not set" }}
137-
{{- end }}
114+
{{- if (index .Values "argo-cd" "enabled") }}
115+
{{- $serviceName := include "codefresh-gitops-runtime.argocd.reposerver.servicename" . }}
116+
{{- $port := include "codefresh-gitops-runtime.argocd.reposerver.serviceport" . }}
117+
{{- printf "%s:%s" $serviceName $port }}
118+
{{- else }}
119+
{{- $repoServer := (index .Values "global" "integrations" "argo-cd" "repoServer") }}
120+
{{- $svc := required ".Values.global.integrations.argo-cd.repoServer.svc is not set" $repoServer.svc }}
121+
{{- $port := required ".Values.global.integrations.argo-cd.repoServer.port is not set" $repoServer.port }}
122+
{{- printf "%s:%v" $svc $port }}
123+
{{- end }}
138124
{{- end}}
139125

140-
141-
{{/*
142-
Determine argocd servicename. Must be called with chart root context
143-
*/}}
144-
{{- define "codefresh-gitops-runtime.argocd.appcontroller.serviceAccountName" -}}
145-
{{/* For now use template from ArgoCD chart until better approach */}}
146-
{{- template "argo-cd.controllerServiceAccountName" (dict "Values" (get .Values "argo-cd") "Release" .Release ) }}
147-
{{- end }}
148-
149126
{{/*
150127
Determine rollouts name
151128
*/}}
@@ -158,7 +135,6 @@ Determine rollouts name
158135
{{- end }}
159136
{{- end }}
160137

161-
162138
{{/*
163139
Determine argocd server service port. Must be called with chart root context
164140
*/}}
@@ -174,7 +150,7 @@ Determine argocd server service port. Must be called with chart root context
174150
{{- end }}
175151
{{- end }}
176152
{{- end }}
177-
{{- print $port }}
153+
{{- printf "%v" $port }}
178154
{{- end}}
179155

180156
{{/*
@@ -183,7 +159,7 @@ Determine argocd redis service port. Must be called with chart root context
183159
{{- define "codefresh-gitops-runtime.argocd.redis.serviceport" -}}
184160
{{- $argoCDValues := (get .Values "argo-cd") }}
185161
{{- $port := $argoCDValues.redis.servicePort }}
186-
{{- print $port }}
162+
{{- printf "%v" $port }}
187163
{{- end}}
188164

189165
{{/*
@@ -198,41 +174,37 @@ Determine argocd server url. Must be called with chart root context
198174
{{- end }}
199175
{{- $url := include "codefresh-gitops-runtime.argocd.server.no-protocol-url" . }}
200176
{{- printf "%s://%s" $protocol $url }}
201-
{{- else if (index .Values "global" "external-argo-cd" "server") }}
202-
{{- $argoCDSrv := (index .Values "global" "external-argo-cd" "server") }}
177+
{{- else }}
178+
{{- $argoCDSrv := (index .Values "global" "integrations" "argo-cd" "server") }}
203179
{{- $protocol := "http" }}
204-
{{- $svc := required "ArgoCD is not enabled and .Values.global.external-argo-cd.server.svc is not set" $argoCDSrv.svc }}
205-
{{- $port := (required "ArgoCD is not enabled and .Values.global.external-argo-cd.server.port is not port" $argoCDSrv.port) | toString }}
206-
{{- $rootpath := (index .Values "global" "external-argo-cd" "server" "rootpath") }}
180+
{{- $svc := required ".Values.global.integrations.argo-cd.server.svc is not set" $argoCDSrv.svc }}
181+
{{- $port := (required ".Values.global.integrations.argo-cd.server.port is not set" $argoCDSrv.port) | toString }}
182+
{{- $rootpath := (index .Values "global" "integrations" "argo-cd" "server" "rootpath") }}
207183
{{- if (eq $port "80") }}
208184
{{- printf "%s://%s%s" $protocol $svc $rootpath }}
209185
{{- else }}
210-
{{- printf "%s://%s:%s%s" $protocol $svc $port $rootpath }}
186+
{{- printf "%s://%s:%v%s" $protocol $svc $port $rootpath }}
211187
{{- end }}
212-
{{- else }}
213-
{{- fail "ArgoCD is not enabled and .Values.global.external-argo-cd.server is not set" }}
214188
{{- end }}
215189
{{- end}}
216190

217191
{{/*
218192
Determine argocd server url witout the protocol. Must be called with chart root context
219193
*/}}
220194
{{- define "codefresh-gitops-runtime.argocd.server.no-protocol-url" -}}
221-
{{- $argoCDValues := (get .Values "argo-cd") }}
222-
{{- if (index .Values "argo-cd" "enabled") }}
223-
{{- $serverName := include "codefresh-gitops-runtime.argocd.server.servicename" . }}
224-
{{- $port := include "codefresh-gitops-runtime.argocd.server.serviceport" . }}
225-
{{- $path := (get $argoCDValues.configs.params "server.rootpath") }}
226-
{{- printf "%s:%s%s" $serverName $port $path }}
227-
{{- else if (index .Values "global" "external-argo-cd" "server") }}
228-
{{- $argoCDSrv := (index .Values "global" "external-argo-cd" "server") }}
229-
{{- $svc := required "ArgoCD is not enabled and .Values.global.external-argo-cd.server.svc is not set" $argoCDSrv.svc }}
230-
{{- $port := required "ArgoCD is not enabled and .Values.global.external-argo-cd.server.port is not set" $argoCDSrv.port }}
231-
{{- $rootpath := (index .Values "global" "external-argo-cd" "server" "rootpath") }}
232-
{{- printf "%s:%v%s" $svc $port $rootpath }}
233-
{{- else }}
234-
{{- fail "ArgoCD is not enabled and .Values.global.external-argo-cd.server is not set" }}
235-
{{- end }}
195+
{{- $argoCDValues := (get .Values "argo-cd") }}
196+
{{- if (index .Values "argo-cd" "enabled") }}
197+
{{- $serverName := include "codefresh-gitops-runtime.argocd.server.servicename" . }}
198+
{{- $port := include "codefresh-gitops-runtime.argocd.server.serviceport" . }}
199+
{{- $path := (get $argoCDValues.configs.params "server.rootpath") }}
200+
{{- printf "%s:%s%s" $serverName $port $path }}
201+
{{- else }}
202+
{{- $argoCDSrv := (index .Values "global" "integrations" "argo-cd" "server") }}
203+
{{- $svc := required ".Values.global.integrations.argo-cd.server.svc is not set" $argoCDSrv.svc }}
204+
{{- $port := required ".Values.global.integrations.argo-cd.server.port is not set" $argoCDSrv.port }}
205+
{{- $rootpath := (index .Values "global" "integrations" "argo-cd" "server" "rootpath") }}
206+
{{- printf "%s:%v%s" $svc $port $rootpath }}
207+
{{- end }}
236208
{{- end}}
237209

238210
{{- define "codefresh-gitops-runtime.argocd-auth" -}}

charts/gitops-runtime/templates/argo-gateway/_env.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ARGO_CD_TOKEN_SECRET_KEY: "token"
1313
{{- end }}
1414
{{- end }}
1515

16-
ARGOCD_SERVER_ROOTPATH: {{ dig "server" "rootpath" "/" (index .Values "global" "external-argo-cd") | quote }}
16+
ARGOCD_SERVER_ROOTPATH: {{ dig "server" "rootpath" "/" (index .Values "global" "integrations" "argo-cd") | quote }}
1717

1818
{{- if or .Values.global.codefresh.tls.caCerts.secret.create (and .Values.global.codefresh.tls.caCerts.secretKeyRef.key .Values.global.codefresh.tls.caCerts.secretKeyRef.name) }}
1919
{{- $secretKey := .Values.global.codefresh.tls.caCerts.secret.create | ternary (default "ca-bundle.crt" .Values.global.codefresh.tls.caCerts.secret.key) .Values.global.codefresh.tls.caCerts.secretKeyRef.key }}

charts/gitops-runtime/templates/event-reporters/cluster-event-reporter/_env.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ARGO_CD_TOKEN_SECRET_KEY: "token"
1313
{{- end }}
1414
{{- end }}
1515

16-
ARGOCD_SERVER_ROOTPATH: {{ dig "server" "rootpath" "/" (index .Values "global" "external-argo-cd") | quote }}
16+
ARGOCD_SERVER_ROOTPATH: {{ dig "server" "rootpath" "/" (index .Values "global" "integrations" "argo-cd") | quote }}
1717

1818
{{- if or .Values.global.codefresh.tls.caCerts.secret.create (and .Values.global.codefresh.tls.caCerts.secretKeyRef.key .Values.global.codefresh.tls.caCerts.secretKeyRef.name) }}
1919
{{- $secretKey := .Values.global.codefresh.tls.caCerts.secret.create | ternary (default "ca-bundle.crt" .Values.global.codefresh.tls.caCerts.secret.key) .Values.global.codefresh.tls.caCerts.secretKeyRef.key }}

charts/gitops-runtime/templates/event-reporters/runtime-event-reporter/_env.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ARGO_CD_TOKEN_SECRET_KEY: "token"
1313
{{- end }}
1414
{{- end }}
1515

16-
ARGOCD_SERVER_ROOTPATH: {{ dig "server" "rootpath" "/" (index .Values "global" "external-argo-cd") | quote }}
16+
ARGOCD_SERVER_ROOTPATH: {{ dig "server" "rootpath" "/" (index .Values "global" "integrations" "argo-cd") | quote }}
1717

1818
{{- if or .Values.global.codefresh.tls.caCerts.secret.create (and .Values.global.codefresh.tls.caCerts.secretKeyRef.key .Values.global.codefresh.tls.caCerts.secretKeyRef.name) }}
1919
{{- $secretKey := .Values.global.codefresh.tls.caCerts.secret.create | ternary (default "ca-bundle.crt" .Values.global.codefresh.tls.caCerts.secret.key) .Values.global.codefresh.tls.caCerts.secretKeyRef.key }}

charts/gitops-runtime/templates/hooks/pre-install/_env.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ NAMESPACE:
1515
{{- define "installer.validate-values.environment-variables.defaults" -}}
1616
ARGOCD_CHECK_VERSION: {{ not (get .Values "argo-cd").enabled | quote }}
1717
ARGOCD_LABELS: "{{ range $k, $v := .Values.installer.argoCdVersionCheck.argoServerLabels }}{{ $k }}={{ $v }},{{ end }}"
18-
ARGOCD_SERVER_ROOTPATH: {{ dig "server" "rootpath" "/" (index .Values "global" "external-argo-cd") | quote }}
18+
ARGOCD_SERVER_ROOTPATH: {{ dig "server" "rootpath" "/" (index .Values "global" "integrations" "argo-cd") | quote }}
1919
ARGOCD_VERSION_PATH: "/api/version"
2020
CHART_VERSION: {{ .Chart.Version }}
2121
NAMESPACE:

charts/gitops-runtime/tests/argo-api-gateway_test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ tests:
1010
asserts:
1111
- equal:
1212
path: data["argocd.server"]
13-
value: argo-cd-server:80
13+
value: argocd-server:80
1414
- equal:
1515
path: data["redis.server"]
1616
value: runtime-redis:6379
1717
- equal:
1818
path: data["repo.server"]
19-
value: argo-cd-repo-server:8081
19+
value: argocd-repo-server:8081
2020

2121
- it: Argo Api Gateway Deployment should have valid matchLabel selectors
2222
template: argo-gateway/deployment.yaml

charts/gitops-runtime/tests/event-reporters_test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ tests:
3737
asserts:
3838
- equal:
3939
path: data["argocd.server"]
40-
value: argo-cd-server:80
40+
value: argocd-server:80
4141
- equal:
4242
path: data["redis.server"]
4343
value: runtime-redis:6379
4444
- equal:
4545
path: data["repo.server"]
46-
value: argo-cd-repo-server:8081
46+
value: argocd-repo-server:8081
4747

4848
- it: Runtime Reporter ConfigMap should have valid redis-ha url
4949
template: event-reporters/runtime-event-reporter/configmap.yaml

charts/gitops-runtime/tests/external_argocd_test.yaml

Lines changed: 16 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -675,18 +675,6 @@ tests:
675675
name: ARGO_CD_TOKEN_SECRET_KEY
676676
value: token
677677

678-
- it: should require ArgoCd repoServer address if it's not provided
679-
values:
680-
- ./values/mandatory-values-ingress.yaml
681-
- ./values/external-argocd-values.yaml
682-
set:
683-
global:
684-
external-argo-cd:
685-
repoServer: null
686-
asserts:
687-
- failedTemplate:
688-
errorMessage: "ArgoCD is not enabled and .Values.global.external-argo-cd.repoServer is not set"
689-
690678
- it: should required only allowed auth type for external ArgoCd
691679
values:
692680
- ./values/mandatory-values-ingress.yaml
@@ -709,9 +697,10 @@ tests:
709697
- ./values/external-argocd-values.yaml
710698
set:
711699
global:
712-
external-argo-cd:
713-
server:
714-
rootpath: /argocd
700+
integrations:
701+
argo-cd:
702+
server:
703+
rootpath: /argocd
715704
asserts:
716705
- contains:
717706
path: spec.template.spec.containers[0].env
@@ -726,9 +715,10 @@ tests:
726715
- ./values/external-argocd-values.yaml
727716
set:
728717
global:
729-
external-argo-cd:
730-
server:
731-
rootpath: /argocd
718+
integrations:
719+
argo-cd:
720+
server:
721+
rootpath: /argocd
732722
asserts:
733723
- contains:
734724
path: spec.template.spec.containers[0].env
@@ -743,9 +733,10 @@ tests:
743733
template: app-proxy/config.yaml
744734
set:
745735
global:
746-
external-argo-cd:
747-
server:
748-
rootpath: /argocd
736+
integrations:
737+
argo-cd:
738+
server:
739+
rootpath: /argocd
749740
asserts:
750741
- equal:
751742
path: data.argoCdUrl
@@ -758,9 +749,10 @@ tests:
758749
- ./values/external-argocd-values.yaml
759750
set:
760751
global:
761-
external-argo-cd:
762-
server:
763-
rootpath: /argocd
752+
integrations:
753+
argo-cd:
754+
server:
755+
rootpath: /argocd
764756
asserts:
765757
- contains:
766758
path: spec.template.spec.containers[0].env
@@ -843,15 +835,3 @@ tests:
843835
asserts:
844836
- failedTemplate:
845837
errorMessage: ".Values.global.integrations.argo-cd.server.auth.type is set to 'token' therefore .Values.global.integrations.argo-cd.server.auth.tokenSecretKeyRef.name is required"
846-
847-
- it: should require ArgoCd server address if it's not provided
848-
values:
849-
- ./values/mandatory-values-ingress.yaml
850-
- ./values/external-argocd-values.yaml
851-
set:
852-
global:
853-
external-argo-cd:
854-
server: null
855-
asserts:
856-
- failedTemplate:
857-
errorMessage: "ArgoCD is not enabled and .Values.global.external-argo-cd.server is not set"

0 commit comments

Comments
 (0)