@@ -93,29 +93,43 @@ Determine argocd redis service name. Must be called with chart root context
9393Determine argocd repo server service name. Must be called with chart root context
9494*/} }
9595{ {- define " codefresh-gitops-runtime.argocd.reposerver.servicename" -} }
96- { {- $repoServer := index .Values " global" " integrations" " argo-cd" " repoServer" } }
97- { {- $svc := required " .Values.global.integrations.argo-cd.repoServer.svc is not set" $repoServer .svc } }
98- { {- printf " %s" $svc } }
96+ { {- if (index .Subcharts " argo-cd" ) } }
97+ { {- template " argo-cd.repoServer.fullname" (dict " Values" (get .Values " argo-cd" ) " Release" .Release ) } }
98+ { {- else } }
99+ { {- $repoServer := index .Values " global" " integrations" " argo-cd" " repoServer" } }
100+ { {- $svc := required " .Values.global.integrations.argo-cd.repoServer.svc is not set" $repoServer .svc } }
101+ { {- printf " %s" $svc } }
102+ { {- end } }
99103{ {- end } }
100104
101105{ {/*
102106Determine argocd argocd repo server port
103107*/} }
104108{ {- define " codefresh-gitops-runtime.argocd.reposerver.serviceport" -} }
105- { {- $repoServer := index .Values " global" " integrations" " argo-cd" " repoServer" } }
106- { {- $port := required " .Values.global.integrations.argo-cd.repoServer.svc is not set" $repoServer .port } }
107- { {- printf " %v" $port } }
109+ { {- if (index .Subcharts " argo-cd" ) } }
110+ { {- index .Values " argo-cd" " repoServer" " service" " port" } }
111+ { {- else } }
112+ { {- $repoServer := index .Values " global" " integrations" " argo-cd" " repoServer" } }
113+ { {- $port := required " .Values.global.integrations.argo-cd.repoServer.svc is not set" $repoServer .port } }
114+ { {- printf " %v" $port } }
115+ { {- end } }
108116{ {- end } }
109117
110118
111119{ {/*
112120Determine argocd repoServer url
113121*/} }
114122{ {- define " codefresh-gitops-runtime.argocd.reposerver.url" -} }
115- { {- $repoServer := (index .Values " global" " integrations" " argo-cd" " repoServer" ) } }
116- { {- $svc := required " .Values.global.integrations.argo-cd.repoServer.svc is not set" $repoServer .svc } }
117- { {- $port := required " .Values.global.integrations.argo-cd.repoServer.port is not set" $repoServer .port } }
118- { {- printf " %s:%v" $svc $port } }
123+ { {- if (index .Values " argo-cd" " enabled" ) } }
124+ { {- $serviceName := include " codefresh-gitops-runtime.argocd.reposerver.servicename" . } }
125+ { {- $port := include " codefresh-gitops-runtime.argocd.reposerver.serviceport" . } }
126+ { {- printf " %s:%s" $serviceName $port } }
127+ { {- else } }
128+ { {- $repoServer := (index .Values " global" " integrations" " argo-cd" " repoServer" ) } }
129+ { {- $svc := required " .Values.global.integrations.argo-cd.repoServer.svc is not set" $repoServer .svc } }
130+ { {- $port := required " .Values.global.integrations.argo-cd.repoServer.port is not set" $repoServer .port } }
131+ { {- printf " %s:%v" $svc $port } }
132+ { {- end } }
119133{ {- end} }
120134
121135
@@ -171,27 +185,45 @@ Determine argocd redis service port. Must be called with chart root context
171185Determine argocd server url. Must be called with chart root context
172186*/} }
173187{ {- define " codefresh-gitops-runtime.argocd.server.url" -} }
174- { {- $argoCDSrv := (index .Values " global" " integrations" " argo-cd" " server" ) } }
175- { {- $protocol := " http" } }
176- { {- $svc := required " .Values.global.integrations.argo-cd.server.svc is not set" $argoCDSrv .svc } }
177- { {- $port := (required " .Values.global.integrations.argo-cd.server.port is not set" $argoCDSrv .port) | toString } }
178- { {- $rootpath := (index .Values " global" " integrations" " argo-cd" " server" " rootpath" ) } }
179- { {- if (eq $port " 80" ) } }
180- { {- printf " %s://%s%s" $protocol $svc $rootpath } }
188+ { {- if (index .Values " argo-cd" " enabled" ) } }
189+ { {- $protocol := " https" } }
190+ { {- $port := include " codefresh-gitops-runtime.argocd.server.serviceport" . } }
191+ { {- if (eq $port " 80" ) } }
192+ { {- $protocol = " http" } }
193+ { {- end } }
194+ { {- $url := include " codefresh-gitops-runtime.argocd.server.no-protocol-url" . } }
195+ { {- printf " %s://%s" $protocol $url } }
181196 { {- else } }
182- { {- printf " %s://%s:%v%s" $protocol $svc $port $rootpath } }
197+ { {- $argoCDSrv := (index .Values " global" " integrations" " argo-cd" " server" ) } }
198+ { {- $protocol := " http" } }
199+ { {- $svc := required " .Values.global.integrations.argo-cd.server.svc is not set" $argoCDSrv .svc } }
200+ { {- $port := (required " .Values.global.integrations.argo-cd.server.port is not set" $argoCDSrv .port) | toString } }
201+ { {- $rootpath := (index .Values " global" " integrations" " argo-cd" " server" " rootpath" ) } }
202+ { {- if (eq $port " 80" ) } }
203+ { {- printf " %s://%s%s" $protocol $svc $rootpath } }
204+ { {- else } }
205+ { {- printf " %s://%s:%v%s" $protocol $svc $port $rootpath } }
206+ { {- end } }
183207 { {- end } }
184208{ {- end} }
185209
186210{ {/*
187211Determine argocd server url witout the protocol. Must be called with chart root context
188212*/} }
189213{ {- define " codefresh-gitops-runtime.argocd.server.no-protocol-url" -} }
190- { {- $argoCDSrv := (index .Values " global" " integrations" " argo-cd" " server" ) } }
191- { {- $svc := required " ArgoCD is not enabled and .Values.global.integrations.argo-cd.server.svc is not set" $argoCDSrv .svc } }
192- { {- $port := required " ArgoCD is not enabled and .Values.global.integrations.argo-cd.server.port is not set" $argoCDSrv .port } }
193- { {- $rootpath := (index .Values " global" " integrations" " argo-cd" " server" " rootpath" ) } }
194- { {- printf " %s:%v%s" $svc $port $rootpath } }
214+ { {- $argoCDValues := (get .Values " argo-cd" ) } }
215+ { {- if (index .Values " argo-cd" " enabled" ) } }
216+ { {- $serverName := include " codefresh-gitops-runtime.argocd.server.servicename" . } }
217+ { {- $port := include " codefresh-gitops-runtime.argocd.server.serviceport" . } }
218+ { {- $path := (get $argoCDValues .configs.params " server.rootpath" ) } }
219+ { {- printf " %s:%s%s" $serverName $port $path } }
220+ { {- else } }
221+ { {- $argoCDSrv := (index .Values " global" " integrations" " argo-cd" " server" ) } }
222+ { {- $svc := required " ArgoCD is not enabled and .Values.global.integrations.argo-cd.server.svc is not set" $argoCDSrv .svc } }
223+ { {- $port := required " ArgoCD is not enabled and .Values.global.integrations.argo-cd.server.port is not set" $argoCDSrv .port } }
224+ { {- $rootpath := (index .Values " global" " integrations" " argo-cd" " server" " rootpath" ) } }
225+ { {- printf " %s:%v%s" $svc $port $rootpath } }
226+ { {- end } }
195227{ {- end} }
196228
197229{ {- define " codefresh-gitops-runtime.argocd-auth" -} }
0 commit comments