Merge "[GENERAL] Fix setting of HELM_VER variable"
authorSylvain Desbureaux <sylvain.desbureaux@orange.com>
Mon, 22 Feb 2021 14:06:33 +0000 (14:06 +0000)
committerGerrit Code Review <gerrit@onap.org>
Mon, 22 Feb 2021 14:06:33 +0000 (14:06 +0000)
kubernetes/common/certManagerCertificate/templates/_certificate.tpl
kubernetes/common/cmpv2Certificate/templates/_certServiceClient.tpl
kubernetes/dcaegen2/components/dcae-inventory-api/values.yaml
kubernetes/helm/plugins/deploy/deploy.sh
kubernetes/nbi/values.yaml
kubernetes/sdnc/templates/statefulset.yaml

index 4e43f62..f820c30 100644 (file)
@@ -181,8 +181,10 @@ spec:
 {{- $subchartGlobal := mergeOverwrite (deepCopy $initRoot.global) $dot.Values.global -}}
   {{- range $i, $certificate := $dot.Values.certificates -}}
     {{- $mountPath := $certificate.mountPath -}}
-- mountPath: {{ $mountPath }}
+- mountPath: {{ (printf "%s/secret-%d" $mountPath $i) }}
   name: certmanager-certs-volume-{{ $i }}
+- mountPath: {{ $mountPath }}
+  name: certmanager-certs-volume-{{ $i }}-dir
    {{- end -}}
 {{- end -}}
 
@@ -194,6 +196,8 @@ spec:
   {{- range $i, $certificate := $certificates -}}
     {{- $name := include "common.fullname" $dot -}}
     {{- $certificatesSecretName := default (printf "%s-secret-%d" $name $i) $certificate.secretName -}}
+- name: certmanager-certs-volume-{{ $i }}-dir
+  emptyDir: {}
 - name: certmanager-certs-volume-{{ $i }}
   projected:
     sources:
@@ -217,3 +221,17 @@ spec:
      {{- end }}
   {{- end -}}
 {{- end -}}
+
+{{- define "common.certManager.linkVolumeMounts" -}}
+{{- $dot := default . .dot -}}
+{{- $initRoot := default $dot.Values.certManagerCertificate .initRoot -}}
+{{- $subchartGlobal := mergeOverwrite (deepCopy $initRoot.global) $dot.Values.global -}}
+{{- $certificates := $dot.Values.certificates -}}
+{{- $certsLinkCommand := "" -}}
+  {{- range $i, $certificate := $certificates -}}
+    {{- $destnationPath := (required "'mountPath' for Certificate is required." $certificate.mountPath) -}}
+    {{- $sourcePath := (printf "%s/secret-%d/*" $destnationPath $i) -}}
+    {{- $certsLinkCommand = (printf "ln -s %s %s; %s" $sourcePath $destnationPath $certsLinkCommand) -}}
+  {{- end -}}
+{{ $certsLinkCommand }}
+{{- end -}}
index 57e6c69..58cc9c7 100644 (file)
@@ -27,7 +27,9 @@ Full example (other fields are ignored):
 certificates:
   - mountPath:  /var/custom-certs
     caName: RA
-    outputType: JKS
+    keystore:
+      outputType:
+        - jks
     commonName: common-name
     dnsNames:
       - dns-name-1
@@ -65,7 +67,7 @@ There also need to be some includes used in a target component deployment (inden
 {{- if and $subchartGlobal.cmpv2Enabled (not $subchartGlobal.CMPv2CertManagerIntegration) -}}
 {{- range $index, $certificate := $dot.Values.certificates -}}
 {{/*# General certifiacate attributes  #*/}}
-{{- $commonName     := $certificate.commonName     -}}
+{{- $commonName     := (required "'commonName' for Certificate is required." $certificate.commonName) -}}
 {{/*# SAN's #*/}}
 {{- $dnsNames       := default (list)    $certificate.dnsNames       -}}
 {{- $ipAddresses    := default (list)    $certificate.ipAddresses    -}}
@@ -87,7 +89,11 @@ There also need to be some includes used in a target component deployment (inden
 {{- $orgUnit        := $certificate.subject.organizationalUnit -}}
 {{- end -}}
 {{- $caName := default $subchartGlobal.platform.certServiceClient.envVariables.caName $certificate.caName -}}
-{{- $outputType := default $subchartGlobal.platform.certServiceClient.envVariables.outputType  $certificate.outputType  -}}
+{{- $outputType := $subchartGlobal.platform.certServiceClient.envVariables.outputType -}}
+{{- if $certificate.keystore -}}
+{{- $outputTypeList := (required "'outputType' in 'keystore' section is required." $certificate.keystore.outputType) -}}
+{{- $outputType = mustFirst ($outputTypeList) | upper -}}
+{{- end -}}
 {{- $requestUrl := $subchartGlobal.platform.certServiceClient.envVariables.requestURL -}}
 {{- $certPath := $subchartGlobal.platform.certServiceClient.envVariables.certPath -}}
 {{- $requestTimeout := $subchartGlobal.platform.certServiceClient.envVariables.requestTimeout -}}
index 7abf0ca..1bc13ef 100644 (file)
@@ -44,7 +44,7 @@ config:
 # Application configuration defaults.
 #################################################################
 # application image
-image: onap/org.onap.dcaegen2.platform.inventory-api:3.5.1
+image: onap/org.onap.dcaegen2.platform.inventory-api:3.5.2
 
 pullPolicy: Always
 
index 40338b9..3bcb404 100755 (executable)
@@ -266,7 +266,11 @@ deploy() {
   done
 
   # report on success/failures of installs/upgrades
-  helm ls | grep FAILED | grep $RELEASE
+  if [[ $HELM_VER == "v3."* ]]; then
+    helm ls --all-namespaces | grep -i FAILED | grep $RELEASE
+  else
+    helm ls | grep FAILED | grep $RELEASE
+  fi
 }
 HELM_VER=$(helm version --template "{{.Version}}")
 echo $HELM_VER
index bc1f19a..158c0e9 100644 (file)
@@ -66,7 +66,7 @@ subChartsOnly:
 
 # application image
 repository: nexus3.onap.org:10001
-image: onap/externalapi/nbi:8.0.0-latest
+image: onap/externalapi/nbi:8.0.0
 pullPolicy: IfNotPresent
 sdc_authorization: Basic YWFpOktwOGJKNFNYc3pNMFdYbGhhazNlSGxjc2UyZ0F3ODR2YW9HR21KdlV5MlU=
 aai_authorization: Basic QUFJOkFBSQ==
index 7441dac..96fa337 100644 (file)
@@ -128,6 +128,13 @@ spec:
         - name: {{ include "common.name" . }}
           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+          {{- if and .Values.global.cmpv2Enabled .Values.global.CMPv2CertManagerIntegration }}
+          {{- $linkCommand := include "common.certManager.linkVolumeMounts" . }}
+          lifecycle:
+            postStart:
+              exec:
+                command: ["sh", "-c", {{$linkCommand | quote}} ]
+          {{- end }}
           command: ["/bin/bash"]
           args: ["-c", "/opt/onap/sdnc/bin/createLinks.sh ; /opt/onap/sdnc/bin/startODL.sh"]
           ports:
@@ -197,7 +204,11 @@ spec:
           {{- if .Values.config.sdnr.sdnrdbTrustAllCerts }}
           - name: SDNRDBTRUSTALLCERTS
             value: "true"
-          {{ end }}
+          {{- end }}
+          {{- if .Values.global.cmpv2Enabled }}
+          - name: ODL_CERT_DIR
+            value: {{ (mustFirst (.Values.certificates)).mountPath }}
+          {{- end }}
 
           volumeMounts:
 {{ include "common.certInitializer.volumeMount" . | indent 10 }}