From 691d1f0509bd4e65588549fc35a57b3239bde7ea Mon Sep 17 00:00:00 2001 From: Mikhail Klimko Date: Mon, 24 Mar 2025 13:00:15 +0300 Subject: [PATCH 1/3] fix: argocd fullname template --- charts/gitops-runtime/templates/_helpers.tpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/charts/gitops-runtime/templates/_helpers.tpl b/charts/gitops-runtime/templates/_helpers.tpl index b3ee489d..4052a3d2 100644 --- a/charts/gitops-runtime/templates/_helpers.tpl +++ b/charts/gitops-runtime/templates/_helpers.tpl @@ -77,7 +77,7 @@ 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")) }} +{{- template "argo-cd.server.fullname" (dict "Values" (get .Values "argo-cd") "Release" .Release ) }} {{- end }} {{/* @@ -85,7 +85,7 @@ 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")) }} +{{- template "argo-cd.redis.fullname" (dict "Values" (get .Values "argo-cd") "Release" .Release ) }} {{- end }} {{/* @@ -94,7 +94,7 @@ Determine argocd repo server service name. Must be called with chart root contex {{- define "codefresh-gitops-runtime.argocd.reposerver.servicename" -}} {{/* For now use template from ArgoCD chart until better approach */}} {{- if and (index .Subcharts "argo-cd") }} - {{- template "argo-cd.repoServer.fullname" (dict "Values" (get .Values "argo-cd")) }} + {{- template "argo-cd.repoServer.fullname" (dict "Values" (get .Values "argo-cd") "Release" .Release ) }} {{- 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 }} @@ -142,7 +142,7 @@ 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")) }} +{{- template "argo-cd.controllerServiceAccountName" (dict "Values" (get .Values "argo-cd") "Release" .Release ) }} {{- end }} {{/* From 0628086210d5eca52ab4ea43fd896758d894beaf Mon Sep 17 00:00:00 2001 From: Mikhail Klimko Date: Mon, 24 Mar 2025 15:02:08 +0300 Subject: [PATCH 2/3] add event-source and sources-server to codefresh-cm ConfigMap --- charts/gitops-runtime/templates/_helpers.tpl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/charts/gitops-runtime/templates/_helpers.tpl b/charts/gitops-runtime/templates/_helpers.tpl index 4052a3d2..2782b776 100644 --- a/charts/gitops-runtime/templates/_helpers.tpl +++ b/charts/gitops-runtime/templates/_helpers.tpl @@ -430,7 +430,8 @@ Output comma separated list of installed runtime components {{- $sealedSecrets := dict "name" "sealed-secrets" "version" (get .Subcharts "sealed-secrets").Chart.AppVersion }} {{- $internalRouter := dict "name" "internal-router" "version" .Chart.AppVersion }} {{- $appProxy := dict "name" "app-proxy" "version" (index (get .Values "app-proxy") "image" "tag") }} - {{- $comptList := list $argoEvents $appProxy $sealedSecrets $internalRouter}} + {{- $sourcesServer := dict "name" "sources-server" "version" (get .Subcharts "cf-argocd-extras").Chart.AppVersion }} + {{- $comptList := list $argoEvents $appProxy $sealedSecrets $internalRouter $sourcesServer }} {{- if and (index .Values "argo-cd" "enabled") }} {{- $argoCD := dict "name" "argocd" "version" (get .Subcharts "argo-cd").Chart.AppVersion }} {{- $comptList = append $comptList $argoCD }} @@ -455,6 +456,10 @@ Output comma separated list of installed runtime components {{- $gitopsOperator := dict "name" "gitops-operator" "version" (get .Subcharts "gitops-operator").Chart.AppVersion }} {{- $comptList = append $comptList $gitopsOperator }} {{- end }} + {{- if not (index .Values "argo-cd" "enabled") }} + {{- $eventReporter := dict "name" "event-reporter" "version" (get .Subcharts "cf-argocd-extras").Chart.AppVersion }} + {{- $comptList = append $comptList $eventReporter }} + {{- end }} {{- $comptList | toYaml }} {{- end }} From f36b0ecaeae4a1ad145cb85e4d8309bef0505200 Mon Sep 17 00:00:00 2001 From: Mikhail Klimko Date: Mon, 24 Mar 2025 15:27:02 +0300 Subject: [PATCH 3/3] add tests --- .../tests/cf-argocd-extras_test.yaml | 16 ++++++++++++++++ .../tests/external_argocd_test.yaml | 14 ++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/charts/gitops-runtime/tests/cf-argocd-extras_test.yaml b/charts/gitops-runtime/tests/cf-argocd-extras_test.yaml index 6c1ead49..80979628 100644 --- a/charts/gitops-runtime/tests/cf-argocd-extras_test.yaml +++ b/charts/gitops-runtime/tests/cf-argocd-extras_test.yaml @@ -109,3 +109,19 @@ tests: kind: Deployment apiVersion: apps/v1 name: sources-server + + - it: Sources-Server ConfigMap should have valid redis-ha url + template: sources-server.yaml + documentSelector: + path: kind + value: ConfigMap + values: + - ./values/mandatory-values-ingress.yaml + set: + argo-cd: + redis-ha: + enabled: true + asserts: + - equal: + path: data["redis.server"] + value: RELEASE-NAME-redis-ha-haproxy:6379 diff --git a/charts/gitops-runtime/tests/external_argocd_test.yaml b/charts/gitops-runtime/tests/external_argocd_test.yaml index 088bfc27..1ad172dc 100644 --- a/charts/gitops-runtime/tests/external_argocd_test.yaml +++ b/charts/gitops-runtime/tests/external_argocd_test.yaml @@ -8,6 +8,7 @@ templates: - charts/gitops-operator/* - charts/cf-argocd-extras/* - app-proxy/external-argocd-token.yaml + - codefresh-cm.yaml tests: - it: app-proxy ConfigMap should have valid ArgoCd URL values: @@ -727,6 +728,19 @@ tests: - isNotNullOrEmpty: path: stringData.token + - it: codefresh-cm ConfigMap should have event-reporter and sources-server + template: codefresh-cm.yaml + values: + - ./values/mandatory-values-ingress.yaml + - ./values/external-argocd-values.yaml + asserts: + - matchRegex: + path: data.components + pattern: "name: event-reporter" + - matchRegex: + path: data.components + pattern: "name: sources-server" + # TO-DO: fix these tests! # - it: should require ArgoCd token if auth.type=token is set and no token is provided