Merge "Typo fix for cds-ui chart."
authorBorislav Glozman <Borislav.Glozman@amdocs.com>
Sun, 1 Dec 2019 08:33:23 +0000 (08:33 +0000)
committerGerrit Code Review <gerrit@onap.org>
Sun, 1 Dec 2019 08:33:23 +0000 (08:33 +0000)
58 files changed:
kubernetes/appc/resources/config/appc/opt/onap/appc/bin/startODL.sh
kubernetes/appc/resources/config/appc/opt/onap/appc/data/properties/appc.properties
kubernetes/appc/values.yaml
kubernetes/common/common/templates/_storageClass.tpl [new file with mode: 0644]
kubernetes/common/mariadb-galera/.helmignore
kubernetes/common/mariadb-galera/templates/configmap.yaml
kubernetes/common/mariadb-galera/templates/pv.yaml
kubernetes/common/mariadb-galera/templates/statefulset.yaml
kubernetes/common/mariadb-galera/tests/pv_test.yaml [new file with mode: 0644]
kubernetes/common/mariadb-galera/tests/storage_class_test.yaml [new file with mode: 0644]
kubernetes/common/mariadb-galera/tests/values/persistence.yaml [new file with mode: 0644]
kubernetes/common/mariadb-galera/values.yaml
kubernetes/policy/charts/brmsgw/values.yaml
kubernetes/policy/charts/drools/charts/nexus/values.yaml
kubernetes/policy/charts/drools/resources/configmaps/base.conf
kubernetes/policy/charts/drools/templates/statefulset.yaml
kubernetes/policy/charts/drools/values.yaml
kubernetes/policy/charts/mariadb/Chart.yaml [deleted file]
kubernetes/policy/charts/mariadb/requirements.yaml [deleted file]
kubernetes/policy/charts/mariadb/templates/NOTES.txt [deleted file]
kubernetes/policy/charts/mariadb/templates/configmap.yaml [deleted file]
kubernetes/policy/charts/mariadb/templates/deployment.yaml [deleted file]
kubernetes/policy/charts/mariadb/templates/pv.yaml [deleted file]
kubernetes/policy/charts/mariadb/templates/pvc.yaml [deleted file]
kubernetes/policy/charts/mariadb/templates/service.yaml [deleted file]
kubernetes/policy/charts/mariadb/values.yaml [deleted file]
kubernetes/policy/charts/pdp/values.yaml
kubernetes/policy/charts/policy-api/resources/config/config.json
kubernetes/policy/charts/policy-api/templates/deployment.yaml
kubernetes/policy/charts/policy-common/resources/config/pe/base.conf
kubernetes/policy/charts/policy-common/resources/config/scripts/do-start.sh
kubernetes/policy/charts/policy-common/values.yaml
kubernetes/policy/charts/policy-pap/resources/config/config.json
kubernetes/policy/charts/policy-pap/templates/deployment.yaml
kubernetes/policy/charts/policy-xacml-pdp/resources/config/xacml.properties
kubernetes/policy/charts/policy-xacml-pdp/templates/deployment.yaml
kubernetes/policy/requirements.yaml
kubernetes/policy/resources/config/db.sh [moved from kubernetes/policy/charts/mariadb/resources/config/db.sh with 93% similarity]
kubernetes/policy/templates/configmap.yaml
kubernetes/policy/templates/deployment.yaml
kubernetes/policy/templates/job.yaml [new file with mode: 0644]
kubernetes/policy/templates/secrets.yaml [moved from kubernetes/policy/charts/mariadb/templates/secrets.yaml with 78% similarity]
kubernetes/policy/values.yaml
kubernetes/robot
kubernetes/vid/charts/vid-mariadb-galera/Chart.yaml [deleted file]
kubernetes/vid/charts/vid-mariadb-galera/templates/NOTES.txt [deleted file]
kubernetes/vid/charts/vid-mariadb-galera/templates/configmap.yaml [deleted file]
kubernetes/vid/charts/vid-mariadb-galera/templates/pv.yaml [deleted file]
kubernetes/vid/charts/vid-mariadb-galera/templates/pvc.yaml [deleted file]
kubernetes/vid/charts/vid-mariadb-galera/templates/secrets.yaml [deleted file]
kubernetes/vid/charts/vid-mariadb-galera/templates/service.yaml [deleted file]
kubernetes/vid/charts/vid-mariadb-galera/templates/statefulset.yaml [deleted file]
kubernetes/vid/charts/vid-mariadb-galera/values.yaml [deleted file]
kubernetes/vid/requirements.yaml
kubernetes/vid/templates/deployment.yaml
kubernetes/vid/templates/job.yaml
kubernetes/vid/templates/secrets.yaml
kubernetes/vid/values.yaml

index c52c6e3..22d3836 100755 (executable)
@@ -171,6 +171,9 @@ ln -s ${hostdir}/snapshots ${ODL_HOME}/snapshots
 echo "Starting cdt-proxy-service jar, logging to ${APPC_HOME}/cdt-proxy-service/jar.log"
 java -jar ${APPC_HOME}/cdt-proxy-service/cdt-proxy-service.jar > ${APPC_HOME}/cdt-proxy-service/jar.log &
 
+echo "Starting dmaap-event-service jar, logging to ${APPC_HOME}/dmaap-event-service/jar.log"
+java -jar -Dorg_onap_appc_bootstrap_path=/opt/onap/appc/data/properties -Dorg_onap_appc_bootstrap_file=appc.properties ${APPC_HOME}/dmaap-event-service/dmaap-event-service.jar > ${APPC_HOME}/dmaap-event-service/jar.log &
+
 echo "Adding a property system.properties for AAF cadi.properties location"
 echo "" >> ${ODL_HOME}/etc/system.properties
 echo "cadi_prop_files=${APPC_HOME}/data/properties/cadi.properties" >> ${ODL_HOME}/etc/system.properties
index 58593d9..914d608 100644 (file)
@@ -114,9 +114,9 @@ appc.sdc.provider.url=http://localhost:8181/restconf/operations/AsdcMessage:conf
 
 # Properties used by EventSenderDmaapImpl.java
 DCAE.dmaap.event.topic.write=EventSenderTest
-DCAE.dmaap.appc.username=test
-DCAE.dmaap.appc.password=test
-DCAE.dmaap.event.pool.members=message-router.{{.Release.Namespace}}:3904
+DCAE.dmaap.event.username=test
+DCAE.dmaap.event.password=test
+DCAE.dmaap.event.poolMembers=message-router.{{.Release.Namespace}}:3904
 
 #OAM Listener
 appc.OAM.disabled=true
@@ -130,3 +130,8 @@ appc.OAM.provider.user={{.Values.config.odlUser}}
 appc.OAM.provider.pass={{.Values.config.odlPassword}}
 
 appc.asdc.env={{.Values.config.dmaapTopicEnv}}
+
+#Properties for communication between appc dmaap microservice and appc
+appc.srvcomm.messaging.username={{.Values.config.dmaapServiceUser}}
+appc.srvcomm.messaging.password={{.Values.config.dmaapServicePassword}}
+appc.srvcomm.messaging.url={{.Values.config.dmaapServiceUrl}}
index 2312638..12defea 100644 (file)
@@ -65,6 +65,9 @@ config:
   openStackUserName: admin
   openStackEncryptedPassword: enc:LDEbHEAvTF1R
   odlUser: admin
+  dmaapServiceUrl: http://localhost:8080/publish
+  dmaapServiceUser: appc
+  dmaapServicePassword: onapappc
 
 appc-ansible-server:
   service:
diff --git a/kubernetes/common/common/templates/_storageClass.tpl b/kubernetes/common/common/templates/_storageClass.tpl
new file mode 100644 (file)
index 0000000..8fd1f97
--- /dev/null
@@ -0,0 +1,57 @@
+{{/*
+# Copyright © 2019 Amdocs, Bell Canada, Orange
+#
+# 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.
+*/}}
+
+{{/*
+  Expand the name of the storage class.
+  The value "common.fullname"-data is used by default,
+  unless either override mechanism is used.
+
+  - .Values.global.persistence.storageClass  : override default storageClass for all charts
+  - .Values.persistence.storageClassOverride : override global and default storage class on a per chart basis
+  - .Values.persistence.storageClass         : override default storage class on a per chart basis
+*/}}
+{{- define "common.storageClass" -}}
+  {{- if .Values.persistence.storageClassOverride -}}
+    {{- if ne "-" .Values.persistence.storageClassOverride -}}
+      {{- printf "%s" .Values.persistence.storageClassOverride -}}
+    {{- else -}}
+      {{- $storage_class := "" -}}
+      {{- printf "%q" $storage_class -}}
+    {{- end -}}
+  {{- else -}}
+    {{- if or .Values.persistence.storageClass .Values.global.persistence.storageClass }}
+      {{- if ne "-" (default .Values.persistence.storageClass .Values.global.persistence.storageClass) -}}
+        {{- printf "%s" (default .Values.persistence.storageClass .Values.global.persistence.storageClass) -}}
+      {{- else -}}
+        {{- $storage_class := "" -}}
+        {{- printf "%q" $storage_class -}}
+      {{- end -}}
+    {{- else -}}
+      {{- printf "%s-data" (include "common.fullname" .) -}}
+    {{- end -}}
+  {{- end -}}
+{{- end -}}
+
+{{/*
+  Calculate if we need a PV. If a storageClass is provided, then we don't need.
+*/}}
+{{- define "common.needPV" -}}
+{{- if or (or .Values.persistence.storageClassOverride .Values.persistence.storageClass) .Values.global.persistence.storageClass -}}
+  False
+{{- else -}}
+  True
+{{- end -}}
+{{- end -}}
index 9c9a248..ff6e119 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-apiVersion: v1
-kind: ConfigMap
-metadata:
-  name: {{ include "common.fullname" . }}-confd
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
-data:
-{{ tpl (.Files.Glob "resources/config/mariadb/conf.d/*").AsConfig . | indent 2 }}
----
 {{- if .Values.externalConfig }}
 apiVersion: v1
 kind: ConfigMap
@@ -39,4 +26,4 @@ metadata:
 data:
   my_extra.cnf: |
 {{ .Values.externalConfig | indent 4 }}
-{{- end -}}
\ No newline at end of file
+{{- end -}}
index a2096fd..96bd94e 100644 (file)
@@ -1,5 +1,5 @@
 {{/*
-# Copyright © 2017 Amdocs, Bell Canada
+# Copyright © 2019 Amdocs, Bell Canada, Orange
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # limitations under the License.
 */}}
 {{- $global := . }}
-{{- if and $global.Values.persistence.enabled (not $global.Values.persistence.existingClaim) -}}
-{{- range $i, $t := until (int $global.Values.replicaCount)}}
+{{- if and $global.Values.persistence.enabled (not $global.Values.persistence.existingClaim) }}
+{{- if eq "True" (include "common.needPV" .) -}}
+{{- range $i := until (int $global.Values.replicaCount)}}
 kind: PersistentVolume
 apiVersion: v1
 metadata:
-  name: {{ include "common.fullname" $global }}-data{{$i}}
+  name: {{ include "common.fullname" $global }}-data-{{$i}}
   namespace: {{ include "common.namespace" $global }}
   labels:
     app: {{ include "common.fullname" $global }}
@@ -35,7 +36,10 @@ spec:
   persistentVolumeReclaimPolicy: {{ $global.Values.persistence.volumeReclaimPolicy }}
   storageClassName: "{{ include "common.fullname" $global }}-data"
   hostPath:
-    path: {{ $global.Values.global.persistence.mountPath | default $global.Values.persistence.mountPath }}/{{ $global.Release.Name }}/{{ $global.Values.persistence.mountSubPath }}{{$i}}
+    path: {{ $global.Values.global.persistence.mountPath | default $global.Values.persistence.mountPath }}/{{ $global.Release.Name }}/{{ $global.Values.persistence.mountSubPath }}-{{$i}}
+{{if ne $i (int $global.Values.replicaCount) }}
 ---
 {{- end -}}
 {{- end -}}
+{{- end -}}
+{{- end -}}
index b0b7174..2e77036 100644 (file)
@@ -130,11 +130,8 @@ spec:
     spec:
       accessModes:
       - {{ .Values.persistence.accessMode | quote }}
-      storageClassName: {{ include "common.fullname" . }}-data
+      storageClassName: {{ include "common.storageClass" . }}
       resources:
         requests:
           storage: {{ .Values.persistence.size | quote }}
-      selector:
-        matchLabels:
-          name: {{ include "common.fullname" . }}
 {{- end }}
diff --git a/kubernetes/common/mariadb-galera/tests/pv_test.yaml b/kubernetes/common/mariadb-galera/tests/pv_test.yaml
new file mode 100644 (file)
index 0000000..cd40079
--- /dev/null
@@ -0,0 +1,35 @@
+---
+suite: test pv behavior
+templates:
+  - pv.yaml
+tests:
+  - it: 'should render "" (global case))'
+    values:
+      - ./values/persistence.yaml
+    set:
+      global.persistence.storageClass: "-"
+    asserts:
+      - isEmpty:
+
+  - it: 'should "" (override case)'
+    values:
+      - ./values/persistence.yaml
+    set:
+      global.persistence.storageClass: "global"
+      persistence.storageClassOverride: "-"
+    asserts:
+      - isEmpty:
+
+  - it: 'should "" (local case)'
+    values:
+      - ./values/persistence.yaml
+    set:
+      persistence.storageClass: "-"
+    asserts:
+      - isEmpty:
+
+  - it: 'should render "RELEASE-NAME-mariadb-galera-data" as storageClassname'
+    asserts:
+      - equal:
+          path: spec.storageClassName
+          value: "RELEASE-NAME-mariadb-galera-data"
diff --git a/kubernetes/common/mariadb-galera/tests/storage_class_test.yaml b/kubernetes/common/mariadb-galera/tests/storage_class_test.yaml
new file mode 100644 (file)
index 0000000..9b7bdcb
--- /dev/null
@@ -0,0 +1,67 @@
+---
+suite: test storage class behavior
+templates:
+  - statefulset.yaml
+tests:
+  - it: 'should render "" as storageClassname (global case)'
+    values:
+      - ./values/persistence.yaml
+    set:
+      global.persistence.storageClass: "-"
+    asserts:
+      - isEmpty:
+          path: spec.volumeClaimTemplates[0].spec.storageClassName
+
+  - it: 'should "" as storageClassname (override case)'
+    values:
+      - ./values/persistence.yaml
+    set:
+      global.persistence.storageClass: "global"
+      persistence.storageClassOverride: "-"
+    asserts:
+      - isEmpty:
+          path: spec.volumeClaimTemplates[0].spec.storageClassName
+
+  - it: 'should "" as storageClassname (local case)'
+    values:
+      - ./values/persistence.yaml
+    set:
+      persistence.storageClass: "-"
+    asserts:
+      - isEmpty:
+          path: spec.volumeClaimTemplates[0].spec.storageClassName
+
+  - it: 'should render "global" as storageClassname'
+    values:
+      - ./values/persistence.yaml
+    set:
+      global.persistence.storageClass: "global"
+    asserts:
+      - equal:
+          path: spec.volumeClaimTemplates[0].spec.storageClassName
+          value: "global"
+
+  - it: 'should render "local" as storageClassname'
+    values:
+      - ./values/persistence.yaml
+    asserts:
+      - equal:
+          path: spec.volumeClaimTemplates[0].spec.storageClassName
+          value: "local"
+
+  - it: 'should render "override" as storageClassname'
+    values:
+      - ./values/persistence.yaml
+    set:
+      global.persistence.storageClass: "global"
+      persistence.storageClassOverride: "override"
+    asserts:
+      - equal:
+          path: spec.volumeClaimTemplates[0].spec.storageClassName
+          value: "override"
+
+  - it: 'should render "RELEASE-NAME-mariadb-galera-data" as storageClassname'
+    asserts:
+      - equal:
+          path: spec.volumeClaimTemplates[0].spec.storageClassName
+          value: "RELEASE-NAME-mariadb-galera-data"
diff --git a/kubernetes/common/mariadb-galera/tests/values/persistence.yaml b/kubernetes/common/mariadb-galera/tests/values/persistence.yaml
new file mode 100644 (file)
index 0000000..a282f74
--- /dev/null
@@ -0,0 +1,6 @@
+---
+persistence:
+  enabled: true
+  existingClaim: false
+  size: 10Gb
+  storageClass: "local"
index a662b1e..14215e4 100644 (file)
@@ -35,7 +35,7 @@ global:
 #repository: mysql
 repository: nexus3.onap.org:10001
 image: adfinissygroup/k8s-mariadb-galera-centos:v002
-backupImage: library/mariadb:10.1.38 
+backupImage: library/mariadb:10.1.38
 imageInit: busybox
 pullPolicy: IfNotPresent
 
@@ -91,7 +91,7 @@ persistence:
   mountSubPath: "mariadb-galera/data"
   mysqlPath: /var/lib/mysql
   backup:
-    mountPath: /dockerdata-nfs/backup
+    mountPath: /dockerdata-nfs/backup{{- if or (or .Values.storageClassOverride .Values.persistence.storageClass) .Values.global.persistence.storageClass -}}
 
 service:
   internalPort: 3306
index ef817f0..03b3a3c 100644 (file)
@@ -19,7 +19,7 @@
 global:
   nodePortPrefix: 302
   readinessRepository: oomk8s
-  readinessImage: readiness-check:2.0.0
+  readinessImage: readiness-check:2.0.2
 
 #################################################################
 # Application configuration defaults.
index 2f80892..2024bca 100644 (file)
@@ -19,7 +19,7 @@
 global:
   nodePortPrefix: 302
   readinessRepository: oomk8s
-  readinessImage: readiness-check:2.0.0
+  readinessImage: readiness-check:2.0.2
   ubuntuInitRepository: oomk8s
   ubuntuInitImage: ubuntu-init:1.0.0
   persistence: {}
index 22c7d8d..0b982fd 100644 (file)
@@ -17,7 +17,7 @@
 
 JVM_OPTIONS={{.Values.server.jvmOpts}}
 
-# SYSTEM software configuration 
+# SYSTEM software configuration
 
 POLICY_HOME=/opt/app/policy
 POLICY_LOGS=/var/log/onap/policy/pdpd
@@ -35,9 +35,9 @@ SNAPSHOT_REPOSITORY_URL=http://{{.Values.global.nexus.nameOverride}}:{{.Values.n
 RELEASE_REPOSITORY_ID=policy-nexus-releases
 RELEASE_REPOSITORY_URL=http://{{.Values.global.nexus.nameOverride}}:{{.Values.nexus.port}}/nexus/content/repositories/releases/
 
-# Relational (SQL) DB access 
+# Relational (SQL) DB access
 
-SQL_HOST={{.Values.global.mariadb.nameOverride}}
+SQL_HOST={{ .Values.global.mariadb.service.name }}
 
 # AAF
 
index bb21ae1..9f9ca35 100644 (file)
@@ -40,7 +40,7 @@ spec:
         - /root/ready.py
         args:
         - --container-name
-        - {{ .Values.global.mariadb.nameOverride }}
+        - {{ .Release.Name }}-galera-config
         - --container-name
         - {{ .Values.global.nexus.nameOverride }}
         env:
index b2e8257..fbb4211 100644 (file)
@@ -19,7 +19,7 @@
 global:
   nodePortPrefix: 302
   readinessRepository: oomk8s
-  readinessImage: readiness-check:2.0.0
+  readinessImage: readiness-check:2.0.2
   loggingRepository: docker.elastic.co
   loggingImage: beats/filebeat:5.5.0
   ubuntuImage: ubuntu:16.04
diff --git a/kubernetes/policy/charts/mariadb/Chart.yaml b/kubernetes/policy/charts/mariadb/Chart.yaml
deleted file mode 100644 (file)
index 59bd592..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright © 2017 Amdocs, Bell Canada
-# Modifications Copyright © 2018 AT&T
-#
-# 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
-description: ONAP Policy MariaDB Service
-name: mariadb
-version: 5.0.0
diff --git a/kubernetes/policy/charts/mariadb/requirements.yaml b/kubernetes/policy/charts/mariadb/requirements.yaml
deleted file mode 100644 (file)
index 05d49a8..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright © 2017 Amdocs, Bell Canada
-# Modifications Copyright © 2018 AT&T
-#
-# 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.
-
-dependencies:
-  - name: common
-    version: ~5.x-0
-    # local reference to common chart, as it is
-    # a part of this chart's package and will not
-    # be published independently to a repo (at this point)
-    repository: '@local'
diff --git a/kubernetes/policy/charts/mariadb/templates/NOTES.txt b/kubernetes/policy/charts/mariadb/templates/NOTES.txt
deleted file mode 100644 (file)
index 5d0107e..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright 2018 AT&T, Amdocs, Bell Canada Intellectual Property. All rights reserved
-#
-# 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.
-
-1. Get the application URL by running these commands:
-{{- if .Values.ingress.enabled }}
-{{- range .Values.ingress.hosts }}
-  http://{{ . }}
-{{- end }}
-{{- else if contains "NodePort" .Values.service.type }}
-  export NODE_PORT=$(kubectl get --namespace {{ include "common.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "common.name" . }})
-  export NODE_IP=$(kubectl get nodes --namespace {{ include "common.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}")
-  echo http://$NODE_IP:$NODE_PORT
-{{- else if contains "LoadBalancer" .Values.service.type }}
-     NOTE: It may take a few minutes for the LoadBalancer IP to be available.
-           You can watch the status of by running 'kubectl get svc -w {{ include "common.name" . }}'
-  export SERVICE_IP=$(kubectl get svc --namespace {{ include "common.namespace" . }} {{ include "common.name" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
-  echo http://$SERVICE_IP:{{ .Values.service.externalPort }}
-{{- else if contains "ClusterIP" .Values.service.type }}
-  export POD_NAME=$(kubectl get pods --namespace {{ include "common.namespace" . }} -l "app={{ template "common.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
-  echo "Visit http://127.0.0.1:8080 to use your application"
-  kubectl port-forward $POD_NAME 8080:{{ .Values.service.internalPort }}
-{{- end }}
diff --git a/kubernetes/policy/charts/mariadb/templates/configmap.yaml b/kubernetes/policy/charts/mariadb/templates/configmap.yaml
deleted file mode 100644 (file)
index 87dc6d3..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright © 2017 Amdocs, Bell Canada
-# Modifications Copyright © 2018 AT&T
-#
-# 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: {{ include "common.fullname" . }}-configmap
-  namespace: {{ include "common.namespace" . }}
-data:
-{{ tpl (.Files.Glob "resources/config/db.sh").AsConfig . | indent 2 }}
diff --git a/kubernetes/policy/charts/mariadb/templates/deployment.yaml b/kubernetes/policy/charts/mariadb/templates/deployment.yaml
deleted file mode 100644 (file)
index c64fb9a..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-# Copyright © 2017 Amdocs, Bell Canada
-# Modifications Copyright © 2018 AT&T
-#
-# 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: extensions/v1beta1
-kind: Deployment
-metadata:
-  name: {{ include "common.fullname" . }}
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
-spec:
-  replicas: {{ .Values.replicaCount }}
-  template:
-    metadata:
-      labels:
-        app: {{ include "common.name" . }}
-        release: {{ .Release.Name }}
-    spec:
-      containers:
-        - name: {{ include "common.name" . }}
-          image: "{{ include "common.repository" . }}/{{ .Values.image }}"
-          imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-          ports:
-          - containerPort: {{ .Values.service.internalPort }}
-          # disable liveness probe when breakpoints set in debugger
-          # so K8s doesn't restart unresponsive container 
-          {{- if eq .Values.liveness.enabled true }}
-          args:
-          - --lower-case-table-names=1
-          - --wait_timeout=28800
-          livenessProbe:
-            tcpSocket:
-              port: {{ .Values.service.internalPort }}
-            initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
-            periodSeconds: {{ .Values.liveness.periodSeconds }}
-          {{ end -}}
-          readinessProbe:
-            tcpSocket:
-              port: {{ .Values.service.internalPort }}
-            initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
-            periodSeconds: {{ .Values.readiness.periodSeconds }}
-          env:
-          - name: MYSQL_ROOT_PASSWORD
-            valueFrom:
-              secretKeyRef:
-                name: {{ template "common.fullname" . }}-secret
-                key: db-root-password
-          - name: MYSQL_USER
-            value: policy_user
-          - name: MYSQL_PASSWORD
-            valueFrom:
-              secretKeyRef:
-                name: {{ template "common.fullname" . }}-secret
-                key: db-user-password
-          volumeMounts:
-          - mountPath: /etc/localtime
-            name: localtime
-            readOnly: true
-          - mountPath: /docker-entrypoint-initdb.d
-            name: mariadb-conf
-          - mountPath: /var/lib/mysql
-            name: mariadb-data
-          resources:
-{{ include "common.resources" . | indent 12 }}
-        {{- if .Values.nodeSelector }}
-        nodeSelector:
-{{ toYaml .Values.nodeSelector | indent 10 }}
-        {{- end -}}
-        {{- if .Values.affinity }}
-        affinity:
-{{ toYaml .Values.affinity | indent 10 }}
-        {{- end }}
-      volumes:
-        - name: localtime
-          hostPath:
-            path: /etc/localtime
-        - name: mariadb-conf
-          configMap:
-            name: {{ include "common.fullname" . }}-configmap
-            defaultMode: 0755
-        - name: mariadb-data
-        {{- if .Values.persistence.enabled }}
-          persistentVolumeClaim:
-            claimName: {{ include "common.fullname" . }}
-        {{- else }}
-          emptyDir: {}
-        {{- end }}
-      imagePullSecrets:
-      - name: "{{ include "common.namespace" . }}-docker-registry-key"
diff --git a/kubernetes/policy/charts/mariadb/templates/pv.yaml b/kubernetes/policy/charts/mariadb/templates/pv.yaml
deleted file mode 100644 (file)
index bf372b3..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-{{/*
-# Copyright © 2017 Amdocs, Bell Canada
-# Modifications Copyright © 2018 AT&T
-#
-# 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.
-*/}}
-
-{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
-kind: PersistentVolume
-apiVersion: v1
-metadata:
-  name: {{ include "common.fullname" . }}
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
-    release: "{{ .Release.Name }}"
-    heritage: "{{ .Release.Service }}"
-    name: {{ include "common.fullname" . }}
-spec:
-  capacity:
-    storage: {{ .Values.persistence.size }}
-  accessModes:
-    - {{ .Values.persistence.accessMode }}
-  persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }}
-  hostPath:
-    path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }}
-{{- end -}}
diff --git a/kubernetes/policy/charts/mariadb/templates/pvc.yaml b/kubernetes/policy/charts/mariadb/templates/pvc.yaml
deleted file mode 100644 (file)
index 1deed4e..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-{{/*
-# Copyright © 2017 Amdocs, Bell Canada
-# Modifications Copyright © 2018 AT&T
-#
-# 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.
-*/}}
-
-{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
-kind: PersistentVolumeClaim
-apiVersion: v1
-metadata:
-  name: {{ include "common.fullname" . }}
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
-    release: "{{ .Release.Name }}"
-    heritage: "{{ .Release.Service }}"
-{{- if .Values.persistence.annotations }}
-  annotations:
-{{ toYaml .Values.persistence.annotations | indent 4 }}
-{{- end }}
-spec:
-  selector:
-    matchLabels:
-      name: {{ include "common.fullname" . }}
-  accessModes:
-    - {{ .Values.persistence.accessMode }}
-  resources:
-    requests:
-      storage: {{ .Values.persistence.size }}
-{{- if .Values.persistence.storageClass }}
-{{- if (eq "-" .Values.persistence.storageClass) }}
-  storageClassName: ""
-{{- else }}
-  storageClassName: "{{ .Values.persistence.storageClass }}"
-{{- end }}
-{{- end }}
-{{- end -}}
diff --git a/kubernetes/policy/charts/mariadb/templates/service.yaml b/kubernetes/policy/charts/mariadb/templates/service.yaml
deleted file mode 100644 (file)
index 9d5d13a..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright © 2017 Amdocs, Bell Canada
-# Modifications Copyright © 2018-2019 AT&T
-#
-# 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: Service
-metadata:
-  name: {{ include "common.servicename" . }}
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
-spec:
-  ports:
-    - port: {{ .Values.service.externalPort }}
-      targetPort: {{ .Values.service.internalPort }}
-      name: {{ .Values.service.portName }}
-  selector:
-    app: {{ include "common.name" . }}
-    release: {{ .Release.Name }}
diff --git a/kubernetes/policy/charts/mariadb/values.yaml b/kubernetes/policy/charts/mariadb/values.yaml
deleted file mode 100644 (file)
index 9b7102d..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-# Copyright © 2017 Amdocs, Bell Canada
-# Modifications Copyright © 2018-2019 AT&T
-#
-# 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.
-
-#################################################################
-# Global configuration defaults.
-#################################################################
-global:
-  nodePortPrefix: 302
-  persistence: {}
-
-#################################################################
-# Application configuration defaults.
-#################################################################
-# application image
-repository: nexus3.onap.org:10001
-image: mariadb:10.2.25
-pullPolicy: Always
-
-# flag to enable debugging - application support required
-debugEnabled: false
-
-# application configuration
-# Example:
-config:
-  mysqlRootPassword: secret
-  mysqlUserName: policy_user
-  mysqlPassword: policy_user
-# default number of instances
-replicaCount: 1
-
-nodeSelector: {}
-
-affinity: {}
-
-# probe configuration parameters
-liveness:
-  initialDelaySeconds: 120
-  periodSeconds: 10
-  # necessary to disable liveness probe when setting breakpoints
-  # in debugger so K8s doesn't restart unresponsive container
-  enabled: true
-
-readiness:
-  initialDelaySeconds: 120
-  periodSeconds: 10
-
-## Persist data to a persitent volume
-persistence:
-  enabled: true
-  volumeReclaimPolicy: Retain
-  accessMode: ReadWriteOnce
-  size: 2Gi
-  mountPath: /dockerdata-nfs
-  mountSubPath: mariadb/data
-
-service:
-  type: ClusterIP
-  name: policydb
-  portName: policydb
-  externalPort: 3306
-  internalPort: 3306
-
-ingress:
-  enabled: false
-
-# Resource Limit flavor -By Default using small
-flavor: small
-# Segregation for Different environment (Small and Large)
-resources:
-  small:
-    limits:
-      cpu: 1
-      memory: 2Gi
-    requests:
-      cpu: 10m
-      memory: 0.5Gi
-  large:
-    limits:
-      cpu: 2
-      memory: 4Gi
-    requests:
-      cpu: 20m
-      memory: 1Gi
-  unlimited: {}
index 20f4614..af5bb9e 100644 (file)
@@ -19,7 +19,7 @@
 global:
   nodePortPrefix: 302
   readinessRepository: oomk8s
-  readinessImage: readiness-check:2.0.0
+  readinessImage: readiness-check:2.0.2
   loggingRepository: docker.elastic.co
   loggingImage: beats/filebeat:5.5.0
 
index 397f850..8952ae8 100644 (file)
@@ -29,9 +29,9 @@
         "name": "PolicyProviderParameterGroup",
         "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
         "databaseDriver": "org.mariadb.jdbc.Driver",
-        "databaseUrl": "jdbc:mariadb://{{.Values.global.mariadb.nameOverride}}:3306/policyadmin",
-        "databaseUser": "policy_user",
-        "databasePassword": "cG9saWN5X3VzZXI=",
+        "databaseUrl": "jdbc:mariadb://{{ .Values.global.mariadb.service.name }}:{{ .Values.global.mariadb.service.internalPort }}/policyadmin",
+        "databaseUser": "{{ .Values.global.mariadb.config.userName }}",
+        "databasePassword": "{{ .Values.global.mariadb.config.userPassword | b64enc }}",
         "persistenceUnit": "PolicyMariaDb"
     }
 }
index b79c6bf..505ba89 100644 (file)
@@ -21,7 +21,7 @@ spec:
           - /root/ready.py
           args:
           - --container-name
-          - {{ .Values.global.mariadb.nameOverride }}
+          - {{ .Release.Name }}-galera-config
           env:
           - name: NAMESPACE
             valueFrom:
index 44e754b..5711044 100644 (file)
@@ -19,10 +19,10 @@ KEYSTORE_PASSWD=Pol1cy_0nap
 TRUSTSTORE_PASSWD=Pol1cy_0nap
 
 JDBC_DRIVER=org.mariadb.jdbc.Driver
-JDBC_URL=jdbc:mariadb://{{ .Values.global.mariadb.nameOverride }}:{{.Values.config.mariadbPort}}/onap_sdk?connectTimeout=30000&socketTimeout=60000&log=true&sessionVariables=max_statement_time=30
-JDBC_LOG_URL=jdbc:mariadb://{{ .Values.global.mariadb.nameOverride }}:{{.Values.config.mariadbPort}}/log?connectTimeout=30000&socketTimeout=60000&log=true&sessionVariables=max_statement_time=30
-JDBC_USER=policy_user
-JDBC_PASSWORD=policy_user
+JDBC_URL=jdbc:mariadb://{{ .Values.global.mariadb.service.name }}:{{ .Values.global.mariadb.service.internalPort }}/onap_sdk?connectTimeout=30000&socketTimeout=60000&log=true&sessionVariables=max_statement_time=30
+JDBC_LOG_URL=jdbc:mariadb://{{ .Values.global.mariadb.service.name }}:{{ .Values.global.mariadb.service.internalPort }}/log?connectTimeout=30000&socketTimeout=60000&log=true&sessionVariables=max_statement_time=30
+JDBC_USER={{ .Values.global.mariadb.config.userName }}
+JDBC_PASSWORD={{ .Values.global.mariadb.config.userPassword }}
 
 site_name=site_1
 fp_monitor_interval=30
index fc27782..052b6f2 100644 (file)
@@ -42,7 +42,7 @@ if [[ -f /opt/app/policy/etc/build.info ]]; then
        echo "Found existing installation, will not reinstall"
        . /opt/app/policy/etc/profile.d/env.sh
 
-else 
+else
        if [[ -d config ]]; then
                cp config/*.conf .
        fi
@@ -80,7 +80,7 @@ else
                # (which does nothing if the db is already up-to-date)
                dbuser=$(echo $(grep '^JDBC_USER=' base.conf | cut -f2 -d=))
                dbpw=$(echo $(grep '^JDBC_PASSWORD=' base.conf | cut -f2 -d=))
-               db_upgrade_remote.sh $dbuser $dbpw {{.Values.global.mariadb.nameOverride}}
+               db_upgrade_remote.sh $dbuser $dbpw {{.Values.global.mariadb.service.name}}
        fi
 
 fi
index a098560..57eacc5 100644 (file)
@@ -19,7 +19,7 @@
 global:
   nodePortPrefix: 302
   readinessRepository: oomk8s
-  readinessImage: readiness-check:2.0.0
+  readinessImage: readiness-check:2.0.2
   loggingRepository: docker.elastic.co
   loggingImage: beats/filebeat:5.5.0
 
@@ -30,7 +30,6 @@ debugEnabled: false
 config:
   logstashServiceName: log-ls
   logstashPort: 5044
-  mariadbPort: 3306
 
 # default number of instances
 replicaCount: 1
index a665c07..48065ae 100644 (file)
@@ -40,9 +40,9 @@
         "name": "PolicyProviderParameterGroup",
         "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
         "databaseDriver": "org.mariadb.jdbc.Driver",
-        "databaseUrl": "jdbc:mariadb://{{.Values.global.mariadb.nameOverride}}:3306/policyadmin",
-        "databaseUser": "policy_user",
-        "databasePassword": "cG9saWN5X3VzZXI=",
+        "databaseUrl": "jdbc:mariadb://{{ .Values.global.mariadb.service.name }}:{{ .Values.global.mariadb.service.internalPort }}/{{ .Values.global.mariadb.config.mysqlDatabase }}",
+        "databaseUser": "{{ .Values.global.mariadb.config.userName }}",
+        "databasePassword": "{{ .Values.global.mariadb.config.userPassword | b64enc }}",
         "persistenceUnit": "PolicyMariaDb"
     },
     "topicParameterGroup": {
index 3332f60..a3adfee 100644 (file)
@@ -21,7 +21,7 @@ spec:
         - /root/ready.py
         args:
         - --container-name
-        - {{ .Values.global.mariadb.nameOverride }}
+        - {{ .Values.global.mariadb.service.name }}
         env:
         - name: NAMESPACE
           valueFrom:
index be9a3fa..29feeb6 100644 (file)
@@ -48,6 +48,6 @@ xacml.pip.engines=count-recent-operations,get-operation-outcome
 # JPA Properties
 #
 javax.persistence.jdbc.driver=org.mariadb.jdbc.Driver
-javax.persistence.jdbc.url=jdbc:mariadb://{{ .Values.global.mariadb.nameOverride }}:3306/operationshistory
-javax.persistence.jdbc.user=policy_user
-javax.persistence.jdbc.password=cG9saWN5X3VzZXI=
+javax.persistence.jdbc.url=jdbc:mariadb://{{ .Values.global.mariadb.service.name }}:{{ .Values.global.mariadb.service.internalPort }}/operationshistory
+javax.persistence.jdbc.user={{ .Values.global.mariadb.config.userName }}
+javax.persistence.jdbc.password={{ .Values.global.mariadb.config.userPassword | b64enc }}
index da9b019..ced19b9 100644 (file)
@@ -21,7 +21,7 @@ spec:
         - /root/ready.py
         args:
         - --container-name
-        - {{ .Values.global.mariadb.nameOverride }}
+        - {{ .Release.Name }}-galera-config
         env:
         - name: NAMESPACE
           valueFrom:
index 05d49a8..589dfa4 100644 (file)
@@ -20,3 +20,6 @@ dependencies:
     # a part of this chart's package and will not
     # be published independently to a repo (at this point)
     repository: '@local'
+  - name: mariadb-galera
+    version: ~5.x-0
+    repository: '@local'
@@ -14,7 +14,7 @@
 # limitations under the License.
 
 #!/bin/bash -xv
-
+mysql() { /usr/bin/mysql  -h ${MYSQL_HOST} -P ${MYSQL_USER} "$@"; };
 for db in support onap_sdk log migration operationshistory10 pooling policyadmin operationshistory
 do
        mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "CREATE DATABASE IF NOT EXISTS ${db};"
index bd1af39..8c804c3 100644 (file)
@@ -36,4 +36,11 @@ metadata:
   namespace: {{ include "common.namespace" . }}
 data:
 {{ tpl (.Files.Glob "resources/config/pe/*").AsConfig . | indent 2 }}
-
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ include "common.fullname" . }}-db-configmap
+  namespace: {{ include "common.namespace" . }}
+data:
+{{ tpl (.Files.Glob "resources/config/db.sh").AsConfig . | indent 2 }}
index 5feb374..355b8fc 100644 (file)
@@ -36,7 +36,7 @@ spec:
         - /root/ready.py
         args:
         - --container-name
-        - {{ .Values.global.mariadb.nameOverride }}
+        - {{ .Release.Name }}-galera-config
         env:
         - name: NAMESPACE
           valueFrom:
diff --git a/kubernetes/policy/templates/job.yaml b/kubernetes/policy/templates/job.yaml
new file mode 100644 (file)
index 0000000..9ed09e8
--- /dev/null
@@ -0,0 +1,77 @@
+# Copyright © 2018 Amdocs, Bell Canada
+#
+# 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: batch/v1
+kind: Job
+metadata:
+  name: {{ .Release.Name }}-galera-config
+  namespace: {{ include "common.namespace" . }}
+  labels:
+    app: {{ include "common.name" . }}-job
+    release: {{ .Release.Name }}
+spec:
+  template:
+    metadata:
+      labels:
+        app: {{ include "common.name" . }}-job
+        release: {{ .Release.Name }}
+    spec:
+      initContainers:
+#This container checks that all galera instances are up before initializing it.
+      - name: {{ include "common.name" . }}-readiness
+        image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
+        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+        command:
+        - /root/ready.py
+        - --container-name
+        - {{ index .Values "mariadb-galera" "service" "name" }}
+        env:
+        - name: NAMESPACE
+          valueFrom:
+            fieldRef:
+              apiVersion: v1
+              fieldPath: metadata.namespace
+      containers:
+      - name: {{ .Release.Name }}-galera-config
+        image: {{ .Values.mariadb_image }}
+        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+        volumeMounts:
+        - mountPath: /dbcmd-config/db.sh
+          name: {{ include "common.fullname" . }}-config
+          subPath: db.sh
+        command:
+        - /bin/sh
+        args:
+        - -x
+        - /dbcmd-config/db.sh
+        env:
+        - name: MYSQL_ROOT_PASSWORD
+          valueFrom:
+            secretKeyRef:
+              name: {{ template "common.fullname" . }}-secret
+              key: db-root-password
+        - name: MYSQL_HOST
+          value: "{{ index .Values "mariadb-galera" "service" "name" }}"
+        - name: MYSQL_USER
+          value: "{{ index .Values "mariadb-galera" "config" "userName" }}"
+        - name: MYSQL_PORT
+          value: "{{ index .Values "mariadb-galera" "service" "internalPort" }}"
+      restartPolicy: Never
+      volumes:
+        - name: {{ include "common.fullname" . }}-config
+          configMap:
+            name: {{ include "common.fullname" . }}-db-configmap
+            items:
+              - key: db.sh
+                path: db.sh
@@ -1,5 +1,5 @@
 # Copyright © 2017 Amdocs, Bell Canada
-# Modifications Copyright © 2018 AT&T
+# Modifications Copyright © 2018 AT&T, Orange
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -25,6 +25,5 @@ metadata:
     heritage: {{ .Release.Service }}
 type: Opaque
 data:
-  db-root-password: {{ .Values.config.mysqlRootPassword | b64enc | quote }}
-  db-user-password: {{ .Values.config.mysqlPassword | b64enc | quote }}
-
+  db-user-password: {{ index .Values "mariadb-galera" "config" "userPassword" | b64enc | quote }}
+  db-root-password: {{ index .Values "mariadb-galera" "config" "mariadbRootPassword" | b64enc | quote }}
index 3648647..ef0e6b1 100644 (file)
 global:
   nodePortPrefix: 302
   readinessRepository: oomk8s
-  readinessImage: readiness-check:2.0.0
+  readinessImage: readiness-check:2.0.2
   loggingRepository: docker.elastic.co
   loggingImage: beats/filebeat:5.5.0
   ubuntuImage: ubuntu:16.04
-  mariadb:
-    nameOverride: policydb
   pdp:
     nameOverride: pdp
   pap:
-    nameOverride: pap
+    nameOverride: policy
   drools:
     nameOverride: drools
   brmwgw:
     nameOverride: brmsgw
   nexus:
     nameOverride: nexus
+  mariadb:
+    # '&mariadbConfig' means we "store" the values for  later use in the file
+    # with '*mariadbConfig' pointer.
+    config: &mariadbConfig
+      userName: policy_user
+      userPassword: policy_user
+      mariadbRootPassword: secret
+      mysqlDatabase: policyadmin
+    service: &mariadbService
+      name: policy-mariadb
+      portName: mysql-policy
+      internalPort: 3306
 
 #################################################################
 # Application configuration defaults.
@@ -42,17 +52,16 @@ global:
 # application image
 repository: nexus3.onap.org:10001
 image: onap/policy-pe:1.5.2
+mariadb_image: library/mariadb:10
 pullPolicy: Always
 
 subChartsOnly:
   enabled: true
 
-nameOverride: pap
-
+pap:
+  nameOverride: pap
 pdp:
   nameOverride: pdp
-mariadb:
-  nameOverride: policydb
 drools:
   nameOverride: drools
 brmwgw:
@@ -101,6 +110,17 @@ service:
 ingress:
   enabled: false
 
+mariadb-galera:
+  # mariadb-galera.config and global.mariadb.config must be equals
+  config: *mariadbConfig
+  nameOverride: policy-mariadb
+  # mariadb-galera.service and global.mariadb.service must be equals
+  service: *mariadbService
+  replicaCount: 1
+  persistence:
+    enabled: true
+    mountSubPath: policy/maria/data
+
 # Resource Limit flavor -By Default using small
 flavor: small
 # Segregation for Different environment (Small and Large)
index 31450dc..6e38b49 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 31450dcb11d18b81098b43d0d0b7ecdb0d69e238
+Subproject commit 6e38b492acd3ec44a869055092399b6f18c659b8
diff --git a/kubernetes/vid/charts/vid-mariadb-galera/Chart.yaml b/kubernetes/vid/charts/vid-mariadb-galera/Chart.yaml
deleted file mode 100644 (file)
index 0419147..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright © 2018 Amdocs, Bell Canada
-#
-# 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
-description: ONAP VID MariaDB Galera cluster
-name: vid_mariadb_galera
-version: 5.0.0
-keywords:
-  - mariadb
-  - mysql
-  - database
-  - sql
-  - galera
-  - cluster
\ No newline at end of file
diff --git a/kubernetes/vid/charts/vid-mariadb-galera/templates/NOTES.txt b/kubernetes/vid/charts/vid-mariadb-galera/templates/NOTES.txt
deleted file mode 100644 (file)
index c44fa89..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright © 2018 Amdocs, Bell Canada
-#
-# 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.
-
-MariaDB-Galera service can be accessed via port 3306 on the following DNS name from within your cluster:
-{{ include "common.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local
-
-To connect to your database:
-
-1. Run a pod that you can use as a client:
-
-    kubectl run {{ include "common.fullname" . }}-client --rm --tty -i --image mariadb --command -- bash
-
-2. Connect using the mysql cli, then provide your password:
-    $ mysql -h {{ include "common.fullname" . }} {{- if .Values.mysqlRootPassword }} -p {{ .Values.mysqlRootPassword }}{{- end -}}
-
diff --git a/kubernetes/vid/charts/vid-mariadb-galera/templates/configmap.yaml b/kubernetes/vid/charts/vid-mariadb-galera/templates/configmap.yaml
deleted file mode 100644 (file)
index ba6adc0..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright © 2018 Amdocs, Bell Canada
-#
-# 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: {{ include "common.fullname" . }}-confd
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
-data:
-{{ tpl (.Files.Glob "resources/config/mariadb/conf.d/*").AsConfig . | indent 2 }}
----
-{{- if .Values.externalConfig }}
-apiVersion: v1
-kind: ConfigMap
-metadata:
-  name: {{ include "common.fullname" . }}-externalconfig
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
-data:
-  my_extra.cnf: |-
-   [mysqld]
-   lower_case_table_names = 1
-
-#{{ toYaml .Values.externalConfig | indent 4 }}
-#{{- end -}}
diff --git a/kubernetes/vid/charts/vid-mariadb-galera/templates/pv.yaml b/kubernetes/vid/charts/vid-mariadb-galera/templates/pv.yaml
deleted file mode 100644 (file)
index f682196..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-{{/*
-# Copyright © 2017 Amdocs, Bell Canada
-#
-# 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.
-*/}}
-
-{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
-kind: PersistentVolume
-apiVersion: v1
-metadata:
-  name: {{ include "common.fullname" . }}
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
-    release: "{{ .Release.Name }}"
-    heritage: "{{ .Release.Service }}"
-    name: {{ include "common.fullname" . }}
-spec:
-  capacity:
-    storage: {{ .Values.persistence.size}}
-  accessModes:
-    - {{ .Values.persistence.accessMode }}
-  persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }}
-  hostPath:
-    path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }}
-{{- end -}}
diff --git a/kubernetes/vid/charts/vid-mariadb-galera/templates/pvc.yaml b/kubernetes/vid/charts/vid-mariadb-galera/templates/pvc.yaml
deleted file mode 100644 (file)
index c3de6e8..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-{{/*
-# Copyright © 2017 Amdocs, Bell Canada
-#
-# 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.
-*/}}
-
-{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
-kind: PersistentVolumeClaim
-apiVersion: v1
-metadata:
-  name: {{ include "common.fullname" . }}
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
-    release: "{{ .Release.Name }}"
-    heritage: "{{ .Release.Service }}"
-{{- if .Values.persistence.annotations }}
-  annotations:
-{{ toYaml .Values.persistence.annotations | indent 4 }}
-{{- end }}
-spec:
-  selector:
-    matchLabels:
-      name: {{ include "common.fullname" . }}
-  accessModes:
-    - {{ .Values.persistence.accessMode }}
-  resources:
-    requests:
-      storage: {{ .Values.persistence.size }}
-{{- if .Values.persistence.storageClass }}
-{{- if (eq "-" .Values.persistence.storageClass) }}
-  storageClassName: ""
-{{- else }}
-  storageClassName: "{{ .Values.persistence.storageClass }}"
-{{- end }}
-{{- end }}
-{{- end -}}
diff --git a/kubernetes/vid/charts/vid-mariadb-galera/templates/secrets.yaml b/kubernetes/vid/charts/vid-mariadb-galera/templates/secrets.yaml
deleted file mode 100644 (file)
index 233158f..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright © 2018 Amdocs, Bell Canada
-#
-# 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: Secret
-metadata:
-  name: {{ include "common.fullname" . }}
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
-    release: "{{ .Release.Name }}"
-    heritage: "{{ .Release.Service }}"
-type: Opaque
-data:
-  db-root-password: {{ .Values.config.mariadbRootPassword | b64enc | quote }}
-  user-password: {{ default "" .Values.config.userPassword | b64enc | quote }}
\ No newline at end of file
diff --git a/kubernetes/vid/charts/vid-mariadb-galera/templates/service.yaml b/kubernetes/vid/charts/vid-mariadb-galera/templates/service.yaml
deleted file mode 100644 (file)
index ae11a26..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright © 2018 Amdocs, Bell Canada
-#
-# 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: Service
-metadata:
-  annotations:
-    service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
-#  name: {{ include "common.servicename" . }}
-  name: {{ .Values.service.name }}
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.fullname" . }}
-    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
-    release: "{{ .Release.Name }}"
-    heritage: "{{ .Release.Service }}"
-spec:
-  ports:
-    - name: {{ .Values.service.portName }}
-      port: {{ .Values.service.internalPort }}
-  clusterIP: None
-  selector:
-    app: {{ include "common.fullname" . }}
diff --git a/kubernetes/vid/charts/vid-mariadb-galera/templates/statefulset.yaml b/kubernetes/vid/charts/vid-mariadb-galera/templates/statefulset.yaml
deleted file mode 100644 (file)
index e90b156..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-# Copyright © 2018 Amdocs, Bell Canada
-#
-# 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: apps/v1beta1
-kind: StatefulSet
-metadata:
-  name: {{ include "common.fullname" . }}
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.fullname" . }}
-    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
-    release: "{{ .Release.Name }}"
-    heritage: "{{ .Release.Service }}"
-spec:
-#  serviceName: {{ include "common.fullname" . }}
-  serviceName: {{ .Values.service.name }}
-  replicas: {{ .Values.replicaCount }}
-  template:
-    metadata:
-      labels:
-        app: {{ include "common.fullname" . }}
-        release: {{ .Release.Name }}
-      annotations:
-        pod.alpha.kubernetes.io/initialized: "true"
-    spec:
-    {{- if .Values.nodeSelector }}
-      nodeSelector:
-{{ toYaml .Values.nodeSelector | indent 8 }}
-    {{- end }}
-      volumes:
-      {{- if .Values.externalConfig }}
-        - name: config
-          configMap:
-            name: {{ include "common.fullname" . }}-externalconfig
-      {{- end}}
-        - name: localtime
-          hostPath:
-            path: /etc/localtime
-      imagePullSecrets:
-      - name: {{ include "common.namespace" . }}-docker-registry-key
-      containers:
-        - name: {{ include "common.fullname" . }}
-          image: "{{ include "common.repository" . }}/{{ .Values.image }}"
-          imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy | quote}}
-          env:
-            - name: POD_NAMESPACE
-              valueFrom:
-                fieldRef:
-                  apiVersion: v1
-                  fieldPath: metadata.namespace
-            - name: MYSQL_USER
-              value: {{ default "" .Values.config.userName | quote }}
-            - name: MYSQL_PASSWORD
-              valueFrom:
-                secretKeyRef:
-                  name: {{ template "common.fullname" . }}
-                  key: user-password
-            - name: MYSQL_DATABASE
-              value: {{ default "" .Values.config.mysqlDatabase | quote }}
-            - name: MYSQL_ROOT_PASSWORD
-              valueFrom:
-                secretKeyRef:
-                  name: {{ template "common.fullname" . }}
-                  key: db-root-password
-          ports:
-          - containerPort: {{ .Values.service.internalPort }}
-            name: {{ .Values.service.name }}
-          - containerPort: {{ .Values.service.sstPort }}
-            name: {{ .Values.service.sstName }}
-          - containerPort: {{ .Values.service.replicationPort }}
-            name: {{ .Values.service.replicationName }}
-          - containerPort: {{ .Values.service.istPort }}
-            name: {{ .Values.service.istName }}
-          readinessProbe:
-            exec:
-              command:
-              - /usr/share/container-scripts/mysql/readiness-probe.sh
-            initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
-            periodSeconds: {{ .Values.readiness.periodSeconds }}
-      {{- if eq .Values.liveness.enabled true }}
-          livenessProbe:
-            exec:
-              command: ["mysqladmin", "ping"]
-            initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
-            periodSeconds: {{ .Values.liveness.periodSeconds }}
-            timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
-      {{- end }}
-          resources:
-{{ include "common.resources" . | indent 12 }}
-          volumeMounts:
-        {{- if .Values.externalConfig }}
-          - mountPath: /etc/config
-            name: config
-        {{- end}}
-          - mountPath: /etc/localtime
-            name: localtime
-            readOnly: true
-{{- if .Values.persistence.enabled }}
-          - mountPath: /var/lib/mysql
-            name: {{ include "common.fullname" . }}-data
-            subPath: data
-      initContainers:
-        - name: mariadb-galera-prepare
-          image: "{{ include "common.repository" . }}/{{ .Values.imageInit }}"
-          command: ["sh", "-c", "chown -R 27:27 /var/lib/mysql"]
-          volumeMounts:
-            - name: {{ include "common.fullname" . }}-data
-              mountPath: /var/lib/mysql
-  volumeClaimTemplates:
-  - metadata:
-      name: {{ include "common.fullname" . }}-data
-      labels:
-        name: {{ include "common.fullname" . }}
-      annotations:
-  {{- if .Values.persistence.storageClass }}
-        volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }}
-  {{- else }}
-        volume.alpha.kubernetes.io/storage-class: default
-  {{- end }}
-    spec:
-      accessModes:
-      - {{ .Values.persistence.accessMode | quote }}
-      resources:
-        requests:
-          storage: {{ .Values.persistence.size | quote }}
-      selector:
-        matchLabels:
-          name: {{ include "common.fullname" . }}
-{{- end }}
diff --git a/kubernetes/vid/charts/vid-mariadb-galera/values.yaml b/kubernetes/vid/charts/vid-mariadb-galera/values.yaml
deleted file mode 100644 (file)
index e0da745..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-# Copyright © 2018 Amdocs, Bell Canada
-#
-# 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.
-
-#################################################################
-# Global configuration defaults.
-#################################################################
-global:
-  nodePortPrefix: 302
-  persistence: {}
-  repository: nexus3.onap.org:10001
-
-
-#################################################################
-# Application configuration defaults.
-#################################################################
-
-#repository: mysql
-repository: nexus3.onap.org:10001
-image: adfinissygroup/k8s-mariadb-galera-centos:v004
-imageInit: busybox
-pullPolicy: IfNotPresent
-
-# application configuration
-config:
-  mariadbRootPassword: secretpassword
-#  userName: my-user
-#  userPassword: my-password
-#  mysqlDatabase: my-database
-  userName: vidadmin
-  userPassword: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U
-  mysqlDatabase: vid_openecomp_epsdk
-
-
-# default number of instances in the StatefulSet
-replicaCount: 2
-
-nodeSelector: {}
-
-affinity: {}
-
-# probe configuration parameters
-liveness:
-  initialDelaySeconds: 30
-  periodSeconds: 10
-  timeoutSeconds: 5
-  # necessary to disable liveness probe when setting breakpoints
-  # in debugger so K8s doesn't restart unresponsive container
-  enabled: false
-
-readiness:
-  initialDelaySeconds: 15
-  periodSeconds: 10
-
-## Persist data to a persitent volume
-persistence:
-  enabled: false
-
-  ## A manually managed Persistent Volume and Claim
-  ## Requires persistence.enabled: true
-  ## If defined, PVC must be created manually before volume will be bound
-  # existingClaim:
-  volumeReclaimPolicy: Retain
-
-  ## database data Persistent Volume Storage Class
-  ## If defined, storageClassName: <storageClass>
-  ## If set to "-", storageClassName: "", which disables dynamic provisioning
-  ## If undefined (the default) or set to null, no storageClassName spec is
-  ##   set, choosing the default provisioner.  (gp2 on AWS, standard on
-  ##   GKE, AWS & OpenStack)
-  ##
-  # storageClass: "-"
-  accessMode: ReadWriteOnce
-  size: 2Gi
-
-
-service:
-  internalPort: 3306
-  name: vid-galera
-  portName: vid-galera
-  sstPort: 4444
-  sstName: sst
-  replicationPort: 4567
-  replicationName: replication
-  istPort: 4568
-  istName: ist
-
-ingress:
-  enabled: false
-
-
-## Configure MariaDB-Galera with a custom my.cnf file
-## ref: https://mariadb.com/kb/en/mariadb/configuring-mariadb-with-mycnf/#example-of-configuration-file
-##
-#externalConfig: {}
-externalConfig: |-
-  lower_case_table_names = 1
-# Resource Limit flavor -By Default using small
-flavor: small
-# Segregation for Different environment (Small and Large)
-resources:
-  small:
-    limits:
-      cpu: 10m
-      memory: 1Gi
-    requests:
-      cpu: 10m
-      memory: 500Mi
-  large:
-    limits:
-      cpu: 20m
-      memory: 2Gi
-    requests:
-      cpu: 20m
-      memory: 1Gi
-  unlimited: {}
-# Name for mariadb-galera cluster - should be unique accross all projects or other clusters
-nameOverride: vid-mariadb-galera
-
-# DNS name for mariadb-galera cluster - should be unique accross all projects other clusters
-#dnsnameOverride: mariadb-galera
index 6a748be..6e5fe9d 100644 (file)
@@ -19,3 +19,6 @@ dependencies:
     # a part of this chart's package and will not
     # be published independently to a repo (at this point)
     repository: '@local'
+  - name: mariadb-galera
+    version: ~5.x-0
+    repository: '@local'
index 9221af7..2c6c5fa 100644 (file)
@@ -101,15 +101,18 @@ spec:
             - name: VID_UEB_URL_LIST
               value: message-router.{{ include "common.namespace" . }}
             - name: VID_MYSQL_HOST
-              value: "{{ .Values.config.vidmysqlhost }}"
+              value: {{ index .Values "mariadb-galera" "service" "name" }}
             - name: VID_MYSQL_PORT
-              value: "{{ .Values.config.vidmysqlport }}"
+              value: "{{ index .Values "mariadb-galera" "service" "internalPort" }}"
             - name: VID_MYSQL_DBNAME
-              value: "{{ .Values.config.vidmysqldbname }}"
+              value: {{ index .Values "mariadb-galera" "config" "mysqlDatabase" }}
             - name: VID_MYSQL_USER
-              value: "{{ .Values.config.vidmysqluser }}"
+              value: {{ index .Values "mariadb-galera" "config" "userName" }}
             - name: VID_MYSQL_PASS
-              value: "{{ .Values.config.vidmysqlpassword }}"
+              valueFrom:
+                secretKeyRef:
+                  name: {{ template "common.fullname" . }}-db
+                  key: db-user-password
               #valueFrom:
               #  secretKeyRef: {name: {{ include "common.fullname" . }}, key: vid-password}
             - name: VID_MYSQL_MAXCONNECTIONS
@@ -166,4 +169,3 @@ spec:
             name: {{ include "common.fullname" . }}-log-configmap
       imagePullSecrets:
       - name: "{{ include "common.namespace" . }}-docker-registry-key"
-
index 5214e71..c2a1858 100644 (file)
@@ -34,11 +34,8 @@ spec:
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         command:
         - /root/ready.py
-{{- $fullname := include "common.fullname" . -}}
-{{- range $i,$t := until (int .Values.vid_mariadb_galera.replicaCount)}}
         - --container-name
-        - {{ $fullname }}-mariadb-galera-{{$i}}
-{{- end }}
+        - {{ index .Values "mariadb-galera" "service" "name" }}
         env:
         - name: NAMESPACE
           valueFrom:
@@ -63,13 +60,16 @@ spec:
         - /dbcmd-config/db_cmd.sh
         env:
         - name: MYSQL_PASSWORD
-          value: "{{ .Values.config.vidmysqlpassword }}"
+          valueFrom:
+            secretKeyRef:
+              name: {{ template "common.fullname" . }}-db
+              key: db-user-password
         - name: MYSQL_HOST
-          value: "{{ .Values.config.vidmysqlhost }}"
+          value: {{ index .Values "mariadb-galera" "service" "name" }}
         - name: MYSQL_USER
-          value: "{{ .Values.config.vidmysqluser }}"
+          value: {{ index .Values "mariadb-galera" "config" "userName" }}
         - name: MYSQL_PORT
-          value: "{{ .Values.config.vidmysqlport }}"
+          value: "{{ index .Values "mariadb-galera" "service" "internalPort" }}"
       restartPolicy: Never
       volumes:
         - name: {{ include "common.fullname" . }}-config
@@ -80,4 +80,3 @@ spec:
                 path: db_cmd.sh
               - key: vid-pre-init.sql
                 path: vid-pre-init.sql
-
index 222a3d5..e0c1992 100644 (file)
@@ -39,3 +39,18 @@ metadata:
 type: Opaque
 data:
 {{ tpl (.Files.Glob "resources/certs/*").AsSecrets . | indent 2 }}
+---
+apiVersion: v1
+kind: Secret
+metadata:
+  name: {{ include "common.fullname" . }}-db
+  namespace: {{ include "common.namespace" . }}
+  labels:
+    app: {{ include "common.name" . }}
+    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+    release: "{{ .Release.Name }}"
+    heritage: "{{ .Release.Service }}"
+type: Opaque
+data:
+  db-user-password: {{ index .Values "mariadb-galera" "config" "userPassword" | b64enc | quote }}
+  db-root-password: {{ index .Values "mariadb-galera" "config" "mariadbRootPassword" | b64enc | quote }}
index 6100277..f20e58f 100644 (file)
@@ -18,7 +18,7 @@
 global:
   nodePortPrefix: 302
   readinessRepository: oomk8s
-  readinessImage: readiness-check:2.0.1
+  readinessImage: readiness-check:2.0.2
   loggingRepository: docker.elastic.co
   loggingImage: beats/filebeat:5.5.0
 
@@ -47,19 +47,28 @@ config:
   vidmsopass: OBF:1ih71i271vny1yf41ymf1ylz1yf21vn41hzj1icz
   msodme2serverurl: http://localhost:8081
   vidcontactuslink: https://todo_contact_us_link.com
-  vidmysqlhost: vid-galera
-  vidmysqlport: "3306"
-  vidmysqldbname: vid_openecomp_epsdk
-  vidmysqluser: vidadmin
   vidmysqlmaxconnections: "5"
   logstashServiceName: log-ls
   logstashPort: 5044
   roleaccesscentralized: remote
 
-# subchart configuration
-vid_mariadb_galera:
-#  nameOverride: vid-mariadb-galera
-  replicaCount: 1
+mariadb-galera:
+  config:
+    userName: vidadmin
+    userPassword: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U
+    mariadbRootPassword: kjgsdhjqhawxvnbpoiawsfgjsqhsgjhjhdqihhjqdvcbxkjchizpw
+    mysqlDatabase: vid_openecomp_epsdk
+  nameOverride: vid-galera
+  service:
+    name: vid-galera
+    portName: mysql-vid
+    internalPort: "3306"
+  replicaCount: 3
+  persistence:
+    enabled: true
+    mountSubPath: vid/maria/data
+  externalConfig: |-
+    lower_case_table_names = 1
 
 # default number of instances
 replicaCount: 1