Merge "[AAI] Add model-loader tracing config"
[oom.git] / kubernetes / common / mongodb / templates / secrets-ca.yaml
1 {{- /*
2 Copyright VMware, Inc.
3 SPDX-License-Identifier: APACHE-2.0
4 */}}
5
6 {{- if (include "mongodb.createTlsSecret" .) }}
7 {{- $secretName := printf "%s" (include "mongodb.tlsSecretName" .) }}
8 {{- $fullname := include "mongodb.fullname" . }}
9 {{- $releaseNamespace := .Release.Namespace }}
10 {{- $clusterDomain := .Values.clusterDomain }}
11 {{- $cn := printf "%s.%s.svc.%s" $fullname .Release.Namespace $clusterDomain }}
12 apiVersion: v1
13 kind: Secret
14 metadata:
15   name: {{ $secretName }}
16   namespace: {{ template "mongodb.namespace" . }}
17   labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
18     app.kubernetes.io/component: mongodb
19   {{- if .Values.commonAnnotations }}
20   annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
21   {{- end }}
22 type: Opaque
23 data:
24   {{- if or .Values.tls.caCert .Values.tls.caKey (not .Values.tls.autoGenerated) }}
25   {{- $ca := buildCustomCert (required "A valid .Values.tls.caCert is required!" .Values.tls.caCert) (required "A valid .Values.tls.caKey is required!" .Values.tls.caKey) }}
26   mongodb-ca-cert: {{ b64enc $ca.Cert }}
27   mongodb-ca-key: {{ b64enc $ca.Key }}
28   {{- else }}
29   {{- $ca := genCA "myMongo-ca" 3650 }}
30   mongodb-ca-cert: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "mongodb-ca-cert" "defaultValue" $ca.Cert "context" $) }}
31   mongodb-ca-key: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "mongodb-ca-key" "defaultValue" $ca.Key "context" $) }}
32   {{- end }}
33 {{- end }}