Merge R3 into master
[it/dep.git] / ric-aux / helm / infrastructure / subcharts / certificate-manager / templates / secret.yaml
diff --git a/ric-aux/helm/infrastructure/subcharts/certificate-manager/templates/secret.yaml b/ric-aux/helm/infrastructure/subcharts/certificate-manager/templates/secret.yaml
new file mode 100644 (file)
index 0000000..f08defd
--- /dev/null
@@ -0,0 +1,68 @@
+################################################################################
+#   Copyright (c) 2019 AT&T Intellectual Property.                             #
+#                                                                              #
+#   Licensed under the Apache License, Version 2.0 (the "License");            #
+#   you may not use this file except in compliance with the License.           #
+#   You may obtain a copy of the License at                                    #
+#                                                                              #
+#       http://www.apache.org/licenses/LICENSE-2.0                             #
+#                                                                              #
+#   Unless required by applicable law or agreed to in writing, software        #
+#   distributed under the License is distributed on an "AS IS" BASIS,          #
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
+#   See the License for the specific language governing permissions and        #
+#   limitations under the License.                                             #
+################################################################################
+{{- $ca := genCA "/C=US/O=O-RAN Alliance/OU=O-RAN Software Community" 9125 -}}
+{{- $pltAltNames := list ( include "common.ingresscontroller.url.platform" . ) -}}
+{{- $auxAltNames := list ( include "common.ingresscontroller.url.aux" . ) -}}
+{{- $pltcert := genSignedCert "/C=US/O=O-RAN Alliance/OU=O-RAN Software Community/CN=RIC-Platform" nil $pltAltNames 9125 $ca -}}
+{{- $auxcert := genSignedCert "/C=US/O=O-RAN Alliance/OU=O-RAN Software Community/CN=helm" nil $auxAltNames 9125 $ca -}}
+
+{{ $auxNameSpace := include "common.namespace.aux" . }}
+{{ $nameSpaceList := list $auxNameSpace }}
+{{- range $nameSpaceList }}
+{{- $namespace := . }}
+---
+apiVersion: v1
+kind: Secret
+metadata:
+  name: secret-ric-ca-cert
+  namespace: {{ $namespace }} 
+data:
+{{- if $.Values.ca.crt }}
+  ca.crt: {{ $.Values.ca.crt | b64enc }}
+{{- else }}
+  ca.crt: {{ $ca.Cert | b64enc }}
+{{- end }}
+
+---
+apiVersion: v1
+kind: Secret
+metadata:
+  name: secret-plt-ingress-cert
+  namespace: {{ $namespace }} 
+data:
+{{- if not ( and $.Values.ingress.plt.crt $.Values.ingress.plt.key ) }}
+  tls.crt: {{ $pltcert.Cert | b64enc }}
+  tls.key: {{ $pltcert.Key | b64enc }}
+{{- else }}
+  tls.crt: {{ $.Values.ingress.plt.crt | b64enc }}
+  tls.key: {{ $.Values.ingress.plt.key | b64enc }}
+{{- end }}
+---
+apiVersion: v1
+kind: Secret
+metadata:
+  name: secret-aux-ingress-cert
+  namespace: {{ $namespace }} 
+data:
+{{- if not ( and $.Values.ingress.aux.crt $.Values.ingress.aux.key ) }}
+  tls.crt: {{ $auxcert.Cert | b64enc }}
+  tls.key: {{ $auxcert.Key | b64enc }}
+{{- else }}
+  tls.crt: {{ $.Values.ingress.aux.crt | b64enc }}
+  tls.key: {{ $.Values.ingress.aux.key | b64enc }}
+{{- end }}
+
+{{- end }}