seshukm | 0df1f8e | 2020-08-17 21:45:49 +0530 | [diff] [blame] | 1 | {{- define "so.certificate.container_importer" -}} |
| 2 | {{- $dot := default . .dot -}} |
| 3 | {{- $initRoot := default $dot.Values.soHelpers .initRoot -}} |
| 4 | {{- $subchartDot := fromJson (include "common.subChartDot" (dict "dot" $dot "initRoot" $initRoot)) }} |
| 5 | {{ include "common.certInitializer.initContainer" $subchartDot }} |
| 6 | {{- if $dot.Values.global.aafEnabled }} |
| 7 | - name: {{ include "common.name" $dot }}-msb-cert-importer |
Sylvain Desbureaux | 747982c | 2020-11-19 17:40:05 +0100 | [diff] [blame] | 8 | image: {{ include "repositoryGenerator.repository" $subchartDot }}/{{ $dot.Values.global.aafAgentImage }} |
seshukm | 0df1f8e | 2020-08-17 21:45:49 +0530 | [diff] [blame] | 9 | imagePullPolicy: {{ $dot.Values.global.pullPolicy | default $subchartDot.Values.pullPolicy }} |
| 10 | command: |
| 11 | - "/bin/sh" |
| 12 | args: |
| 13 | - "-c" |
| 14 | - | |
| 15 | export $(grep '^c' {{ $subchartDot.Values.certInitializer.credsPath }}/mycreds.prop | xargs -0) |
| 16 | keytool -import -trustcacerts -alias msb_root -file \ |
| 17 | /certificates/msb-ca.crt -keystore \ |
| 18 | "{{ $subchartDot.Values.certInitializer.credsPath }}/{{ $subchartDot.Values.aaf.trustore }}" \ |
Sylvain Desbureaux | 2954823 | 2020-10-21 18:15:08 +0200 | [diff] [blame] | 19 | -storepass $cadi_truststore_password -noprompt |
Sylvain Desbureaux | 5fa2433 | 2020-11-30 09:30:16 +0100 | [diff] [blame] | 20 | export EXIT_VALUE=$? |
| 21 | if [ "${EXIT_VALUE}" != "0" ] |
| 22 | then |
| 23 | echo "issue with password: $cadi_truststore_password" |
Sylvain Desbureaux | 523e660 | 2020-12-08 10:59:12 +0100 | [diff] [blame] | 24 | ls -lh {{ $subchartDot.Values.certInitializer.credsPath }}/mycreds.prop |
| 25 | cat {{ $subchartDot.Values.certInitializer.credsPath }}/mycreds.prop |
Sylvain Desbureaux | 5fa2433 | 2020-11-30 09:30:16 +0100 | [diff] [blame] | 26 | exit $EXIT_VALUE |
| 27 | else |
| 28 | keytool -importkeystore -srckeystore "{{ $subchartDot.Values.certInitializer.credsPath }}/truststoreONAPall.jks" \ |
| 29 | -srcstorepass {{ $subchartDot.Values.certInitializer.trustStoreAllPass }} \ |
| 30 | -destkeystore "{{ $subchartDot.Values.certInitializer.credsPath }}/{{ $subchartDot.Values.aaf.trustore }}" \ |
| 31 | -deststorepass $cadi_truststore_password -noprompt |
| 32 | export EXIT_VALUE=$? |
| 33 | fi |
| 34 | exit $EXIT_VALUE |
seshukm | 0df1f8e | 2020-08-17 21:45:49 +0530 | [diff] [blame] | 35 | volumeMounts: |
| 36 | {{ include "common.certInitializer.volumeMount" $subchartDot | indent 2 | trim }} |
| 37 | - name: {{ include "common.name" $dot }}-msb-certificate |
| 38 | mountPath: /certificates |
| 39 | {{- end }} |
| 40 | {{- end -}} |
| 41 | |
| 42 | {{- define "so.certificate.volumes" -}} |
| 43 | {{- $dot := default . .dot -}} |
| 44 | {{- $initRoot := default $dot.Values.soHelpers .initRoot -}} |
| 45 | {{- $subchartDot := fromJson (include "common.subChartDot" (dict "dot" $dot "initRoot" $initRoot)) }} |
| 46 | {{ include "common.certInitializer.volumes" $subchartDot }} |
| 47 | {{- if $dot.Values.global.aafEnabled }} |
| 48 | - name: {{ include "common.name" $dot }}-msb-certificate |
| 49 | secret: |
| 50 | secretName: {{ include "common.secret.getSecretNameFast" (dict "global" $subchartDot "uid" "so-onap-certs") }} |
| 51 | {{- end }} |
| 52 | {{- end -}} |
| 53 | |
| 54 | {{- define "so.certificate.volumeMount" -}} |
| 55 | {{- $dot := default . .dot -}} |
| 56 | {{- $initRoot := default $dot.Values.soHelpers .initRoot -}} |
| 57 | {{- $subchartDot := fromJson (include "common.subChartDot" (dict "dot" $dot "initRoot" $initRoot)) }} |
| 58 | {{ include "common.certInitializer.volumeMount" $subchartDot }} |
| 59 | {{- end -}} |
| 60 | |
| 61 | {{- define "so.certificates.env" -}} |
| 62 | {{- $dot := default . .dot -}} |
| 63 | {{- $initRoot := default $dot.Values.soHelpers .initRoot -}} |
| 64 | {{- $subchartDot := fromJson (include "common.subChartDot" (dict "dot" $dot "initRoot" $initRoot)) }} |
| 65 | {{- if $dot.Values.global.aafEnabled }} |
| 66 | - name: TRUSTSTORE |
| 67 | value: {{ $subchartDot.Values.certInitializer.credsPath }}/{{ $subchartDot.Values.aaf.trustore }} |
| 68 | {{- if $dot.Values.global.security.aaf.enabled }} |
| 69 | - name: KEYSTORE |
Sylvain Desbureaux | a1bbe5c | 2020-10-28 16:55:18 +0100 | [diff] [blame] | 70 | value: {{ $subchartDot.Values.certInitializer.credsPath }}/org.onap.so.p12 |
seshukm | 0df1f8e | 2020-08-17 21:45:49 +0530 | [diff] [blame] | 71 | {{- end }} |
| 72 | {{- end }} |
| 73 | {{- end -}} |