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
18 changes: 16 additions & 2 deletions charts/kargo/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,25 @@ Generate base URL for a service.
{{- end -}}
{{- end -}}

{{/*
Generate the base HOST for the API service.
*/}}
{{- define "kargo.api.baseHost" -}}
{{- (tpl .Values.api.host .) -}}
{{- end -}}

{{/*
Generate the base URL for the API service.
*/}}
{{- define "kargo.api.baseURL" -}}
{{- include "kargo.baseURL" (dict "service" .Values.api "host" .Values.api.host) -}}
{{- include "kargo.baseURL" (dict "service" .Values.api "host" (include "kargo.api.baseHost" .)) -}}
{{- end -}}

{{/*
Generate the base HOST for the external webhook server.
*/}}
{{- define "kargo.externalWebhooksServer.baseHost" -}}
{{- (tpl .Values.externalWebhooksServer.host .) -}}
{{- end -}}

{{/*
Expand All @@ -60,7 +74,7 @@ Generate the base URL for the external webhook server.
{{- if and (not $webhookService.ingress.enabled) $apiService.enabled $apiService.ingress.enabled -}}
{{- printf "%s/webhooks" (include "kargo.api.baseURL" .) -}}
{{- else -}}
{{- include "kargo.baseURL" (dict "service" $webhookService "host" $webhookService.host) -}}
{{- include "kargo.baseURL" (dict "service" $webhookService "host" (include "kargo.externalWebhooksServer.baseHost" .)) -}}
{{- end -}}
{{- end -}}

Expand Down
2 changes: 1 addition & 1 deletion charts/kargo/templates/api/cert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ metadata:
{{- include "kargo.api.labels" . | nindent 4 }}
spec:
dnsNames:
- {{ quote .Values.api.host }}
- {{ include "kargo.api.baseHost" . | quote }}
issuerRef:
kind: Issuer
name: kargo-selfsigned-cert-issuer
Expand Down
8 changes: 4 additions & 4 deletions charts/kargo/templates/api/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ data:
{{- if .Values.api.adminAccount.enabled }}
ADMIN_ACCOUNT_ENABLED: "true"
ADMIN_ACCOUNT_TOKEN_ISSUER: {{ include "kargo.api.baseURL" . }}
ADMIN_ACCOUNT_TOKEN_AUDIENCE: {{ quote .Values.api.host }}
ADMIN_ACCOUNT_TOKEN_AUDIENCE: {{ include "kargo.api.baseHost" . | quote }}
ADMIN_ACCOUNT_TOKEN_TTL: {{ quote .Values.api.adminAccount.tokenTTL }}
{{- end }}
{{- if .Values.api.oidc.enabled }}
Expand All @@ -41,8 +41,8 @@ data:
{{- end }}
{{- if .Values.api.oidc.dex.enabled }}
OIDC_ISSUER_URL: {{ include "kargo.api.baseURL" . }}/dex
OIDC_CLIENT_ID: {{ quote .Values.api.host }}
OIDC_CLI_CLIENT_ID: {{ .Values.api.host }}-cli
OIDC_CLIENT_ID: {{ include "kargo.api.baseHost" . | quote }}
OIDC_CLI_CLIENT_ID: {{ include "kargo.api.baseHost" . }}-cli
DEX_ENABLED: "true"
DEX_SERVER_ADDRESS: https://kargo-dex-server.{{ .Release.Namespace }}.svc
DEX_CA_CERT_PATH: /etc/kargo/idp-ca.crt
Expand All @@ -57,7 +57,7 @@ data:
{{- end }}
{{- if .Values.api.argocd.urls }}
ARGOCD_NAMESPACE: {{ .Values.controller.argocd.namespace | default "argocd" }}
ARGOCD_URLS: {{ range $key, $val := .Values.api.argocd.urls }}{{ $key }}={{ $val }},{{- end }}
ARGOCD_URLS: {{ range $key, $val := .Values.api.argocd.urls }}{{ $key }}={{ tpl $val $ }},{{- end }}
{{- end }}
ROLLOUTS_INTEGRATION_ENABLED: {{ quote .Values.api.rollouts.integrationEnabled }}
{{- if and .Values.api.rollouts.integrationEnabled .Values.api.rollouts.logs.enabled }}
Expand Down
2 changes: 1 addition & 1 deletion charts/kargo/templates/api/ingress-cert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ metadata:
{{- include "kargo.api.labels" . | nindent 4 }}
spec:
dnsNames:
- {{ quote .Values.api.host }}
- {{ include "kargo.api.baseHost" . | quote }}
issuerRef:
kind: Issuer
name: kargo-selfsigned-cert-issuer
Expand Down
4 changes: 2 additions & 2 deletions charts/kargo/templates/api/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
ingressClassName: {{ .Values.api.ingress.ingressClassName }}
{{- end }}
rules:
- host: {{ quote .Values.api.host }}
- host: {{ include "kargo.api.baseHost" . | quote }}
http:
paths:
- pathType: {{ .Values.api.ingress.pathType | default "ImplementationSpecific" }}
Expand Down Expand Up @@ -48,7 +48,7 @@ spec:
{{- if .Values.api.ingress.tls.enabled }}
tls:
- hosts:
- {{ quote .Values.api.host }}
- {{ include "kargo.api.baseHost" . | quote }}
secretName: {{ .Values.api.ingress.tls.secretName }}
{{- end }}
{{- end }}
8 changes: 4 additions & 4 deletions charts/kargo/templates/dex-server/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ stringData:
skipApprovalScreen: {{ .Values.api.oidc.dex.skipApprovalScreen | default "true" }}

staticClients:
- id: {{ quote .Values.api.host }}
- id: {{ include "kargo.api.baseHost" . | quote }}
name: Kargo
public: true
{{- if not (hasPrefix "localhost:" .Values.api.host) }}
{{- if not (hasPrefix "localhost:" (include "kargo.api.baseHost" .)) }}
redirectURIs:
- {{ include "kargo.api.baseURL" . }}/login
{{- end }}
- id: {{ .Values.api.host }}-cli
- id: {{ include "kargo.api.baseHost" . }}-cli
name: Kargo CLI
public: true

connectors:
{{- toYaml .Values.api.oidc.dex.connectors | nindent 4 }}
{{- tpl (toYaml .Values.api.oidc.dex.connectors) . | nindent 4 }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ metadata:
{{- include "kargo.externalWebhooksServer.labels" . | nindent 4 }}
spec:
dnsNames:
- {{ quote .Values.externalWebhooksServer.host }}
- {{ include "kargo.externalWebhooksServer.baseHost" . | quote }}
issuerRef:
kind: Issuer
name: kargo-selfsigned-cert-issuer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ metadata:
{{- include "kargo.externalWebhooksServer.labels" . | nindent 4 }}
spec:
dnsNames:
- {{ quote .Values.externalWebhooksServer.host }}
- {{ include "kargo.externalWebhooksServer.baseHost" . | quote }}
issuerRef:
kind: Issuer
name: kargo-selfsigned-cert-issuer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
ingressClassName: {{ .Values.externalWebhooksServer.ingress.ingressClassName }}
{{- end }}
rules:
- host: {{ quote .Values.externalWebhooksServer.host }}
- host: {{ include "kargo.externalWebhooksServer.baseHost" . | quote }}
http:
paths:
- pathType: {{ .Values.externalWebhooksServer.ingress.pathType | default "ImplementationSpecific" }}
Expand All @@ -35,7 +35,7 @@ spec:
{{- if .Values.externalWebhooksServer.ingress.tls.enabled }}
tls:
- hosts:
- {{ quote .Values.externalWebhooksServer.host }}
- {{ include "kargo.externalWebhooksServer.baseHost" . | quote }}
secretName: {{ .Values.externalWebhooksServer.ingress.tls.secretName }}
{{- end }}
{{- end }}