Add standalone R3 RIC platform helm charts and deployment scripts.
[ric-plt/ric-dep.git] / 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 {{ $platformNameSpace := include "common.namespace.platform" . }}
23 {{ $xAppNameSpace := include "common.namespace.xapp" . }}
24 {{ $nameSpaceList := list $platformNameSpace $xAppNameSpace }}
25 {{- range $nameSpaceList }}
26 {{- $namespace := . }}
27 ---
28 apiVersion: v1
29 kind: Secret
30 metadata:
31   name: secret-ric-ca-cert
32   namespace: {{ $namespace }} 
33 data:
34 {{- if $.Values.ca.crt }}
35   ca.crt: {{ $.Values.ca.crt | b64enc }}
36 {{- else }}
37   ca.crt: {{ $ca.Cert | b64enc }}
38 {{- end }}
39
40 ---
41 apiVersion: v1
42 kind: Secret
43 metadata:
44   name: secret-plt-ingress-cert
45   namespace: {{ $namespace }} 
46 data:
47 {{- if not ( and $.Values.ingress.plt.crt $.Values.ingress.plt.key ) }}
48   tls.crt: {{ $pltcert.Cert | b64enc }}
49   tls.key: {{ $pltcert.Key | b64enc }}
50 {{- else }}
51   tls.crt: {{ $.Values.ingress.plt.crt | b64enc }}
52   tls.key: {{ $.Values.ingress.plt.key | b64enc }}
53 {{- end }}
54 ---
55 apiVersion: v1
56 kind: Secret
57 metadata:
58   name: secret-aux-ingress-cert
59   namespace: {{ $namespace }} 
60 data:
61 {{- if not ( and $.Values.ingress.aux.crt $.Values.ingress.aux.key ) }}
62   tls.crt: {{ $auxcert.Cert | b64enc }}
63   tls.key: {{ $auxcert.Key | b64enc }}
64 {{- else }}
65   tls.crt: {{ $.Values.ingress.aux.crt | b64enc }}
66   tls.key: {{ $.Values.ingress.aux.key | b64enc }}
67 {{- end }}
68
69 {{- end }}