[PORTAL] Use log template 55/125755/3
authorMaciej Wereski <m.wereski@partner.samsung.com>
Mon, 15 Nov 2021 14:19:11 +0000 (15:19 +0100)
committerSylvain Desbureaux <sylvain.desbureaux@orange.com>
Tue, 16 Nov 2021 06:27:46 +0000 (06:27 +0000)
Ability to turn off filebeat is needed as it is  being deprecated. To
achieve that existing log helper template is used.

Issue-ID: OOM-1
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
Change-Id: I7e8df12aaf8e68f12a56d097d8045eeb0924e428

kubernetes/portal/components/portal-app/templates/deployment.yaml
kubernetes/portal/components/portal-app/values.yaml
kubernetes/portal/components/portal-sdk/templates/deployment.yaml
kubernetes/portal/components/portal-sdk/values.yaml
kubernetes/portal/templates/configmap.yaml
kubernetes/portal/values.yaml

index 39393ef..db4454d 100644 (file)
@@ -158,7 +158,7 @@ spec:
         - name: properties-onapportal
           mountPath: "{{ .Values.global.env.tomcatDir }}/temp"
         - name: var-log-onap
-          mountPath: /var/log/onap
+          mountPath: "{{ .Values.log.path }}"
         resources:
 {{ include "common.resources" . }}
       {{- if .Values.nodeSelector }}
@@ -169,17 +169,7 @@ spec:
       affinity:
 {{ toYaml .Values.affinity | indent 10 }}
       {{- end }}
-      - name: filebeat-onap
-        image: {{ include "repositoryGenerator.image.logging" . }}
-        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-        volumeMounts:
-        - mountPath: /usr/share/filebeat/filebeat.yml
-          name: filebeat-conf
-          subPath: filebeat.yml
-        - name: portal-data-filebeat
-          mountPath: /usr/share/filebeat/data
-        - name: var-log-onap
-          mountPath: /var/log/onap
+      {{ include "common.log.sidecar" . | nindent 6 }}
       volumes:
 {{ include "common.certInitializer.volumes" . | indent 8 }}
         - name: localtime
@@ -192,13 +182,9 @@ spec:
           configMap:
             name: {{ include "common.fullname" . }}-onapportal
             defaultMode: 0755
-        - name: filebeat-conf
-          configMap:
-            name: portal-filebeat
+        {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix . )) | nindent 8 }}
         - name: var-log-onap
           emptyDir: {}
-        - name: portal-data-filebeat
-          emptyDir: {}
         - name: portal-tomcat-logs
           emptyDir: {}
       imagePullSecrets:
index b46876c..6cf2513 100644 (file)
@@ -166,3 +166,8 @@ resources:
       cpu: 2
       memory: 8Gi
   unlimited: {}
+
+# Log configuration
+log:
+  path: /var/log/onap
+logConfigMapNamePrefix: '{{ include "common.fullname" . }}'
index 95247b3..abc5daa 100644 (file)
@@ -149,7 +149,7 @@ spec:
         - name: portal-tomcat-logs
           mountPath: "{{ .Values.global.env.tomcatDir }}/logs"
         - name: var-log-onap
-          mountPath: /var/log/onap
+          mountPath: "{{ .Values.log.path }}"
         resources:
 {{ include "common.resources" . }}
       {{- if .Values.nodeSelector }}
@@ -160,17 +160,7 @@ spec:
       affinity:
 {{ toYaml .Values.affinity | indent 10 }}
       {{- end }}
-      - name: filebeat-onap
-        image: {{ include "repositoryGenerator.image.logging" . }}
-        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-        volumeMounts:
-        - mountPath: /usr/share/filebeat/filebeat.yml
-          name: filebeat-conf
-          subPath: filebeat.yml
-        - name: portal-data-filebeat
-          mountPath: /usr/share/filebeat/data
-        - name: var-log-onap
-          mountPath: /var/log/onap
+      {{ include "common.log.sidecar" . | nindent 6 }}
       volumes:
         - name: localtime
           hostPath:
@@ -182,13 +172,9 @@ spec:
           configMap:
             name: {{ include "common.fullname" . }}-onapportalsdk
             defaultMode: 0755
-        - name: filebeat-conf
-          configMap:
-            name: portal-filebeat
+        {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 8 }}
         - name: var-log-onap
           emptyDir: {}
-        - name: portal-data-filebeat
-          emptyDir: {}
         - name: portal-tomcat-logs
           emptyDir: {}
 {{ include "common.certInitializer.volumes" . | indent 8 }}
index 7631c3a..f0c3954 100644 (file)
@@ -161,3 +161,8 @@ resources:
       cpu: 4
       memory: 10Gi
   unlimited: {}
+
+# Log configuration
+log:
+  path: /var/log/onap
+logConfigMapNamePrefix: '{{ include "common.fullname" . }}'
index a474a6c..681f24e 100644 (file)
 # limitations under the License.
 */}}
 
-apiVersion: v1
-kind: ConfigMap
-metadata:
-  name: portal-filebeat
-  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/log/filebeat/filebeat.yml").AsConfig . | indent 2 }}
-
+{{ include "common.log.configMap" . }}
index 0d4b023..0e6c9d6 100644 (file)
@@ -22,6 +22,8 @@ global:
   # application's front end hostname.  Must be resolvable on the client side environment
   portalHostName: "portal.api.simpledemo.onap.org"
 
+  centralizedLoggingEnabled: true
+
 #################################################################
 # Secrets metaconfig
 #################################################################
@@ -72,6 +74,7 @@ portal-app:
   cassandra:
     config:
       cassandraExternalSecret: *dbSecretName
+  logConfigMapNamePrefix: '{{ include "common.release" . }}-portal'
 portal-sdk:
   mariadb:
     config:
@@ -79,6 +82,7 @@ portal-sdk:
   cassandra:
     config:
       cassandraExternalSecret: *dbSecretName
+  logConfigMapNamePrefix: '{{ include "common.release" . }}-portal'
 messageRouter:
   service:
     name: message-router