Files
charts/bitnami/nginx/templates/tls-secret.yaml
Koren Peretz 13787be692 [bitnami/nginx] Global Cluster Domain Support for AutoGenerated SSL Certificate (#33769)
* Update tls-secret.yaml

Signed-off-by: Koren Peretz <62677694+KorenP1@users.noreply.github.com>

* Update Chart.yaml

Signed-off-by: Koren Peretz <62677694+KorenP1@users.noreply.github.com>

* Update CHANGELOG.md

Signed-off-by: Bitnami Bot <bitnami.bot@broadcom.com>

* Update CHANGELOG.md

Signed-off-by: Bitnami Bot <bitnami.bot@broadcom.com>

---------

Signed-off-by: Koren Peretz <62677694+KorenP1@users.noreply.github.com>
Signed-off-by: Bitnami Bot <bitnami.bot@broadcom.com>
Co-authored-by: Bitnami Bot <bitnami.bot@broadcom.com>
2025-05-21 11:54:48 +02:00

36 lines
2.1 KiB
YAML

{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if and .Values.tls.enabled (not .Values.tls.existingSecret) }}
{{- $ca := genCA "nginx-ca" 365 }}
apiVersion: v1
kind: Secret
metadata:
name: {{ printf "%s-tls" (include "common.names.fullname" .) }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
type: kubernetes.io/tls
data:
{{- if .Values.tls.autoGenerated }}
{{- $cert := genSignedCert (include "common.names.fullname" .) nil (list (include "common.names.fullname" .) (printf "%s.%s" (include "common.names.fullname" .) (include "common.names.namespace" .)) (printf "%s.%s.svc" (include "common.names.fullname" .) (include "common.names.namespace" .)) (printf "%s.%s.svc.%s" (include "common.names.fullname" .) (include "common.names.namespace" .) (default .Values.clusterDomain .Values.global.clusterDomain))) 365 $ca }}
{{ .Values.tls.certFilename }}: {{ include "common.secrets.lookup" (dict "secret" (printf "%s-tls" (include "common.names.fullname" .)) "key" .Values.tls.certFilename "defaultValue" $cert.Cert "context" $) }}
{{ .Values.tls.certKeyFilename }}: {{ include "common.secrets.lookup" (dict "secret" (printf "%s-tls" (include "common.names.fullname" .)) "key" .Values.tls.certKeyFilename "defaultValue" $cert.Key "context" $) }}
{{ .Values.tls.certCAFilename }}: {{ include "common.secrets.lookup" (dict "secret" (printf "%s-tls" (include "common.names.fullname" .)) "key" .Values.tls.certCAFilename "defaultValue" $ca.Cert "context" $) }}
{{- else }}
{{- if .Values.tls.cert }}
{{ .Values.tls.certFilename }}: {{ .Values.tls.cert | b64enc }}
{{- end }}
{{- if .Values.tls.key }}
{{ .Values.tls.certKeyFilename }}: {{ .Values.tls.key | b64enc }}
{{- end }}
{{- if .Values.tls.ca }}
{{ .Values.tls.certCAFilename }}: {{ .Values.tls.ca | b64enc }}
{{- end }}
{{- end }}
{{- end }}