2 # Copyright © 2021 Nokia
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
18 In order to use certServiceClient it is needed do define certificates array in target component values.yaml. Each
19 certificate will be requested from separate init container
21 Minimum example of array in target component values.yaml:
23 - mountPath: /var/custom-certs
24 commonName: common-name
26 Full example (other fields are ignored):
28 - mountPath: /var/custom-certs
31 commonName: common-name
42 - http://uri-1.onap.org
43 - http://uri-2.onap.org
45 organization: Linux-Foundation
47 locality: San Francisco
49 organizationalUnit: ONAP
51 There also need to be some includes used in a target component deployment (indent values may need to be adjusted):
52 1. In initContainers section:
53 {{ include "common.certServiceClient.initContainer" . | indent 6 }}
54 2. In volumeMounts section of container using certificates:
55 {{ include "common.certServiceClient.volumeMounts" . | indent 10 }}
56 3. In volumes section:
57 {{ include "common.certServiceClient.volumes" . | indent 8 }}
61 {{- define "common.certServiceClient.initContainer" -}}
62 {{- $dot := default . .dot -}}
63 {{- $initRoot := default $dot.Values.cmpv2Certificate .initRoot -}}
64 {{- $subchartGlobal := mergeOverwrite (deepCopy $initRoot.global) $dot.Values.global -}}
65 {{- if and $subchartGlobal.cmpv2Enabled (not $subchartGlobal.CMPv2CertManagerIntegration) -}}
66 {{- range $index, $certificate := $dot.Values.certificates -}}
67 {{/*# General certifiacate attributes #*/}}
68 {{- $commonName := $certificate.commonName -}}
70 {{- $dnsNames := default (list) $certificate.dnsNames -}}
71 {{- $ipAddresses := default (list) $certificate.ipAddresses -}}
72 {{- $uris := default (list) $certificate.uris -}}
73 {{- $emailAddresses := default (list) $certificate.emailAddresses -}}
74 {{- $sansList := concat $dnsNames $ipAddresses $uris $emailAddresses -}}
75 {{- $sans := join "," $sansList }}
77 {{- $organization := $subchartGlobal.certificate.default.subject.organization -}}
78 {{- $country := $subchartGlobal.certificate.default.subject.country -}}
79 {{- $locality := $subchartGlobal.certificate.default.subject.locality -}}
80 {{- $province := $subchartGlobal.certificate.default.subject.province -}}
81 {{- $orgUnit := $subchartGlobal.certificate.default.subject.organizationalUnit -}}
82 {{- if $certificate.subject -}}
83 {{- $organization := $certificate.subject.organization -}}
84 {{- $country := $certificate.subject.country -}}
85 {{- $locality := $certificate.subject.locality -}}
86 {{- $province := $certificate.subject.province -}}
87 {{- $orgUnit := $certificate.subject.organizationalUnit -}}
89 {{- $caName := default $subchartGlobal.platform.certServiceClient.envVariables.caName $certificate.caName -}}
90 {{- $outputType := default $subchartGlobal.platform.certServiceClient.envVariables.outputType $certificate.outputType -}}
91 {{- $requestUrl := $subchartGlobal.platform.certServiceClient.envVariables.requestURL -}}
92 {{- $certPath := $subchartGlobal.platform.certServiceClient.envVariables.certPath -}}
93 {{- $requestTimeout := $subchartGlobal.platform.certServiceClient.envVariables.requestTimeout -}}
94 {{- $certificatesSecretMountPath := $subchartGlobal.platform.certServiceClient.secret.mountPath -}}
95 {{- $keystorePath := $subchartGlobal.platform.certServiceClient.envVariables.keystorePath -}}
96 {{- $keystorePassword := $subchartGlobal.platform.certServiceClient.envVariables.keystorePassword -}}
97 {{- $truststorePath := $subchartGlobal.platform.certServiceClient.envVariables.truststorePath -}}
98 {{- $truststorePassword := $subchartGlobal.platform.certServiceClient.envVariables.truststorePassword -}}
99 - name: certs-init-{{ $index }}
100 image: {{ include "repositoryGenerator.image.certserviceclient" $dot }}
101 imagePullPolicy: {{ $dot.Values.global.pullPolicy | default $dot.Values.pullPolicy }}
104 value: {{ $requestUrl | quote }}
105 - name: REQUEST_TIMEOUT
106 value: {{ $requestTimeout | quote }}
108 value: {{ $certPath | quote }}
110 value: {{ $outputType | quote }}
112 value: {{ $caName | quote }}
114 value: {{ $commonName | quote }}
116 value: {{ $sans | quote }}
118 value: {{ $organization | quote }}
119 - name: ORGANIZATION_UNIT
120 value: {{ $orgUnit | quote }}
122 value: {{ $locality | quote }}
124 value: {{ $province | quote }}
126 value: {{ $country | quote }}
127 - name: KEYSTORE_PATH
128 value: {{ $keystorePath | quote }}
129 - name: KEYSTORE_PASSWORD
130 value: {{ $keystorePassword | quote }}
131 - name: TRUSTSTORE_PATH
132 value: {{ $truststorePath | quote }}
133 - name: TRUSTSTORE_PASSWORD
134 value: {{ $truststorePassword | quote }}
135 terminationMessagePath: /dev/termination-log
136 terminationMessagePolicy: File
138 - mountPath: {{ $certPath }}
139 name: cmpv2-certs-volume-{{ $index }}
140 - mountPath: {{ $certificatesSecretMountPath }}
141 name: certservice-tls-volume
146 {{- define "common.certServiceClient.volumes" -}}
147 {{- $dot := default . .dot -}}
148 {{- $initRoot := default $dot.Values.cmpv2Certificate .initRoot -}}
149 {{- $subchartGlobal := mergeOverwrite (deepCopy $initRoot.global) $dot.Values.global -}}
150 {{- if and $subchartGlobal.cmpv2Enabled (not $subchartGlobal.CMPv2CertManagerIntegration) -}}
151 {{- $certificatesSecretName := $subchartGlobal.platform.certServiceClient.secret.name -}}
152 - name: certservice-tls-volume
154 secretName: {{ $certificatesSecretName }}
155 {{ range $index, $certificate := $dot.Values.certificates -}}
156 - name: cmpv2-certs-volume-{{ $index }}
163 {{- define "common.certServiceClient.volumeMounts" -}}
164 {{- $dot := default . .dot -}}
165 {{- $initRoot := default $dot.Values.cmpv2Certificate .initRoot -}}
166 {{- $subchartGlobal := mergeOverwrite (deepCopy $initRoot.global) $dot.Values.global -}}
167 {{- if and $subchartGlobal.cmpv2Enabled (not $subchartGlobal.CMPv2CertManagerIntegration) -}}
168 {{- range $index, $certificate := $dot.Values.certificates -}}
169 {{- $mountPath := $certificate.mountPath -}}
170 - mountPath: {{ $mountPath }}
171 name: cmpv2-certs-volume-{{ $index }}