Skip to content

Commit 56242c6

Browse files
committed
feat(backend)!: support configuring TLS secretName, adjust value keys
1 parent 547ad3f commit 56242c6

File tree

3 files changed

+25
-21
lines changed

3 files changed

+25
-21
lines changed

backend/templates/_config.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
{{- end -}}
1313
{{- end }}
1414
{{- with $.Values.ingress }}
15-
publicHost: {{ ternary "https" "http" .tls }}://{{ .hostname }}{{ trimSuffix "/" .path }}
15+
publicHost: {{ (or .tls.enabled (not (empty .tls.extraHosts))) | ternary "https" "http" }}://{{ .hostname }}{{ trimSuffix "/" .path }}
1616
{{- end }}
1717
# if `appConfig.mongodb` is set, it overrides the config from `mongodb`.
1818
{{- if and $.Values.mongodb.deploy (not (kindIs "map" $.Values.appConfig.mongodb)) }}

backend/templates/ingress.yaml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,20 @@ spec:
4444
{{- if .Values.ingress.extraRules }}
4545
{{- include "common.tplvalues.render" (dict "value" .Values.ingress.extraRules "context" $) | nindent 4 }}
4646
{{- end }}
47-
{{- if or .Values.ingress.tls .Values.ingress.extraTls }}
47+
{{- with .Values.ingress.tls -}}
48+
{{- if or .enabled .extraTls }}
4849
tls:
49-
{{- if .Values.ingress.tls }}
50+
{{- if .enabled }}
5051
- hosts:
51-
- {{ .Values.ingress.hostname }}
52-
{{- range .Values.ingress.extraHosts }}
52+
- {{ $.Values.ingress.hostname }}
53+
{{- range $.Values.ingress.extraHosts }}
5354
- {{ .name }}
5455
{{- end }}
55-
secretName: {{ printf "%s-tls" .Values.ingress.hostname }}
56+
secretName: {{ .secretName | default (printf "%s-tls" $.Values.ingress.hostname) }}
5657
{{- end }}
57-
{{- if .Values.ingress.extraTls }}
58-
{{- include "common.tplvalues.render" ( dict "value" .Values.ingress.extraTls "context" $ ) | nindent 4 }}
58+
{{- if .extraTls }}
59+
{{- include "common.tplvalues.render" ( dict "value" .extraTls "context" $ ) | nindent 4 }}
5960
{{- end }}
6061
{{- end }}
62+
{{- end -}}
6163
{{- end }}

backend/values.yaml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,21 @@ ingress:
173173
## cert-manager.io/cluster-issuer: cluster-issuer-name
174174
##
175175
annotations: {}
176-
## @param ingress.tls Enable TLS configuration for the hostname defined at ingress.hostname parameter
177-
## TLS certificates will be retrieved from a TLS secret with name: {{- printf "%s-tls" .Values.ingress.hostname }}
178-
## You can use the ingress.secrets parameter to create this TLS secret or relay on cert-manager to create it
179-
##
180-
tls: false
176+
tls:
177+
## @param ingress.tls.enabled Enable default TLS configuration for the hostname defined at ingress.hostname parameter
178+
## TLS certificates will be retrieved from a TLS secret with the configured ingress.tls.secretName or default to {{- printf "%s-tls" .Values.ingress.hostname }}
179+
enabled: false
180+
## @param ingress.tls.secretName Override the secret to retrieve the TLS certificates from
181+
## will default to {{- printf "%s-tls" .Values.ingress.hostname }}
182+
secretName: null
183+
## @param ingress.tls.extraTls The tls configuration for additional hostnames to be covered with this ingress record.
184+
## see: https://kubernetes.io/docs/concepts/services-networking/ingress/#tls
185+
## extraTls:
186+
## - hosts:
187+
## - snoty.example.com
188+
## secretName: snoty-tls-secret
189+
##
190+
extraTls: []
181191
## @param ingress.extraHosts The list of additional hostnames to be covered with this ingress record.
182192
## Most likely the hostname above will be enough, but in the event more hosts are needed, this is an array
183193
## extraHosts:
@@ -194,14 +204,6 @@ ingress:
194204
## servicePort: use-annotation
195205
##
196206
extraPaths: []
197-
## @param ingress.extraTls The tls configuration for additional hostnames to be covered with this ingress record.
198-
## see: https://kubernetes.io/docs/concepts/services-networking/ingress/#tls
199-
## extraTls:
200-
## - hosts:
201-
## - minio.local
202-
## secretName: minio.local-tls
203-
##
204-
extraTls: []
205207
## @param ingress.secrets If you're providing your own certificates, please use this to add the certificates as secrets
206208
## key and certificate should start with -----BEGIN CERTIFICATE----- or
207209
## -----BEGIN RSA PRIVATE KEY-----

0 commit comments

Comments
 (0)