aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/common/nginx/templates/tls-secret.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'kubernetes/common/nginx/templates/tls-secret.yaml')
-rw-r--r--kubernetes/common/nginx/templates/tls-secret.yaml35
1 files changed, 35 insertions, 0 deletions
diff --git a/kubernetes/common/nginx/templates/tls-secret.yaml b/kubernetes/common/nginx/templates/tls-secret.yaml
new file mode 100644
index 0000000000..4a265f5243
--- /dev/null
+++ b/kubernetes/common/nginx/templates/tls-secret.yaml
@@ -0,0 +1,35 @@
+{{- /*
+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" .) .Values.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 }}