BugFix:CtxAggr doesn't pick up events- OOM chg 73/71873/3
authorLeigh, Phillip (pl876u) <phillip.leigh@amdocs.com>
Mon, 5 Nov 2018 17:24:45 +0000 (12:24 -0500)
committerjmac <james.macnider@amdocs.com>
Mon, 5 Nov 2018 20:45:35 +0000 (20:45 +0000)
The root cause is due to DMaap topic wasn't created on a freshly
deployed system.
The solution is to create these POMBA related topics if not exists.

Issue-ID: LOG-794
Change-Id: I0d9aabbbcb649d355b1928e05292f8b51c38ef9f
Signed-off-by: Leigh, Phillip (pl876u) <phillip.leigh@amdocs.com>
kubernetes/pomba/charts/pomba-contextaggregator/resources/bin/pre_start.sh [new file with mode: 0644]
kubernetes/pomba/charts/pomba-contextaggregator/templates/configmap.yaml
kubernetes/pomba/charts/pomba-contextaggregator/templates/deployment.yaml
kubernetes/pomba/charts/pomba-contextaggregator/values.yaml

diff --git a/kubernetes/pomba/charts/pomba-contextaggregator/resources/bin/pre_start.sh b/kubernetes/pomba/charts/pomba-contextaggregator/resources/bin/pre_start.sh
new file mode 100644 (file)
index 0000000..3ef1434
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# Get the list of topic from curl ressult
+dmaap_mr_host=message-router
+dmaap_mr_port=3904
+temp_output_file=".tmpoutput"
+curl -X GET http://$dmaap_mr_host:$dmaap_mr_port/topics  > $temp_output_file
+
+# Test topic POA-AUDIT-INIT, POA-AUDIT-RESULT, POA-RULE-VALIDATION
+TOPICS="POA-AUDIT-INIT POA-RULE-VALIDATION POA-AUDIT-RESULT"
+for i_topic in $TOPICS
+do
+  echo "Looping ... topic: $i_topic"
+  if grep -iFq "$i_topic" $temp_output_file
+  then
+      # code if found
+      echo "$i_topic found."
+  else
+      # code if not found
+      echo "$i_topic NOT found."
+      curl -X POST -H "content-type: application/json" --data "Empty post to create topic" http://$dmaap_mr_host:$dmaap_mr_port/events/$i_topic
+  fi
+done
+
+# remove the temp file
+rm -f $temp_output_file
index 767b240..d5ce98e 100755 (executable)
@@ -27,3 +27,11 @@ metadata:
   namespace: {{ include "common.namespace" . }}
 data:
 {{ tpl (.Files.Glob "resources/config/builders/*").AsConfig . | indent 2 }}
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ include "common.fullname" . }}-pre-start-configmap
+  namespace: {{ include "common.namespace" . }}
+data:
+{{ tpl (.Files.Glob "resources/bin/*").AsConfig . | indent 2 }}
\ No newline at end of file
index 44268db..52a28d0 100755 (executable)
@@ -30,6 +30,21 @@ spec:
         app: {{ include "common.name" . }}
         release: {{ .Release.Name }}
     spec:
+      initContainers:
+      - command:
+        - /root/ready.py
+        args:
+        - --container-name
+        - message-router
+        env:
+        - name: NAMESPACE
+          valueFrom:
+            fieldRef:
+              apiVersion: v1
+              fieldPath: metadata.namespace
+        image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
+        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+        name: {{ include "common.name" . }}-readiness
       containers:
         - name: {{ include "common.name" . }}
           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
@@ -63,6 +78,10 @@ spec:
           - mountPath: /opt/app/config/builders
             name: {{ include "common.fullname" . }}-config-builders
             readOnly: true
+          - mountPath: /opt/app/bin/pre_start.sh
+            name: {{ include "common.fullname" . }}-pre-start
+            subPath: pre_start.sh
+            readOnly: false
           resources:
 {{ include "common.resources" . | indent 12 }}
         {{- if .Values.nodeSelector }}
@@ -83,5 +102,9 @@ spec:
         - name: {{ include "common.fullname" . }}-config-builders
           configMap:
             name: {{ include "common.fullname" . }}-configmap-builders
+        - name: {{ include "common.fullname" . }}-pre-start
+          configMap:
+            name: {{ include "common.fullname" . }}-pre-start-configmap
+            defaultMode: 0777
       imagePullSecrets:
       - name: "{{ include "common.namespace" . }}-docker-registry-key"
index ac8aa6b..9c9a6ff 100755 (executable)
@@ -18,6 +18,8 @@
 global:
   nodePortPrefix: 302
   repository: nexus3.onap.org:10001
+  readinessRepository: oomk8s
+  readinessImage: readiness-check:2.0.0
 
 #################################################################
 # Application configuration defaults.