Skip to content

fix: argocd fullname template; feat: add sources-server and event-reporter versions to codefresh-cm ConfigMap #430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 24, 2025
Merged
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
15 changes: 10 additions & 5 deletions charts/gitops-runtime/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ 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 }}

{{/*
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 }}

{{/*
Expand All @@ -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 }}
Expand Down Expand Up @@ -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 }}

{{/*
Expand Down Expand Up @@ -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 }}
Expand All @@ -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 }}

Expand Down
16 changes: 16 additions & 0 deletions charts/gitops-runtime/tests/cf-argocd-extras_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 14 additions & 0 deletions charts/gitops-runtime/tests/external_argocd_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down