Merge "config seg vid deployment"
diff --git a/kubernetes/config/docker/init/src/config/vid/vid/lf_config/vid-my.cnf b/kubernetes/vid/resources/config/lf_config/vid-my.cnf
similarity index 100%
rename from kubernetes/config/docker/init/src/config/vid/vid/lf_config/vid-my.cnf
rename to kubernetes/vid/resources/config/lf_config/vid-my.cnf
diff --git a/kubernetes/config/docker/init/src/config/vid/vid/lf_config/vid-pre-init.sql b/kubernetes/vid/resources/config/lf_config/vid-pre-init.sql
similarity index 100%
rename from kubernetes/config/docker/init/src/config/vid/vid/lf_config/vid-pre-init.sql
rename to kubernetes/vid/resources/config/lf_config/vid-pre-init.sql
diff --git a/kubernetes/vid/resources/config/log/filebeat/filebeat.yml b/kubernetes/vid/resources/config/log/filebeat/filebeat.yml
new file mode 100644
index 0000000..f316b86
--- /dev/null
+++ b/kubernetes/vid/resources/config/log/filebeat/filebeat.yml
@@ -0,0 +1,41 @@
+filebeat.prospectors:
+#it is mandatory, in our case it's log
+- input_type: log
+  #This is the canolical path as mentioned in logback.xml, *.* means it will monitor all files in the directory.
+  paths:
+    - /var/log/onap/*/*/*/*.log
+    - /var/log/onap/*/*/*.log
+    - /var/log/onap/*/*.log
+  #Files older than this should be ignored.In our case it will be 48 hours i.e. 2 days. It is a helping flag for clean_inactive
+  ignore_older: 48h
+  # Remove the registry entry for a file that is more than the specified time. In our case it will be 96 hours, i.e. 4 days. It will help to keep registry records with in limit
+  clean_inactive: 96h
+
+
+# Name of the registry file. If a relative path is used, it is considered relative to the
+# data path. Else full qualified file name.
+#filebeat.registry_file: ${path.data}/registry
+
+
+output.logstash:
+  #List of logstash server ip addresses with port number.
+  #But, in our case, this will be the loadbalancer IP address.
+  #For the below property to work the loadbalancer or logstash should expose 5044 port to listen the filebeat events or port in the property should be changed appropriately.
+  hosts: ["logstash.onap-log:5044"]
+  #If enable will do load balancing among availabe Logstash, automatically.
+  loadbalance: true
+
+  #The list of root certificates for server verifications.
+  #If certificate_authorities is empty or not set, the trusted
+  #certificate authorities of the host system are used.
+  #ssl.certificate_authorities: $ssl.certificate_authorities
+
+  #The path to the certificate for SSL client authentication. If the certificate is not specified,
+  #client authentication is not available.
+  #ssl.certificate: $ssl.certificate
+
+  #The client certificate key used for client authentication.
+  #ssl.key: $ssl.key
+
+  #The passphrase used to decrypt an encrypted key stored in the configured key file
+  #ssl.key_passphrase: $ssl.key_passphrase
diff --git a/kubernetes/config/docker/init/src/config/log/vid/logback.xml b/kubernetes/vid/resources/config/log/vid/logback.xml
similarity index 100%
rename from kubernetes/config/docker/init/src/config/log/vid/logback.xml
rename to kubernetes/vid/resources/config/log/vid/logback.xml
diff --git a/kubernetes/vid/templates/vid-lfconfig-configmap.yaml b/kubernetes/vid/templates/vid-lfconfig-configmap.yaml
new file mode 100644
index 0000000..1cc3f21
--- /dev/null
+++ b/kubernetes/vid/templates/vid-lfconfig-configmap.yaml
@@ -0,0 +1,9 @@
+#{{ if not .Values.disableVidVidMariadb }}
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: vid-lfconfig-configmap
+  namespace: {{ .Values.nsPrefix }}-vid
+data:
+{{ tpl (.Files.Glob "resources/config/lf_config/*").AsConfig . | indent 2 }}
+#{{ end }}
diff --git a/kubernetes/vid/templates/vid-log-configmap.yaml b/kubernetes/vid/templates/vid-log-configmap.yaml
new file mode 100644
index 0000000..00481d2
--- /dev/null
+++ b/kubernetes/vid/templates/vid-log-configmap.yaml
@@ -0,0 +1,17 @@
+#{{ if not .Values.disableVidVidServer }}
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: vid-log-configmap
+  namespace: {{ .Values.nsPrefix }}-vid
+data:
+{{ tpl (.Files.Glob "resources/config/log/vid/*").AsConfig . | indent 2 }}
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: vid-filebeat-configmap
+  namespace: {{ .Values.nsPrefix }}-vid
+data:
+{{ tpl (.Files.Glob "resources/config/log/filebeat/*").AsConfig . | indent 2 }}
+#{{ end }}
diff --git a/kubernetes/vid/templates/vid-mariadb-deployment.yaml b/kubernetes/vid/templates/vid-mariadb-deployment.yaml
index 55ef5da..758ee57 100644
--- a/kubernetes/vid/templates/vid-mariadb-deployment.yaml
+++ b/kubernetes/vid/templates/vid-mariadb-deployment.yaml
@@ -36,9 +36,11 @@
         - mountPath: /var/lib/mysql
           name: vid-mariadb-data
         - mountPath: /docker-entrypoint-initdb.d/vid-pre-init.sql
-          name: vid-pre-init
+          name: vid-lfconfig
+          subPath: vid-pre-init.sql
         - mountPath: /etc/mysql/my.cnf
-          name: my-cnf
+          name: vid-lfconfig
+          subPath: my.cnf
         ports:
         - containerPort: 3306
         readinessProbe:
@@ -53,12 +55,15 @@
         - name: vid-mariadb-data
           persistentVolumeClaim:
             claimName: vid-db
-        - name: vid-pre-init
-          hostPath:
-            path: /dockerdata-nfs/{{ .Values.nsPrefix }}/vid/vid/lf_config/vid-pre-init.sql
-        - name: my-cnf
-          hostPath:
-            path: /dockerdata-nfs/{{ .Values.nsPrefix }}/vid/vid/lf_config/vid-my.cnf
+        - name: vid-lfconfig
+          configMap:
+            name: vid-lfconfig-configmap
+            defaultMode: 0755
+            items:
+            - key: vid-my.cnf
+              path: my.cnf
+            - key: vid-pre-init.sql
+              path: vid-pre-init.sql
       imagePullSecrets:
       - name: "{{ .Values.nsPrefix }}-docker-registry-key"
-#{{ end }}
\ No newline at end of file
+#{{ end }}
diff --git a/kubernetes/vid/templates/vid-server-deployment.yaml b/kubernetes/vid/templates/vid-server-deployment.yaml
index 832fdeb..c979845 100644
--- a/kubernetes/vid/templates/vid-server-deployment.yaml
+++ b/kubernetes/vid/templates/vid-server-deployment.yaml
@@ -73,7 +73,7 @@
           value: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U
         - name: VID_MYSQL_MAXCONNECTIONS
           value: "5"
-        image: {{ .Values.image.vid }} 
+        image: {{ .Values.image.vid }}
         imagePullPolicy: {{ .Values.pullPolicy }}
         name: vid-server
         lifecycle:
@@ -90,6 +90,7 @@
           name: vid-logs
         - mountPath: /tmp/logback.xml
           name: vid-logback
+          subPath: logback.xml
         readinessProbe:
           tcpSocket:
             port: 8080
@@ -101,6 +102,7 @@
         volumeMounts:
         - mountPath: /usr/share/filebeat/filebeat.yml
           name: filebeat-conf
+          subPath: filebeat.yml
         - mountPath: /var/log/onap
           name: vid-logs
         - mountPath: /usr/share/filebeat/data
@@ -110,15 +112,15 @@
           hostPath:
             path: /etc/localtime
         - name: filebeat-conf
-          hostPath:
-            path: /dockerdata-nfs/{{ .Values.nsPrefix }}/log/filebeat/logback/filebeat.yml
+          configMap:
+            name: vid-filebeat-configmap
         - name: vid-logs
           emptyDir: {}
         - name: vid-data-filebeat
           emptyDir: {}
         - name: vid-logback
-          hostPath:
-            path: /dockerdata-nfs/{{ .Values.nsPrefix }}/log/vid/logback.xml
+          configMap:
+            name: vid-log-configmap
       imagePullSecrets:
       - name: "{{ .Values.nsPrefix }}-docker-registry-key"
 #{{ end }}