Fix configuration of elasticsearch

elasticsearch config file was mapped to wrong location.
Effectively, elasticsearch.yml file was not taken into account and
default values are used.
Issue-ID: OOM-390

Signed-off-by: BorislavG <Borislav.Glozman@amdocs.com>
Change-Id: I494341f4c32dff9a13f4b0a460a24e6e9776c584
diff --git a/kubernetes/log/resources/elasticsearch/conf/elasticsearch.yml b/kubernetes/log/resources/elasticsearch/conf/elasticsearch.yml
index de92a58..0b579d0 100644
--- a/kubernetes/log/resources/elasticsearch/conf/elasticsearch.yml
+++ b/kubernetes/log/resources/elasticsearch/conf/elasticsearch.yml
@@ -13,26 +13,26 @@
 # ---------------------------------- Cluster -----------------------------------
 #
 # Name of the Elasticsearch cluster.
-# A node can only join a cluster when it shares its cluster.name with all the other nodes in the cluster. 
-# The default name is elasticsearch, but you should change it to an appropriate name which describes the 
-# purpose of the cluster. 
+# A node can only join a cluster when it shares its cluster.name with all the other nodes in the cluster.
+# The default name is elasticsearch, but you should change it to an appropriate name which describes the
+# purpose of the cluster.
 #
-cluster.name: "onap-log" 
+cluster.name: "onap-log"
 #
-# The port that other nodes in the cluster should use when communicating with this node. 
+# The port that other nodes in the cluster should use when communicating with this node.
 # Required for Elasticsearch's nodes running on different cluster nodes.
 # More : https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-transport.html
-transport.publish_port:$transport.publish_port
+#transport.publish_port:$transport.publish_port
 #
 # The host address to publish for nodes in the cluster to connect to.
 # Required for Elasticsearch's nodes running on different cluster nodes.
 # More : https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-transport.html
-transport.publish_host:$transport.publish_host
+#transport.publish_host:$transport.publish_host
 #
 # ------------------------------------ Node ------------------------------------
 #
 # It is better to provide different meaningfull names fot different elastic nodes.
-# By default, Elasticsearch will take the 7 first character of the randomly generated uuid used as the node id. 
+# By default, Elasticsearch will take the 7 first character of the randomly generated uuid used as the node id.
 # Note that the node id is persisted and does not change when a node restarts
 #
 #node.name: $node.name
@@ -44,20 +44,20 @@
 # ----------------------------------- Paths ------------------------------------
 #
 # The location of the data files of each index / shard allocated on the node. Can hold multiple locations separated by coma.
-# In production, we should not keep this default to "/elasticsearch/data", as on upgrading Elasticsearch, directory structure 
+# In production, we should not keep this default to "/elasticsearch/data", as on upgrading Elasticsearch, directory structure
 # may change & can deal to data loss.
 path.data: /usr/share/elasticsearch/data
 #
-# Elasticsearch's log files location. In production, we should not keep this default to "/elasticsearch/logs", 
+# Elasticsearch's log files location. In production, we should not keep this default to "/elasticsearch/logs",
 # as on upgrading Elasticsearch, directory structure may change.
 path.logs: /usr/share/elasticsearch/logs
 #
 # ----------------------------------- Memory -----------------------------------
 #
-# It is vitally important to the health of your node that none of the JVM is ever swapped out to disk. 
+# It is vitally important to the health of your node that none of the JVM is ever swapped out to disk.
 # Lock the memory on startup.
 #
-bootstrap.memory_lock: true
+bootstrap.memory_lock: false
 #
 # Make sure that the heap size is set to about half the memory available
 # on the system and that the owner of the process is allowed to use this
@@ -68,8 +68,8 @@
 # ---------------------------------- Network -----------------------------------
 #
 # Set the bind address to a specific IP (IPv4 or IPv6):
-# In order to communicate and to form a cluster with nodes on other servers, your node will need to bind to a 
-# non-loopback address. 
+# In order to communicate and to form a cluster with nodes on other servers, your node will need to bind to a
+# non-loopback address.
 network.host: 0.0.0.0
 #
 # Set a custom port for HTTP: If required, default is 9200-9300
@@ -80,19 +80,19 @@
 #
 # --------------------------------- Discovery ----------------------------------
 #
-# Pass an initial list of hosts to perform discovery when new node is started:
-# To form a cluster with nodes on other servers, you have to provide a seed list of other nodes in the cluster 
-# that are likely to be live and contactable. 
-# By default, Elasticsearch will bind to the available loopback addresses and will scan ports 9300 to 9305 to try 
+# Pass an initial list of hosts to perform discovery when new node is started
+# To form a cluster with nodes on other servers, you have to provide a seed list of other nodes in the cluster
+# that are likely to be live and contactable.
+# By default, Elasticsearch will bind to the available loopback addresses and will scan ports 9300 to 9305 to try
 # to connect to other nodes running on the same server.
 #
-discovery.zen.ping.unicast.hosts: ["elasticsearch.onap-log"]
+#discovery.zen.ping.unicast.hosts: ["elasticsearch.onap-log"
 #$discovery.zen.ping.unicast.hosts
 #
-# This setting tells Elasticsearch to not elect a master unless there are enough master-eligible nodes  
+# This setting tells Elasticsearch to not elect a master unless there are enough master-eligible nodes
 # available. Only then will an election take place.
 # Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
-discovery.zen.minimum_master_nodes: 1 
+discovery.zen.minimum_master_nodes: 1
 #
 # For more information, consult the zen discovery module documentation.
 #
@@ -112,10 +112,10 @@
 # Set a custom port for HTTP: If required, default is 9200-9300
 # This is used for REST APIs
 http.port: 9200
-# Port to bind for communication between nodes. Accepts a single value or a range. 
+# Port to bind for communication between nodes. Accepts a single value or a range.
 # If a range is specified, the node will bind to the first available port in the range.
 # Defaults to 9300-9400.
-# More info: 
+# More info:
 transport.tcp.port: 9300
 
 xpack.graph.enabled: false
@@ -127,14 +127,8 @@
 xpack.monitoring.enabled: false
 #Set to false to disable X-Pack monitoring features.
 
-xpack.reporting.enabled: false
-#Set to false to disable X-Pack reporting features.
-
 xpack.security.enabled: false
 #Set to false to disable X-Pack security features.
 
 xpack.watcher.enabled: false
 #Set to false to disable Watcher.
-
-index.number_of_replicas: 0
-
diff --git a/kubernetes/log/templates/all-services.yaml b/kubernetes/log/templates/all-services.yaml
index 3984f12..0885aff 100644
--- a/kubernetes/log/templates/all-services.yaml
+++ b/kubernetes/log/templates/all-services.yaml
@@ -15,6 +15,21 @@
   selector:
     app: elasticsearch
   type: NodePort
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: elasticsearchtcp
+  namespace: {{ .Values.nsPrefix }}-log
+  labels:
+    app: elasticsearch
+spec:
+  ports:
+  - name: tcp
+    port: 9300
+    targetPort: 9300
+  selector:
+    app: elasticsearch
 #{{ end }}
 #{{ if not .Values.disableLogLogstash }}
 ---
@@ -51,4 +66,4 @@
   selector:
     app: kibana
   type: NodePort
-#{{ end }}
\ No newline at end of file
+#{{ end }}
diff --git a/kubernetes/log/templates/elasticsearch-deployment.yaml b/kubernetes/log/templates/elasticsearch-deployment.yaml
index f0db31a..c123df1 100644
--- a/kubernetes/log/templates/elasticsearch-deployment.yaml
+++ b/kubernetes/log/templates/elasticsearch-deployment.yaml
@@ -51,10 +51,11 @@
           protocol: TCP
         readinessProbe:
           tcpSocket:
-            port: 9200
+            port: 9300
         volumeMounts:
-         - mountPath: /usr/share/elasticsearch/conf/
+         - mountPath: /usr/share/elasticsearch/config/elasticsearch.yml
            name: elasticsearch-conf
+           subPath: elasticsearch.yml
          - mountPath: /usr/share/elasticsearch/data/
            name: elasticsearch-data
          - mountPath: /usr/share/elasticsearch/logs/
@@ -80,4 +81,5 @@
   namespace: {{ .Values.nsPrefix }}-log
 data:
 {{ (.Files.Glob "resources/elasticsearch/conf/elasticsearch.yml").AsConfig | indent 2 }}
-#{{ end }}
\ No newline at end of file
+#{{ end }}
+