Fix Mariadb startup issue 42/14342/2
authoraravind.est <aravindhan.a@est.tech>
Thu, 24 Apr 2025 22:43:47 +0000 (23:43 +0100)
committeraravind.est <aravindhan.a@est.tech>
Thu, 24 Apr 2025 23:12:44 +0000 (00:12 +0100)
Mariadb Galera failed with the startup as the volume access is denied.
All ONAP components using mariadb with the operators.
Mariadb operator configuration added
Mariadb-PV created with necessary permissions.

Issue-ID: NONRTRIC-1020
Change-Id: If9f0014b64c0a844c5328704841400b3d24496c4
Signed-off-by: aravind.est <aravindhan.a@est.tech>
smo-install/helm-override/default/onap-override.yaml
smo-install/scripts/layer-2/2-install-oran.sh
smo-install/scripts/packages/pre-configuration/mariadb-galera-pv.yaml [new file with mode: 0644]
smo-install/scripts/sub-scripts/preconfigure-smo.sh [new file with mode: 0644]
smo-install/scripts/sub-scripts/uninstall-onap.sh

index 40f22f3..4b88c44 100644 (file)
@@ -54,8 +54,8 @@ global:
   debugEnabled: false
 
   mariadbGalera:
-    useOperator: false
-    enableServiceAccount: true
+    useOperator: true
+    enableServiceAccount: false
 
 #################################################################
 # Enable/disable and configure helm charts (ie. applications)
@@ -145,6 +145,11 @@ dcaegen2-services:
 mariadb-galera:
   enabled: true
   replicaCount: 1
+  mariadbOperator:
+    persistence:
+      storageClassName: mariadb-galera-sc
+    galera:
+      enabled: false
 policy:
   enabled: true
   policy-api:
index 4a84b03..c996720 100755 (executable)
@@ -44,6 +44,10 @@ fi
 
 timestamp=$(date +%s)
 
+echo "Pre configuring SMO ..."
+../sub-scripts/preconfigure-smo.sh ../../helm-override/$FLAVOUR/oran-override.yaml $MODE $timestamp
+echo "SMO pre configuration done."
+
 echo "Starting ONAP & NONRTRIC namespaces ..."
 ../sub-scripts/install-onap.sh ../../helm-override/$FLAVOUR/onap-override.yaml $MODE $timestamp
 ../sub-scripts/install-nonrtric.sh ../../helm-override/$FLAVOUR/oran-override.yaml $MODE $timestamp
diff --git a/smo-install/scripts/packages/pre-configuration/mariadb-galera-pv.yaml b/smo-install/scripts/packages/pre-configuration/mariadb-galera-pv.yaml
new file mode 100644 (file)
index 0000000..6345c64
--- /dev/null
@@ -0,0 +1,31 @@
+################################################################################
+#   Copyright (c) 2021-2023 Nordix Foundation.                                 #
+#   Copyright (C) 2023-2025 OpenInfra Foundation Europe                        #
+#                                                                              #
+#   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.                                             #
+################################################################################
+
+kind: PersistentVolume
+apiVersion: v1
+metadata:
+  name: mariadb-galera-pv
+spec:
+  capacity:
+    storage: 3Gi
+  accessModes:
+    - ReadWriteOnce
+    - ReadWriteMany
+  persistentVolumeReclaimPolicy: Retain
+  hostPath:
+    path: /dockerdata-nfs/onap/mariadb
+  storageClassName: mariadb-galera-sc
diff --git a/smo-install/scripts/sub-scripts/preconfigure-smo.sh b/smo-install/scripts/sub-scripts/preconfigure-smo.sh
new file mode 100644 (file)
index 0000000..27a77bf
--- /dev/null
@@ -0,0 +1,54 @@
+#!/bin/bash
+# ============LICENSE_START=======================================================
+# Copyright (C) 2025 OpenInfra Foundation Europe. 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.
+# ============LICENSE_END============================================
+#
+
+# This needs to be done on all nodes in case of multi-node setup
+sudo mkdir -p /dockerdata-nfs/onap
+sudo mkdir -p /dockerdata-nfs/onap/mariadb
+sudo mkdir -p /dockerdata-nfs/onap/elastic-master-0
+sudo chmod -R 777 /dockerdata-nfs
+
+# Mariadb operator installation
+kubectl create ns mariadb-operator
+helm repo add mariadb-operator https://helm.mariadb.com/mariadb-operator
+helm repo update
+helm install mariadb-operator-crds mariadb-operator/mariadb-operator-crds
+helm install mariadb-operator mariadb-operator/mariadb-operator
+kubectl wait deployment mariadb-operator -n mariadb-operator --for=condition=available --timeout=120s
+
+# K8s Volume creation as required
+kubectl apply -f ../packages/pre-configuration/mariadb-galera-pv.yaml
+
+# Modify the volume permission as required
+# kubectl apply -f ../packages/pre-configuration/volume-permission-init.yaml
+
+# #Wait for volume permission init job to complete
+# kubectl wait job.batch/volume-permission-init --for condition=complete --timeout 300s
+
+# #Delete the job and pvc
+# kubectl delete job volume-permission-init
+# kubectl delete pvc mariadb-galera-pvc
+
+# #Patch the PV to be available for next use
+# kubectl patch pv mariadb-galera-pv -p '{"spec":{"claimRef": null}}'
+
+
+
+
+
+
+
index 32ccb79..424dd4c 100755 (executable)
@@ -28,4 +28,5 @@
 kubectl delete kafkatopics --all -n onap
 kubectl delete namespace onap
 kubectl delete namespace strimzi-system
+kubectl delete ns mariadb-operator
 kubectl get pv | grep Released | awk '$1 {print$1}' | while read vol; do kubectl delete pv/${vol}; done