From: aravind.est Date: Thu, 24 Apr 2025 22:43:47 +0000 (+0100) Subject: Fix Mariadb startup issue X-Git-Tag: l-release~26 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=f7c0d1cef6848d57caa51ede04a74a0c6672c421;p=it%2Fdep.git Fix Mariadb startup issue 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 --- diff --git a/smo-install/helm-override/default/onap-override.yaml b/smo-install/helm-override/default/onap-override.yaml index 40f22f3f..4b88c444 100644 --- a/smo-install/helm-override/default/onap-override.yaml +++ b/smo-install/helm-override/default/onap-override.yaml @@ -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: diff --git a/smo-install/scripts/layer-2/2-install-oran.sh b/smo-install/scripts/layer-2/2-install-oran.sh index 4a84b038..c996720d 100755 --- a/smo-install/scripts/layer-2/2-install-oran.sh +++ b/smo-install/scripts/layer-2/2-install-oran.sh @@ -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 index 00000000..6345c64a --- /dev/null +++ b/smo-install/scripts/packages/pre-configuration/mariadb-galera-pv.yaml @@ -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 index 00000000..27a77bf9 --- /dev/null +++ b/smo-install/scripts/sub-scripts/preconfigure-smo.sh @@ -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}}' + + + + + + + diff --git a/smo-install/scripts/sub-scripts/uninstall-onap.sh b/smo-install/scripts/sub-scripts/uninstall-onap.sh index 32ccb791..424dd4ca 100755 --- a/smo-install/scripts/sub-scripts/uninstall-onap.sh +++ b/smo-install/scripts/sub-scripts/uninstall-onap.sh @@ -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