Mounting the postgres config in xos-db

Change-Id: I4a7765f4afae791a8c2d8bea5f742b93db4649d0
diff --git a/xos-db/templates/_helpers.tpl b/xos-db/templates/_helpers.tpl
index ad2a2b5..1244611 100644
--- a/xos-db/templates/_helpers.tpl
+++ b/xos-db/templates/_helpers.tpl
@@ -22,3 +22,12 @@
 version: {{ .Chart.Version }}
 {{- end }}
 
+{{- define "xos-db.postgresql-conf" }}
+
+listen_addresses = '*'
+
+# as per https://github.com/kubernetes/kubernetes/issues/71233
+huge_pages = off     # on, off, or try
+
+{{- end }}
+
diff --git a/xos-db/templates/db-configmap.yaml b/xos-db/templates/db-configmap.yaml
new file mode 100644
index 0000000..af03cf5
--- /dev/null
+++ b/xos-db/templates/db-configmap.yaml
@@ -0,0 +1,24 @@
+---
+# Copyright 2017-present Open Networking 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.
+
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: xos-db
+  labels:
+    {{- include "xos-db.release_labels" . | indent 4 }}
+data:
+  config: |
+{{ include "xos-db.postgresql-conf" . | indent 4 }}
diff --git a/xos-db/templates/db-deployment.yaml b/xos-db/templates/db-deployment.yaml
index 9814677..4f0bee6 100644
--- a/xos-db/templates/db-deployment.yaml
+++ b/xos-db/templates/db-deployment.yaml
@@ -45,11 +45,22 @@
                   key: password
             - name: PGDATA
               value: "/var/lib/postgresql/data/pgdata"
-{{- if .Values.needDBPersistence }}
           volumeMounts:
+            - name: xos-db-config
+              mountPath: /usr/local/share/postgresql/postgresql.conf.sample
+              subPath: config/postgresql.conf.sample
+{{- if .Values.needDBPersistence }}
             - name: db-pv-storage
               mountPath: "/var/lib/postgresql/data"
+{{- end }}
       volumes:
+        - name: xos-db-config
+          configMap:
+            name: xos-db
+            items:
+              - key: config
+                path: config/postgresql.conf.sample
+{{- if .Values.needDBPersistence }}
         - name: db-pv-storage
           persistentVolumeClaim:
             claimName: {{ .Values.pvClaimName }}