From 2123fec0a12f313c15e03efab0ce378d0308d78d Mon Sep 17 00:00:00 2001
From: efiacor <fiachra.corcoran@est.tech>
Date: Fri, 9 Dec 2022 13:40:55 +0000
Subject: [DMAAP] Remove AAF dependency

Remove DMaaP NodePorts
Update dmaap-bc postgres setup and dbc-client image used by DCAE
Use the http port of the dbcClient in the dmaapProvisioning job
Signed-off-by: efiacor <fiachra.corcoran@est.tech>
Change-Id: Ie4888b58b6f7e1405ed67625900da89e58b5cb79
Issue-ID: DMAAP-1573
---
 .../dmaap/components/dmaap-bc/templates/NOTES.txt  | 34 ---------
 .../components/dmaap-bc/templates/configmap.yaml   | 43 +++---------
 .../components/dmaap-bc/templates/deployment.yaml  | 81 +++++++++-------------
 .../dmaap-bc/templates/dmaap-provisioning-job.yaml | 28 ++++++--
 .../components/dmaap-bc/templates/ingress.yaml     | 17 +++++
 .../components/dmaap-bc/templates/secrets.yaml     |  1 -
 6 files changed, 81 insertions(+), 123 deletions(-)
 delete mode 100644 kubernetes/dmaap/components/dmaap-bc/templates/NOTES.txt

(limited to 'kubernetes/dmaap/components/dmaap-bc/templates')

diff --git a/kubernetes/dmaap/components/dmaap-bc/templates/NOTES.txt b/kubernetes/dmaap/components/dmaap-bc/templates/NOTES.txt
deleted file mode 100644
index 050853cfa2..0000000000
--- a/kubernetes/dmaap/components/dmaap-bc/templates/NOTES.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright © 2018  AT&T Intellectual Property.  All rights reserved.
-# Modifications Copyright © 2018 Amdocs,Bell Canada
-#
-# 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.
-
-1. Get the application URL by running these commands:
-{{- if .Values.ingress.enabled }}
-{{- range .Values.ingress.hosts }}
-  http://{{ . }}
-{{- end }}
-{{- else if contains "NodePort" .Values.service.type }}
-  export NODE_PORT=$(kubectl get --namespace {{ include "common.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "common.name" . }}-prov)
-  export NODE_IP=$(kubectl get nodes --namespace {{ include "common.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}")
-  echo http://$NODE_IP:$NODE_PORT
-{{- else if contains "LoadBalancer" .Values.service.type }}
-     NOTE: It may take a few minutes for the LoadBalancer IP to be available.
-           You can watch the status of by running 'kubectl get svc -w {{ include "common.fullname" . }}'
-  export SERVICE_IP=$(kubectl get svc --namespace {{ include "common.namespace" . }} {{ include "common.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
-  echo http://$SERVICE_IP:{{ .Values.service.externalPort }}
-{{- else if contains "ClusterIP" .Values.service.type }}
-  export POD_NAME=$(kubectl get pods --namespace {{ include "common.namespace" . }} -l "app={{ template "common.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
-  echo "Visit http://127.0.0.1:8080 to use your application"
-  kubectl port-forward $POD_NAME 8080:{{ .Values.service.internalPort }}
-{{- end }}
diff --git a/kubernetes/dmaap/components/dmaap-bc/templates/configmap.yaml b/kubernetes/dmaap/components/dmaap-bc/templates/configmap.yaml
index b7c52df169..0dd75f3169 100644
--- a/kubernetes/dmaap/components/dmaap-bc/templates/configmap.yaml
+++ b/kubernetes/dmaap/components/dmaap-bc/templates/configmap.yaml
@@ -15,16 +15,19 @@
 # limitations under the License.
 */}}
 
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ include "common.fullname" . }}-log
+  namespace: {{ include "common.namespace" . }}
+data:
+{{ tpl (.Files.Glob "resources/log/logback.xml").AsConfig . | indent 2 }}
+---
 apiVersion: v1
 kind: ConfigMap
 metadata:
   name: {{ include "common.fullname" . }}-config
   namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ include "common.release" . }}
-    heritage: {{ .Release.Service }}
 data:
 {{ tpl (.Files.Glob "resources/config/*").AsConfig . | indent 2 }}
 ---
@@ -33,11 +36,6 @@ kind: ConfigMap
 metadata:
   name:  {{ include "common.fullname" . }}-dbc-dmaap
   namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ include "common.release" . }}
-    heritage: {{ .Release.Service }}
 data:
 {{ tpl (.Files.Glob "resources/dmaap/*.json").AsConfig . | indent 2 }}
 ---
@@ -46,11 +44,6 @@ kind: ConfigMap
 metadata:
   name:  {{ include "common.fullname" . }}-dbc-dcaelocations
   namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ include "common.release" . }}
-    heritage: {{ .Release.Service }}
 data:
 {{ tpl (.Files.Glob "resources/dcaeLocations/*.json").AsConfig . | indent 2 }}
 ---
@@ -59,11 +52,6 @@ kind: ConfigMap
 metadata:
   name:  {{ include "common.fullname" . }}-dr-nodes
   namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ include "common.release" . }}
-    heritage: {{ .Release.Service }}
 data:
 {{ tpl (.Files.Glob "resources/dr_nodes/*.json").AsConfig . | indent 2 }}
 ---
@@ -72,11 +60,6 @@ kind: ConfigMap
 metadata:
   name:  {{ include "common.fullname" . }}-feeds
   namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ include "common.release" . }}
-    heritage: {{ .Release.Service }}
 data:
 {{ tpl (.Files.Glob "resources/feeds/*.json").AsConfig . | indent 2 }}
 ---
@@ -85,11 +68,6 @@ kind: ConfigMap
 metadata:
   name:  {{ include "common.fullname" . }}-mr-clusters
   namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ include "common.release" . }}
-    heritage: {{ .Release.Service }}
 data:
 {{ tpl (.Files.Glob "resources/mr_clusters/*.json").AsConfig . | indent 2 }}
 ---
@@ -98,10 +76,5 @@ kind: ConfigMap
 metadata:
   name:  {{ include "common.fullname" . }}-topics
   namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ include "common.release" . }}
-    heritage: {{ .Release.Service }}
 data:
 {{ tpl (.Files.Glob "resources/topics/*.json").AsConfig . | indent 2 }}
diff --git a/kubernetes/dmaap/components/dmaap-bc/templates/deployment.yaml b/kubernetes/dmaap/components/dmaap-bc/templates/deployment.yaml
index a0c315426c..e7887cc332 100644
--- a/kubernetes/dmaap/components/dmaap-bc/templates/deployment.yaml
+++ b/kubernetes/dmaap/components/dmaap-bc/templates/deployment.yaml
@@ -24,68 +24,44 @@ spec:
     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
     spec:
       {{ include "common.podSecurityContext" . | indent 6 | trim}}
-{{- if .Values.PG.enabled }}
-      initContainers:
+      initContainers: {{ include "common.readinessCheck.waitFor" . | nindent 6 }}
+      {{- if .Values.usePostgres }}
       - command:
         - sh
         args:
         - -c
         - "cd /config-input && for PFILE in `find . -not -type d | grep -v -F ..`; do envsubst <${PFILE} >/config/${PFILE}; done"
         env:
-        - name: PG_USER
-          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 10 }}
-        - name: PG_PASSWORD
-          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }}
+          - name: PG_USER
+            {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 12 }}
+          - name: PG_PASSWORD
+            {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 12 }}
         volumeMounts:
-        - mountPath: /config-input
-          name: {{ include "common.name" . }}-config-input
-        - mountPath: /config
-          name: {{ include "common.name" . }}-config
-        image: {{ include "repositoryGenerator.image.envsubst" . }}
-        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+          - mountPath: /config-input
+            name: {{ include "common.name" . }}-config-input
+          - mountPath: /config
+            name: {{ include "common.name" . }}-config
         name: {{ include "common.name" . }}-update-config
-{{ include "common.certInitializer.initContainer" . | nindent 6 }}
-{{- if .Values.global.aafEnabled }}
-      - name: {{ include "common.name" . }}-permission-fixer
-        securityContext:
-          runAsUser: 0
-        image: {{ include "repositoryGenerator.image.busybox" . }}
-        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-        volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }}
-        command: ["chown","-Rf","1000:1001", "/opt/app/"]
-#       See AAF-425 for explanation of why this is needed.
-#       This artifact is provisioned in AAF for both pks12 and jks format and apparently
-#       the cadi library is not using the jks password on the jks keystore.
-#       So, this attempts to "fix" the credential property file until this is fixed properly.
-      - name: {{ include "common.name" . }}-cred-fixer
-        image: {{ include "repositoryGenerator.image.busybox" . }}
+        image: {{ include "repositoryGenerator.image.envsubst" . }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-        volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }}
-        command: ["/bin/sh"]
-        args: [ "-c", "sed -i -e '/cadi_keystore_password=/d' -e '/cadi_keystore_password_jks/p' -e 's/cadi_keystore_password_jks/cadi_keystore_password/' -e 's/dmaap-bc.p12/dmaap-bc.jks/' /opt/app/osaaf/local/org.onap.dmaap-bc.cred.props" ]
-{{- end }}
-      - name: {{ include "common.name" . }}-postgres-readiness
-        securityContext:
-          runAsUser: 100
-          runAsGroup: 65533
-        command:
+      - command:
         - /app/ready.py
         args:
         - --container-name
         - {{ .Values.postgres.nameOverride }}
-        - --container-name
-        - message-router
-        - --container-name
-        - dmaap-dr-node
+        securityContext:
+          runAsUser: 100
+          runAsGroup: 65533
         env:
         - name: NAMESPACE
           valueFrom:
             fieldRef:
               apiVersion: v1
               fieldPath: metadata.namespace
+        name: {{ include "common.name" . }}-postgres-readiness
         image: {{ include "repositoryGenerator.image.readiness" . }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-{{- end }}
+      {{- end }}
       containers:
         - name: {{ include "common.name" . }}
           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
@@ -96,7 +72,6 @@ spec:
             httpGet:
               port: {{ .Values.liveness.port }}
               path: /webapi/topics
-              scheme: {{ if (include "common.needTLS" .) }}HTTPS{{ else }}HTTP{{ end }}
             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
             periodSeconds: {{ .Values.liveness.periodSeconds }}
           {{ end -}}
@@ -104,18 +79,19 @@ spec:
             httpGet:
               port: {{ .Values.readiness.port }}
               path: /webapi/topics
-              scheme: {{ if (include "common.needTLS" .) }}HTTPS{{ else }}HTTP{{ end }}
             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
             periodSeconds: {{ .Values.readiness.periodSeconds }}
-          volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
+          volumeMounts:
           - mountPath: /etc/localtime
             name: localtime
             readOnly: true
-# NOTE: on the following several configMaps, careful to include / at end
-#       since there may be more than one file in each mountPath
           - name: {{ include "common.name" . }}-config
             mountPath: /opt/app/config/conf/
-          resources: {{ include "common.resources" . | nindent 12 }}
+          - mountPath: /opt/app/dmaapbc/etc/logback.xml
+            name: {{ include "common.fullname" . }}-log-conf
+            subPath: logback.xml
+          resources:
+{{ include "common.resources" . }}
         {{- if .Values.nodeSelector }}
         nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }}
         {{- end -}}
@@ -123,15 +99,24 @@ spec:
         affinity: {{ toYaml .Values.affinity | nindent 10 }}
         {{- end }}
       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
-      volumes: {{ include "common.certInitializer.volumes" . | nindent 8 }}
+      volumes:
         - name: localtime
           hostPath:
             path: /etc/localtime
+        - name: {{ include "common.fullname" . }}-log-conf
+          configMap:
+            name: {{ include "common.fullname" . }}-log
+        {{- if .Values.usePostgres }}
         - name: {{ include "common.name" . }}-config-input
           configMap:
             name: {{ include "common.fullname" . }}-config
         - name: {{ include "common.name" . }}-config
           emptyDir:
             medium: Memory
+        {{- else }}
+        - name: {{ include "common.name" . }}-config
+          configMap:
+            name: {{ include "common.fullname" . }}-config
+        {{- end }}
       imagePullSecrets:
       - name: "{{ include "common.namespace" . }}-docker-registry-key"
diff --git a/kubernetes/dmaap/components/dmaap-bc/templates/dmaap-provisioning-job.yaml b/kubernetes/dmaap/components/dmaap-bc/templates/dmaap-provisioning-job.yaml
index ab6f573a34..0f6c8f9dc0 100644
--- a/kubernetes/dmaap/components/dmaap-bc/templates/dmaap-provisioning-job.yaml
+++ b/kubernetes/dmaap/components/dmaap-bc/templates/dmaap-provisioning-job.yaml
@@ -1,3 +1,22 @@
+{{/*
+  # ============LICENSE_START===================================================
+  #  Copyright (C) 2022 Nordix Foundation
+  # ============================================================================
+  # 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.
+  #
+  # SPDX-License-Identifier: Apache-2.0
+  # ============LICENSE_END=====================================================
+*/}}
 apiVersion: batch/v1
 kind: Job
 metadata:
@@ -18,7 +37,7 @@ spec:
         - /app/ready.py
         args:
         - --container-name
-        - dmaap-bc
+        - {{ include "common.name" . }}
         env:
         - name: NAMESPACE
           valueFrom:
@@ -27,17 +46,15 @@ spec:
               fieldPath: metadata.namespace
       containers:
       - name: dmaap-provisioning-job
-        image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.global.clientImage }}
+        image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.dbcClientImage }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         env:
         - name: DELAY
           value: "0"
-    {{- if or (include "common.onServiceMesh" .) .Values.global.allow_http }}
         - name: PROTO
           value: "http"
         - name: PORT
           value: "8080"
-    {{ end }}
         - name: REQUESTID
           value: "{{.Chart.Name}}-dmaap-provisioning"
         volumeMounts:
@@ -59,7 +76,8 @@ spec:
           mountPath: /opt/app/config/mr_clusters/
         - name:  {{ include "common.fullname" . }}-topics
           mountPath: /opt/app/config/topics/
-        resources: {{ include "common.resources" . | nindent 10 }}
+        resources:
+{{ include "common.resources" . }}
       {{ include "common.waitForJobContainer" . | indent 6 | trim }}
         {{- if .Values.nodeSelector }}
       nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }}
diff --git a/kubernetes/dmaap/components/dmaap-bc/templates/ingress.yaml b/kubernetes/dmaap/components/dmaap-bc/templates/ingress.yaml
index 8f87c68f1e..a90bf83c07 100644
--- a/kubernetes/dmaap/components/dmaap-bc/templates/ingress.yaml
+++ b/kubernetes/dmaap/components/dmaap-bc/templates/ingress.yaml
@@ -1 +1,18 @@
+{{/*
+# Copyright © 2018  AT&T Intellectual Property.  All rights reserved.
+# Modifications Copyright © 2018 Amdocs, Bell Canada
+#
+# 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.
+*/}}
+
 {{ include "common.ingress" . }}
diff --git a/kubernetes/dmaap/components/dmaap-bc/templates/secrets.yaml b/kubernetes/dmaap/components/dmaap-bc/templates/secrets.yaml
index 7074e4de9a..b7a31c0b0c 100644
--- a/kubernetes/dmaap/components/dmaap-bc/templates/secrets.yaml
+++ b/kubernetes/dmaap/components/dmaap-bc/templates/secrets.yaml
@@ -1,4 +1,3 @@
-
 # Modifications Copyright © 2019 Orange
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
-- 
cgit