install controlloop drools applications

it will get the proper control loop application  on the fly
to minimize space used in configmaps.

upgrades mariadb to latest stable version (previous one
used by policy was outdated).

fixes pessimistic lock DB problems on PE side

fixes outdated policy-keystore overriding the image one

Change-Id: Ia78d23b57b4e314c44c97912d544b85d0d6c9c5e
Issue-ID: POLICY-766
Signed-off-by: Jorge Hernandez <jh1730@att.com>
diff --git a/kubernetes/policy/charts/drools/templates/configmap.yaml b/kubernetes/policy/charts/drools/templates/configmap.yaml
index 36f458f..29b1c56 100644
--- a/kubernetes/policy/charts/drools/templates/configmap.yaml
+++ b/kubernetes/policy/charts/drools/templates/configmap.yaml
@@ -31,14 +31,6 @@
 apiVersion: v1
 kind: ConfigMap
 metadata:
-  name: {{ include "common.fullname" . }}-script-configmap
-  namespace: {{ include "common.namespace" . }}
-data:
-{{ tpl (.Files.Glob "resources/scripts/do-start.sh*").AsConfig . | indent 2 }}
----
-apiVersion: v1
-kind: ConfigMap
-metadata:
   name: {{ include "common.fullname" . }}-log-configmap
   namespace: {{ include "common.namespace" . }}
 data:
diff --git a/kubernetes/policy/charts/drools/templates/statefulset.yaml b/kubernetes/policy/charts/drools/templates/statefulset.yaml
index 5dd49ed..e492760 100644
--- a/kubernetes/policy/charts/drools/templates/statefulset.yaml
+++ b/kubernetes/policy/charts/drools/templates/statefulset.yaml
@@ -85,9 +85,6 @@
           - mountPath: /etc/localtime
             name: localtime
             readOnly: true
-          - mountPath: /tmp/policy-install/config/policy-keystore
-            name: drools-secret
-            subPath: policy-keystore
           - mountPath: /tmp/policy-install/config/feature-healthcheck.conf
             name: drools-secret
             subPath: feature-healthcheck.conf
@@ -103,6 +100,9 @@
           - mountPath: /tmp/policy-install/config/apps-install.sh
             name: drools-config
             subPath: apps-install.sh
+          - mountPath: /tmp/policy-install/config/drools-preinstall.sh
+            name: drools-config
+            subPath: drools-preinstall.sh
           - mountPath: /usr/share/maven/conf/settings.xml
             name: drools-settingsxml
             subPath: settings.xml
@@ -111,9 +111,6 @@
           - mountPath: /tmp/logback.xml
             name: policy-logback
             subPath: logback.xml
-          - mountPath: /tmp/policy-install/do-start.sh
-            name: pe-scripts
-            subPath: do-start.sh
           lifecycle:
             postStart:
               exec:
@@ -169,19 +166,18 @@
             - key: drools-tweaks.sh
               path: drools-tweaks.sh
               mode: 0755
+            - key: apps-install.sh
+              path: apps-install.sh
+              mode: 0755
+            - key: drools-preinstall.sh
+              path: drools-preinstall.sh
+              mode: 0755
         - name: drools-secret
           secret:
             secretName: {{ include "common.fullname" . }}-secret
             items:
-            - key: policy-keystore
-              path: policy-keystore
-              mode: 0644
             - key: feature-healthcheck.conf
               path: feature-healthcheck.conf
               mode: 0644
-        - name: pe-scripts
-          configMap:
-            name: {{ include "common.fullname" . }}-script-configmap
-            defaultMode: 0777
       imagePullSecrets:
       - name: "{{ include "common.namespace" . }}-docker-registry-key"