Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 42 additions & 19 deletions charts/gitops-runtime/README.md

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions charts/gitops-runtime/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -399,4 +399,25 @@ argo-gateway:
...
```

- `.Values.global.external-argo-cd` was changed to `.Values.global.integrations.argo-cd`

```yaml
# Before:
global:
external-argo-cd:
server:
svc: argocd-server
port: 80
...

# After:
global:
integrations:
argo-cd:
server:
svc: argocd-server
port: 80
...
```

{{ template "chart.valuesSection" . }}
102 changes: 37 additions & 65 deletions charts/gitops-runtime/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -77,28 +77,18 @@ Create the name of the service account to use
Determine argocd server service name. Must be called with chart root context
*/}}
{{- define "codefresh-gitops-runtime.argocd.server.servicename" -}}
{{/* For now use template from ArgoCD chart until better approach */}}
{{- template "argo-cd.server.fullname" (dict "Values" (get .Values "argo-cd") "Release" .Release ) }}
{{- end }}

{{/*
Determine argocd redis service name. Must be called with chart root context
*/}}
{{- define "codefresh-gitops-runtime.argocd.redis.servicename" -}}
{{/* For now use template from ArgoCD chart until better approach */}}
{{- template "argo-cd.redis.fullname" (dict "Values" (get .Values "argo-cd") "Release" .Release ) }}
{{- printf "%s-%s" (index .Values "argo-cd" "fullnameOverride") (index .Values "argo-cd" "server" "name") }}
{{- end }}

{{/*
Determine argocd repo server service name. Must be called with chart root context
*/}}
{{- define "codefresh-gitops-runtime.argocd.reposerver.servicename" -}}
{{/* For now use template from ArgoCD chart until better approach */}}
{{- if (index .Subcharts "argo-cd") }}
{{- template "argo-cd.repoServer.fullname" (dict "Values" (get .Values "argo-cd") "Release" .Release ) }}
{{- printf "%s-%s" (index .Values "argo-cd" "fullnameOverride") (index .Values "argo-cd" "repoServer" "name") }}
{{- else }}
{{- $repoServer := index .Values "global" "external-argo-cd" "repoServer" }}
{{- $svc := required "ArgoCD is not enabled and .Values.global.external-argo-cd.repoServer.svc is not set" $repoServer.svc }}
{{- $repoServer := index .Values "global" "integrations" "argo-cd" "repoServer" }}
{{- $svc := required ".Values.global.integrations.argo-cd.repoServer.svc is not set" $repoServer.svc }}
{{- printf "%s" $svc }}
{{- end }}
{{- end }}
Expand All @@ -107,12 +97,11 @@ Determine argocd repo server service name. Must be called with chart root contex
Determine argocd argocd repo server port
*/}}
{{- define "codefresh-gitops-runtime.argocd.reposerver.serviceport" -}}
{{/* For now use template from ArgoCD chart until better approach */}}
{{- if (index .Subcharts "argo-cd") }}
{{- index .Values "argo-cd" "repoServer" "service" "port" }}
{{- else }}
{{- $repoServer := index .Values "global" "external-argo-cd" "repoServer" }}
{{- $port := required "ArgoCD is not enabled and .Values.global.external-argo-cd.repoServer.svc is not set" $repoServer.port }}
{{- $repoServer := index .Values "global" "integrations" "argo-cd" "repoServer" }}
{{- $port := required ".Values.global.integrations.argo-cd.repoServer.svc is not set" $repoServer.port }}
{{- printf "%v" $port }}
{{- end }}
{{- end }}
Expand All @@ -122,30 +111,18 @@ Determine argocd argocd repo server port
Determine argocd repoServer url
*/}}
{{- define "codefresh-gitops-runtime.argocd.reposerver.url" -}}
{{- $argoCDValues := (get .Values "argo-cd") }}
{{- if (index .Values "argo-cd" "enabled") }}
{{- $serviceName := include "codefresh-gitops-runtime.argocd.reposerver.servicename" . }}
{{- $port := include "codefresh-gitops-runtime.argocd.reposerver.serviceport" . }}
{{- printf "%s:%s" $serviceName $port }}
{{- else if (index .Values "global" "external-argo-cd" "repoServer") }}
{{- $repoServer := (index .Values "global" "external-argo-cd" "repoServer") }}
{{- $svc := required "ArgoCD is not enabled and .Values.global.external-argo-cd.repoServer.svc is not set" $repoServer.svc }}
{{- $port := required "ArgoCD is not enabled and .Values.global.external-argo-cd.repoServer.port is not set" $repoServer.port }}
{{- printf "%s:%v" $svc $port }}
{{- else }}
{{- fail "ArgoCD is not enabled and .Values.global.external-argo-cd.repoServer is not set" }}
{{- end }}
{{- if (index .Values "argo-cd" "enabled") }}
{{- $serviceName := include "codefresh-gitops-runtime.argocd.reposerver.servicename" . }}
{{- $port := include "codefresh-gitops-runtime.argocd.reposerver.serviceport" . }}
{{- printf "%s:%s" $serviceName $port }}
{{- else }}
{{- $repoServer := (index .Values "global" "integrations" "argo-cd" "repoServer") }}
{{- $svc := required ".Values.global.integrations.argo-cd.repoServer.svc is not set" $repoServer.svc }}
{{- $port := required ".Values.global.integrations.argo-cd.repoServer.port is not set" $repoServer.port }}
{{- printf "%s:%v" $svc $port }}
{{- end }}
{{- end}}


{{/*
Determine argocd servicename. Must be called with chart root context
*/}}
{{- define "codefresh-gitops-runtime.argocd.appcontroller.serviceAccountName" -}}
{{/* For now use template from ArgoCD chart until better approach */}}
{{- template "argo-cd.controllerServiceAccountName" (dict "Values" (get .Values "argo-cd") "Release" .Release ) }}
{{- end }}

{{/*
Determine rollouts name
*/}}
Expand All @@ -158,7 +135,6 @@ Determine rollouts name
{{- end }}
{{- end }}


{{/*
Determine argocd server service port. Must be called with chart root context
*/}}
Expand All @@ -174,7 +150,7 @@ Determine argocd server service port. Must be called with chart root context
{{- end }}
{{- end }}
{{- end }}
{{- print $port }}
{{- printf "%v" $port }}
{{- end}}

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

{{/*
Expand All @@ -198,41 +174,37 @@ Determine argocd server url. Must be called with chart root context
{{- end }}
{{- $url := include "codefresh-gitops-runtime.argocd.server.no-protocol-url" . }}
{{- printf "%s://%s" $protocol $url }}
{{- else if (index .Values "global" "external-argo-cd" "server") }}
{{- $argoCDSrv := (index .Values "global" "external-argo-cd" "server") }}
{{- else }}
{{- $argoCDSrv := (index .Values "global" "integrations" "argo-cd" "server") }}
{{- $protocol := "http" }}
{{- $svc := required "ArgoCD is not enabled and .Values.global.external-argo-cd.server.svc is not set" $argoCDSrv.svc }}
{{- $port := (required "ArgoCD is not enabled and .Values.global.external-argo-cd.server.port is not port" $argoCDSrv.port) | toString }}
{{- $rootpath := (index .Values "global" "external-argo-cd" "server" "rootpath") }}
{{- $svc := required ".Values.global.integrations.argo-cd.server.svc is not set" $argoCDSrv.svc }}
{{- $port := (required ".Values.global.integrations.argo-cd.server.port is not set" $argoCDSrv.port) | toString }}
{{- $rootpath := (index .Values "global" "integrations" "argo-cd" "server" "rootpath") }}
{{- if (eq $port "80") }}
{{- printf "%s://%s%s" $protocol $svc $rootpath }}
{{- else }}
{{- printf "%s://%s:%s%s" $protocol $svc $port $rootpath }}
{{- printf "%s://%s:%v%s" $protocol $svc $port $rootpath }}
{{- end }}
{{- else }}
{{- fail "ArgoCD is not enabled and .Values.global.external-argo-cd.server is not set" }}
{{- end }}
{{- end}}

{{/*
Determine argocd server url witout the protocol. Must be called with chart root context
*/}}
{{- define "codefresh-gitops-runtime.argocd.server.no-protocol-url" -}}
{{- $argoCDValues := (get .Values "argo-cd") }}
{{- if (index .Values "argo-cd" "enabled") }}
{{- $serverName := include "codefresh-gitops-runtime.argocd.server.servicename" . }}
{{- $port := include "codefresh-gitops-runtime.argocd.server.serviceport" . }}
{{- $path := (get $argoCDValues.configs.params "server.rootpath") }}
{{- printf "%s:%s%s" $serverName $port $path }}
{{- else if (index .Values "global" "external-argo-cd" "server") }}
{{- $argoCDSrv := (index .Values "global" "external-argo-cd" "server") }}
{{- $svc := required "ArgoCD is not enabled and .Values.global.external-argo-cd.server.svc is not set" $argoCDSrv.svc }}
{{- $port := required "ArgoCD is not enabled and .Values.global.external-argo-cd.server.port is not set" $argoCDSrv.port }}
{{- $rootpath := (index .Values "global" "external-argo-cd" "server" "rootpath") }}
{{- printf "%s:%v%s" $svc $port $rootpath }}
{{- else }}
{{- fail "ArgoCD is not enabled and .Values.global.external-argo-cd.server is not set" }}
{{- end }}
{{- $argoCDValues := (get .Values "argo-cd") }}
{{- if (index .Values "argo-cd" "enabled") }}
{{- $serverName := include "codefresh-gitops-runtime.argocd.server.servicename" . }}
{{- $port := include "codefresh-gitops-runtime.argocd.server.serviceport" . }}
{{- $path := (get $argoCDValues.configs.params "server.rootpath") }}
{{- printf "%s:%s%s" $serverName $port $path }}
{{- else }}
{{- $argoCDSrv := (index .Values "global" "integrations" "argo-cd" "server") }}
{{- $svc := required ".Values.global.integrations.argo-cd.server.svc is not set" $argoCDSrv.svc }}
{{- $port := required ".Values.global.integrations.argo-cd.server.port is not set" $argoCDSrv.port }}
{{- $rootpath := (index .Values "global" "integrations" "argo-cd" "server" "rootpath") }}
{{- printf "%s:%v%s" $svc $port $rootpath }}
{{- end }}
{{- end}}

{{- define "codefresh-gitops-runtime.argocd-auth" -}}
Expand Down
2 changes: 1 addition & 1 deletion charts/gitops-runtime/templates/argo-gateway/_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ARGO_CD_TOKEN_SECRET_KEY: "token"
{{- end }}
{{- end }}

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

{{- if or .Values.global.codefresh.tls.caCerts.secret.create (and .Values.global.codefresh.tls.caCerts.secretKeyRef.key .Values.global.codefresh.tls.caCerts.secretKeyRef.name) }}
{{- $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 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ARGO_CD_TOKEN_SECRET_KEY: "token"
{{- end }}
{{- end }}

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

{{- if or .Values.global.codefresh.tls.caCerts.secret.create (and .Values.global.codefresh.tls.caCerts.secretKeyRef.key .Values.global.codefresh.tls.caCerts.secretKeyRef.name) }}
{{- $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 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ARGO_CD_TOKEN_SECRET_KEY: "token"
{{- end }}
{{- end }}

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

{{- if or .Values.global.codefresh.tls.caCerts.secret.create (and .Values.global.codefresh.tls.caCerts.secretKeyRef.key .Values.global.codefresh.tls.caCerts.secretKeyRef.name) }}
{{- $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 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ NAMESPACE:
{{- define "installer.validate-values.environment-variables.defaults" -}}
ARGOCD_CHECK_VERSION: {{ not (get .Values "argo-cd").enabled | quote }}
ARGOCD_LABELS: "{{ range $k, $v := .Values.installer.argoCdVersionCheck.argoServerLabels }}{{ $k }}={{ $v }},{{ end }}"
ARGOCD_SERVER_ROOTPATH: {{ dig "server" "rootpath" "/" (index .Values "global" "external-argo-cd") | quote }}
ARGOCD_SERVER_ROOTPATH: {{ dig "server" "rootpath" "/" (index .Values "global" "integrations" "argo-cd") | quote }}
ARGOCD_VERSION_PATH: "/api/version"
CHART_VERSION: {{ .Chart.Version }}
NAMESPACE:
Expand Down
4 changes: 2 additions & 2 deletions charts/gitops-runtime/tests/argo-api-gateway_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ tests:
asserts:
- equal:
path: data["argocd.server"]
value: argo-cd-server:80
value: argocd-server:80
- equal:
path: data["redis.server"]
value: runtime-redis:6379
- equal:
path: data["repo.server"]
value: argo-cd-repo-server:8081
value: argocd-repo-server:8081

- it: Argo Api Gateway Deployment should have valid matchLabel selectors
template: argo-gateway/deployment.yaml
Expand Down
4 changes: 2 additions & 2 deletions charts/gitops-runtime/tests/event-reporters_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ tests:
asserts:
- equal:
path: data["argocd.server"]
value: argo-cd-server:80
value: argocd-server:80
- equal:
path: data["redis.server"]
value: runtime-redis:6379
- equal:
path: data["repo.server"]
value: argo-cd-repo-server:8081
value: argocd-repo-server:8081

- it: Runtime Reporter ConfigMap should have valid redis-ha url
template: event-reporters/runtime-event-reporter/configmap.yaml
Expand Down
52 changes: 16 additions & 36 deletions charts/gitops-runtime/tests/external_argocd_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -675,18 +675,6 @@ tests:
name: ARGO_CD_TOKEN_SECRET_KEY
value: token

- it: should require ArgoCd repoServer address if it's not provided
values:
- ./values/mandatory-values-ingress.yaml
- ./values/external-argocd-values.yaml
set:
global:
external-argo-cd:
repoServer: null
asserts:
- failedTemplate:
errorMessage: "ArgoCD is not enabled and .Values.global.external-argo-cd.repoServer is not set"

- it: should required only allowed auth type for external ArgoCd
values:
- ./values/mandatory-values-ingress.yaml
Expand All @@ -709,9 +697,10 @@ tests:
- ./values/external-argocd-values.yaml
set:
global:
external-argo-cd:
server:
rootpath: /argocd
integrations:
argo-cd:
server:
rootpath: /argocd
asserts:
- contains:
path: spec.template.spec.containers[0].env
Expand All @@ -726,9 +715,10 @@ tests:
- ./values/external-argocd-values.yaml
set:
global:
external-argo-cd:
server:
rootpath: /argocd
integrations:
argo-cd:
server:
rootpath: /argocd
asserts:
- contains:
path: spec.template.spec.containers[0].env
Expand All @@ -743,9 +733,10 @@ tests:
template: app-proxy/config.yaml
set:
global:
external-argo-cd:
server:
rootpath: /argocd
integrations:
argo-cd:
server:
rootpath: /argocd
asserts:
- equal:
path: data.argoCdUrl
Expand All @@ -758,9 +749,10 @@ tests:
- ./values/external-argocd-values.yaml
set:
global:
external-argo-cd:
server:
rootpath: /argocd
integrations:
argo-cd:
server:
rootpath: /argocd
asserts:
- contains:
path: spec.template.spec.containers[0].env
Expand Down Expand Up @@ -843,15 +835,3 @@ tests:
asserts:
- failedTemplate:
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"

- it: should require ArgoCd server address if it's not provided
values:
- ./values/mandatory-values-ingress.yaml
- ./values/external-argocd-values.yaml
set:
global:
external-argo-cd:
server: null
asserts:
- failedTemplate:
errorMessage: "ArgoCD is not enabled and .Values.global.external-argo-cd.server is not set"
23 changes: 9 additions & 14 deletions charts/gitops-runtime/tests/values/external-argocd-values.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
global:
external-argo-cd:
server:
protocol: http
svc: my-argocd-server
port: 80
image:
repository: quay.io/argoproj/argocd
tag: v2.14.2
redis:
svc: my-argocd-redis
port: 6379
repoServer:
svc: my-argocd-repo-server
port: 8081
integrations:
argo-cd:
server:
protocol: http
svc: my-argocd-server
port: 80
repoServer:
svc: my-argocd-repo-server
port: 8081

argo-cd:
enabled: false
Loading