Merge R3 into master
[it/dep.git] / ric-aux / helm / infrastructure / subcharts / certificate-manager / templates / secret.yaml
1 ################################################################################
2 #   Copyright (c) 2019 AT&T Intellectual Property.                             #
3 #                                                                              #
4 #   Licensed under the Apache License, Version 2.0 (the "License");            #
5 #   you may not use this file except in compliance with the License.           #
6 #   You may obtain a copy of the License at                                    #
7 #                                                                              #
8 #       http://www.apache.org/licenses/LICENSE-2.0                             #
9 #                                                                              #
10 #   Unless required by applicable law or agreed to in writing, software        #
11 #   distributed under the License is distributed on an "AS IS" BASIS,          #
12 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
13 #   See the License for the specific language governing permissions and        #
14 #   limitations under the License.                                             #
15 ################################################################################
16 {{- $ca := genCA "/C=US/O=O-RAN Alliance/OU=O-RAN Software Community" 9125 -}}
17 {{- $pltAltNames := list ( include "common.ingresscontroller.url.platform" . ) -}}
18 {{- $auxAltNames := list ( include "common.ingresscontroller.url.aux" . ) -}}
19 {{- $pltcert := genSignedCert "/C=US/O=O-RAN Alliance/OU=O-RAN Software Community/CN=RIC-Platform" nil $pltAltNames 9125 $ca -}}
20 {{- $auxcert := genSignedCert "/C=US/O=O-RAN Alliance/OU=O-RAN Software Community/CN=helm" nil $auxAltNames 9125 $ca -}}
21
22 {{ $auxNameSpace := include "common.namespace.aux" . }}
23 {{ $nameSpaceList := list $auxNameSpace }}
24 {{- range $nameSpaceList }}
25 {{- $namespace := . }}
26 ---
27 apiVersion: v1
28 kind: Secret
29 metadata:
30   name: secret-ric-ca-cert
31   namespace: {{ $namespace }} 
32 data:
33 {{- if $.Values.ca.crt }}
34   ca.crt: {{ $.Values.ca.crt | b64enc }}
35 {{- else }}
36   ca.crt: {{ $ca.Cert | b64enc }}
37 {{- end }}
38
39 ---
40 apiVersion: v1
41 kind: Secret
42 metadata:
43   name: secret-plt-ingress-cert
44   namespace: {{ $namespace }} 
45 data:
46 {{- if not ( and $.Values.ingress.plt.crt $.Values.ingress.plt.key ) }}
47   tls.crt: {{ $pltcert.Cert | b64enc }}
48   tls.key: {{ $pltcert.Key | b64enc }}
49 {{- else }}
50   tls.crt: {{ $.Values.ingress.plt.crt | b64enc }}
51   tls.key: {{ $.Values.ingress.plt.key | b64enc }}
52 {{- end }}
53 ---
54 apiVersion: v1
55 kind: Secret
56 metadata:
57   name: secret-aux-ingress-cert
58   namespace: {{ $namespace }} 
59 data:
60 {{- if not ( and $.Values.ingress.aux.crt $.Values.ingress.aux.key ) }}
61   tls.crt: {{ $auxcert.Cert | b64enc }}
62   tls.key: {{ $auxcert.Key | b64enc }}
63 {{- else }}
64   tls.crt: {{ $.Values.ingress.aux.crt | b64enc }}
65   tls.key: {{ $.Values.ingress.aux.key | b64enc }}
66 {{- end }}
67
68 {{- end }}