Merge "[SO] Enable SO-Monitoring - use HTTPS and certInitializer"
authorKrzysztof Opasiak <k.opasiak@samsung.com>
Thu, 29 Oct 2020 19:01:15 +0000 (19:01 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 29 Oct 2020 19:01:15 +0000 (19:01 +0000)
1  2 
kubernetes/onap/values.yaml
kubernetes/so/components/so-monitoring/templates/deployment.yaml
kubernetes/so/components/so-monitoring/templates/service.yaml

@@@ -295,6 -295,12 +295,12 @@@ so
      openStackServiceTenantName: "service"
      openStackEncryptedPasswordHere: "c124921a3a0efbe579782cde8227681e"
  
+   # in order to enable static password for so-monitoring uncomment:
+   # so-monitoring:
+   #   server:
+   #     monitoring:
+   #       password: demo123456!
    # configure embedded mariadb
    mariadb:
      config:
@@@ -313,6 -319,3 +319,6 @@@ platform
    enabled: false
  a1policymanagement:
    enabled: false
 +
 +cert-wrapper:
 +  enabled: true
@@@ -1,6 -1,6 +1,7 @@@
 +{{/*
  #  ============LICENSE_START=======================================================
  #   Copyright (C) 2018 Ericsson. All rights reserved.
+ #   Modifications Copyright © 2020 Nokia
  #  ================================================================================
  #  Licensed under the Apache License, Version 2.0 (the "License");
  #  you may not use this file except in compliance with the License.
@@@ -17,7 -17,6 +18,7 @@@
  #  SPDX-License-Identifier: Apache-2.0
  #  ============LICENSE_END=========================================================
  #  @author: gareth.roper@ericsson.com
 +*/}}
  apiVersion: apps/v1
  kind: Deployment
  metadata:
@@@ -44,7 -43,7 +45,7 @@@ spec
          app: {{ include "common.name" . }}
          release: {{ include "common.release" . }}
      spec:
-       initContainers:
+       initContainers: {{ include "so.certificate.container_importer" . | nindent 6 }}
        - name: so-chown
          image: alpine:3.6
          volumeMounts:
        - name: {{ include "common.name" . }}
          image: {{ include "common.repository" . }}/{{ .Values.image }}
          resources: {{ include "common.resources" . | nindent 12 }}
+         command:
+         - /bin/sh
+         args:
+         - -c
+         - |
+           export SO_MONITORING_PASSWORD=`htpasswd -bnBC 10 "" $SO_MON_PASS | tr -d ':\n' | sed 's/\$2y/\$2a/'`
+           {{- if .Values.global.aafEnabled }}
+           export $(grep '^c' {{ .Values.soHelpers.certInitializer.credsPath }}/org.onap.so.cred.props | xargs -0)
+           export $(grep '^c' {{ .Values.soHelpers.certInitializer.credsPath }}/mycreds.prop | xargs -0)
+           export KEYSTORE=file://$cadi_keystore
+           export KEYSTORE_PASSWORD=$cadi_keystore_password_p12
+           export TRUSTSTORE=file://$cadi_truststore
+           export TRUSTSTORE_PASSWORD=$cadi_truststore_password
+           {{- end }}
+           /app/start-app.sh
          env:
          - name: DB_HOST
            valueFrom:
            {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "login") | indent 10 }}
          - name: DB_ADMIN_PASSWORD
            {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "password") | indent 10 }}
+         - name: SO_MONITORING_USERNAME
+           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "app-user-creds" "key" "login") | indent 10 }}
+         - name: SO_MON_PASS
+           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "app-user-creds" "key" "password") | indent 10 }}
          envFrom:
          - configMapRef:
              name: {{ include "common.fullname" . }}-configmap
          imagePullPolicy:  {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-         volumeMounts:
+         volumeMounts: {{ include "so.certificate.volumeMount" . | nindent 8 }}
          - name: logs
            mountPath: /app/logs
          - name: config
          - containerPort: {{ index .Values.containerPort }}
            name: {{ .Values.service.portName }}
            protocol: TCP
-       volumes:
+       volumes: {{ include "so.certificate.volumes" . | nindent 6 }}
        - name: logs
          emptyDir: {}
        - name: config
@@@ -1,6 -1,6 +1,7 @@@
 +{{/*
  #  ============LICENSE_START=======================================================
  #   Copyright (C) 2018 Ericsson. All rights reserved.
+ #   Modifications © 2020 Nokia
  #  ================================================================================
  #  Licensed under the Apache License, Version 2.0 (the "License");
  #  you may not use this file except in compliance with the License.
@@@ -17,7 -17,6 +18,7 @@@
  #  SPDX-License-Identifier: Apache-2.0
  #  ============LICENSE_END=========================================================
  #  @author: gareth.roper@ericsson.com
 +*/}}
  apiVersion: v1
  kind: Service
  metadata:
      release: {{ include "common.release" . }}
      heritage: {{ .Release.Service }}
  spec:
+   {{if .Values.global.aafEnabled -}}
    type: {{ .Values.service.type }}
+   {{- else -}}
+   type: ClusterIP
+   {{- end }}
    ports:
-     {{if eq .Values.service.type "NodePort" -}}
+     {{if and (eq .Values.service.type "NodePort") (.Values.global.aafEnabled) -}}
      - port: {{ .Values.service.internalPort }}
        nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort }}
        name: {{ .Values.service.portName }}