Skip to content

Commit 8539f8c

Browse files
committed
feat(chart): allow for template on host input
1 parent 9118a41 commit 8539f8c

File tree

9 files changed

+31
-17
lines changed

9 files changed

+31
-17
lines changed

charts/kargo/templates/_helpers.tpl

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,25 @@ Generate base URL for a service.
4444
{{- end -}}
4545
{{- end -}}
4646

47+
{{/*
48+
Generate the base HOST for the API service.
49+
*/}}
50+
{{- define "kargo.api.baseHost" -}}
51+
{{- (tpl .Values.api.host .) -}}
52+
{{- end -}}
53+
4754
{{/*
4855
Generate the base URL for the API service.
4956
*/}}
5057
{{- define "kargo.api.baseURL" -}}
51-
{{- include "kargo.baseURL" (dict "service" .Values.api "host" .Values.api.host) -}}
58+
{{- include "kargo.baseURL" (dict "service" .Values.api "host" (include "kargo.api.baseHost" .)) -}}
59+
{{- end -}}
60+
61+
{{/*
62+
Generate the base HOST for the external webhook server.
63+
*/}}
64+
{{- define "kargo.externalWebhooksServer.baseHost" -}}
65+
{{- (tpl .Values.externalWebhooksServer.host .) -}}
5266
{{- end -}}
5367

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

charts/kargo/templates/api/cert.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ metadata:
99
{{- include "kargo.api.labels" . | nindent 4 }}
1010
spec:
1111
dnsNames:
12-
- {{ quote .Values.api.host }}
12+
- {{ include "kargo.api.baseHost" . | quote }}
1313
issuerRef:
1414
kind: Issuer
1515
name: kargo-selfsigned-cert-issuer

charts/kargo/templates/api/configmap.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ data:
2828
{{- if .Values.api.adminAccount.enabled }}
2929
ADMIN_ACCOUNT_ENABLED: "true"
3030
ADMIN_ACCOUNT_TOKEN_ISSUER: {{ include "kargo.api.baseURL" . }}
31-
ADMIN_ACCOUNT_TOKEN_AUDIENCE: {{ quote .Values.api.host }}
31+
ADMIN_ACCOUNT_TOKEN_AUDIENCE: {{ include "kargo.api.baseHost" . | quote }}
3232
ADMIN_ACCOUNT_TOKEN_TTL: {{ quote .Values.api.adminAccount.tokenTTL }}
3333
{{- end }}
3434
{{- if .Values.api.oidc.enabled }}
@@ -41,8 +41,8 @@ data:
4141
{{- end }}
4242
{{- if .Values.api.oidc.dex.enabled }}
4343
OIDC_ISSUER_URL: {{ include "kargo.api.baseURL" . }}/dex
44-
OIDC_CLIENT_ID: {{ quote .Values.api.host }}
45-
OIDC_CLI_CLIENT_ID: {{ .Values.api.host }}-cli
44+
OIDC_CLIENT_ID: {{ include "kargo.api.baseHost" . | quote }}
45+
OIDC_CLI_CLIENT_ID: {{ include "kargo.api.baseHost" . }}-cli
4646
DEX_ENABLED: "true"
4747
DEX_SERVER_ADDRESS: https://kargo-dex-server.{{ .Release.Namespace }}.svc
4848
DEX_CA_CERT_PATH: /etc/kargo/idp-ca.crt
@@ -57,7 +57,7 @@ data:
5757
{{- end }}
5858
{{- if .Values.api.argocd.urls }}
5959
ARGOCD_NAMESPACE: {{ .Values.controller.argocd.namespace | default "argocd" }}
60-
ARGOCD_URLS: {{ range $key, $val := .Values.api.argocd.urls }}{{ $key }}={{ $val }},{{- end }}
60+
ARGOCD_URLS: {{ range $key, $val := .Values.api.argocd.urls }}{{ $key }}={{ tpl $val $ }},{{- end }}
6161
{{- end }}
6262
ROLLOUTS_INTEGRATION_ENABLED: {{ quote .Values.api.rollouts.integrationEnabled }}
6363
{{- if and .Values.api.rollouts.integrationEnabled .Values.api.rollouts.logs.enabled }}

charts/kargo/templates/api/ingress-cert.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ metadata:
99
{{- include "kargo.api.labels" . | nindent 4 }}
1010
spec:
1111
dnsNames:
12-
- {{ quote .Values.api.host }}
12+
- {{ include "kargo.api.baseHost" . | quote }}
1313
issuerRef:
1414
kind: Issuer
1515
name: kargo-selfsigned-cert-issuer

charts/kargo/templates/api/ingress.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ spec:
1818
ingressClassName: {{ .Values.api.ingress.ingressClassName }}
1919
{{- end }}
2020
rules:
21-
- host: {{ quote .Values.api.host }}
21+
- host: {{ include "kargo.api.baseHost" . | quote }}
2222
http:
2323
paths:
2424
- pathType: {{ .Values.api.ingress.pathType | default "ImplementationSpecific" }}
@@ -48,7 +48,7 @@ spec:
4848
{{- if .Values.api.ingress.tls.enabled }}
4949
tls:
5050
- hosts:
51-
- {{ quote .Values.api.host }}
51+
- {{ include "kargo.api.baseHost" . | quote }}
5252
secretName: {{ .Values.api.ingress.tls.secretName }}
5353
{{- end }}
5454
{{- end }}

charts/kargo/templates/dex-server/secret.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ stringData:
2626
skipApprovalScreen: {{ .Values.api.oidc.dex.skipApprovalScreen | default "true" }}
2727
2828
staticClients:
29-
- id: {{ quote .Values.api.host }}
29+
- id: {{ include "kargo.api.baseHost" . | quote }}
3030
name: Kargo
3131
public: true
32-
{{- if not (hasPrefix "localhost:" .Values.api.host) }}
32+
{{- if not (hasPrefix "localhost:" (include "kargo.api.baseHost" .)) }}
3333
redirectURIs:
3434
- {{ include "kargo.api.baseURL" . }}/login
3535
{{- end }}
36-
- id: {{ .Values.api.host }}-cli
36+
- id: {{ include "kargo.api.baseHost" . }}-cli
3737
name: Kargo CLI
3838
public: true
3939

charts/kargo/templates/external-webhooks-server/cert.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ metadata:
99
{{- include "kargo.externalWebhooksServer.labels" . | nindent 4 }}
1010
spec:
1111
dnsNames:
12-
- {{ quote .Values.externalWebhooksServer.host }}
12+
- {{ include "kargo.externalWebhooksServer.baseHost" . | quote }}
1313
issuerRef:
1414
kind: Issuer
1515
name: kargo-selfsigned-cert-issuer

charts/kargo/templates/external-webhooks-server/ingress-cert.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ metadata:
99
{{- include "kargo.externalWebhooksServer.labels" . | nindent 4 }}
1010
spec:
1111
dnsNames:
12-
- {{ quote .Values.externalWebhooksServer.host }}
12+
- {{ include "kargo.externalWebhooksServer.baseHost" . | quote }}
1313
issuerRef:
1414
kind: Issuer
1515
name: kargo-selfsigned-cert-issuer

charts/kargo/templates/external-webhooks-server/ingress.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ spec:
1818
ingressClassName: {{ .Values.externalWebhooksServer.ingress.ingressClassName }}
1919
{{- end }}
2020
rules:
21-
- host: {{ quote .Values.externalWebhooksServer.host }}
21+
- host: {{ include "kargo.externalWebhooksServer.baseHost" . | quote }}
2222
http:
2323
paths:
2424
- pathType: {{ .Values.externalWebhooksServer.ingress.pathType | default "ImplementationSpecific" }}
@@ -35,7 +35,7 @@ spec:
3535
{{- if .Values.externalWebhooksServer.ingress.tls.enabled }}
3636
tls:
3737
- hosts:
38-
- {{ quote .Values.externalWebhooksServer.host }}
38+
- {{ include "kargo.externalWebhooksServer.baseHost" . | quote }}
3939
secretName: {{ .Values.externalWebhooksServer.ingress.tls.secretName }}
4040
{{- end }}
4141
{{- end }}

0 commit comments

Comments
 (0)