From 0cb1d50317e008a84975634e59c1d26a52db92c7 Mon Sep 17 00:00:00 2001 From: "aravind.est" Date: Fri, 13 Jun 2025 17:16:05 +0100 Subject: [PATCH] Add openebs for dynamic volume provisioning Default volume provisioners doesn't provide proper permission for the volumes. Hence there is an permission based issues in some containers. Openebs provisioner able to handle the permissions properly during the volume provisioning. Issue-ID: INT-170 Change-Id: Ifa1d284a8c39bc6fb3e73c30cccffdc30555928b Signed-off-by: aravind.est --- .../helm-override/default/onap-override.yaml | 3 +- .../helm-override/default/oran-override.yaml | 8 +-- smo-install/oran_oom/nonrtric/templates/pv3.yaml | 36 ------------- .../{mariadb-galera-pv.yaml => smo-sc.yaml} | 29 +++++----- .../scripts/sub-scripts/install-nonrtric.sh | 3 ++ .../scripts/sub-scripts/preconfigure-smo.sh | 62 +++------------------- 6 files changed, 29 insertions(+), 112 deletions(-) delete mode 100644 smo-install/oran_oom/nonrtric/templates/pv3.yaml rename smo-install/scripts/packages/pre-configuration/{mariadb-galera-pv.yaml => smo-sc.yaml} (73%) diff --git a/smo-install/helm-override/default/onap-override.yaml b/smo-install/helm-override/default/onap-override.yaml index 790bf03f..1e0e038e 100644 --- a/smo-install/helm-override/default/onap-override.yaml +++ b/smo-install/helm-override/default/onap-override.yaml @@ -52,6 +52,7 @@ global: # referenced by persistent volumes and log files persistence: mountPath: /dockerdata-nfs + storageClass: &smo-sc smo-storage # flag to enable debugging - application support required debugEnabled: false @@ -153,7 +154,7 @@ mariadb-galera: mariadbOperator: appVersion: 11.1.2 persistence: - storageClassName: mariadb-galera-sc + storageClassName: *smo-sc galera: enabled: false postgres: diff --git a/smo-install/helm-override/default/oran-override.yaml b/smo-install/helm-override/default/oran-override.yaml index 0cbc8c97..939e66b5 100644 --- a/smo-install/helm-override/default/oran-override.yaml +++ b/smo-install/helm-override/default/oran-override.yaml @@ -47,11 +47,11 @@ nonrtric: volume1: # Set the size to 0 if you do not need the volume (if you are using Dynamic Volume Provisioning) size: 2Gi - storageClassName: pms-storage + storageClassName: &smo-sc smo-storage volume2: # Set the size to 0 if you do not need the volume (if you are using Dynamic Volume Provisioning) size: 2Gi - storageClassName: ics-storage + storageClassName: *smo-sc # List of secrets to be copied from ONAP namespace to NONRTRIC # Based on the dependsOn value, the secrets will be copied to the SMO namespace secrets: @@ -67,7 +67,7 @@ informationservice: # Either refer to a volume created under the nonrtric by storageClassName. Then the claimed size should be the same. # The alternative use a dynamic volume provisioner in the cluster. Storage class can then be for instance 'standard' or 'gluster-fs' (depeneds on which classes that are available) size: 2Gi - storageClassName: ics-storage + storageClassName: *smo-sc ingress: enabled: true @@ -78,7 +78,7 @@ policymanagementservice: # Either refer to a volume created under the nonrtric by storageClassName. Then the claimed size should be the same. # The alternative use a dynamic volume provisioner in the cluster. Storage class can then be fon instance 'standard' or 'gluster-fs' (depeneds on which classes that are available) size: 2Gi - storageClassName: pms-storage + storageClassName: *smo-sc ingress: enabled: true diff --git a/smo-install/oran_oom/nonrtric/templates/pv3.yaml b/smo-install/oran_oom/nonrtric/templates/pv3.yaml deleted file mode 100644 index c29edd3b..00000000 --- a/smo-install/oran_oom/nonrtric/templates/pv3.yaml +++ /dev/null @@ -1,36 +0,0 @@ -############################################################################### -# Copyright (c) 2021 Nordix 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. # -################################################################################ - -{{- if .Values.nonrtric.volume3.size }} - -kind: PersistentVolume -apiVersion: v1 -metadata: - name: nonrtric-pv3 - namespace: {{ include "common.namespace" . }} -spec: - capacity: - storage: {{ .Values.nonrtric.volume3.size }} - accessModes: - - ReadWriteOnce - - ReadWriteMany - persistentVolumeReclaimPolicy: Retain - hostPath: - path: {{ .Values.nonrtric.persistence.mountPath }}/nonrtric/volume3 - storageClassName: {{ .Values.nonrtric.volume3.storageClassName }} - -{{- end }} - diff --git a/smo-install/scripts/packages/pre-configuration/mariadb-galera-pv.yaml b/smo-install/scripts/packages/pre-configuration/smo-sc.yaml similarity index 73% rename from smo-install/scripts/packages/pre-configuration/mariadb-galera-pv.yaml rename to smo-install/scripts/packages/pre-configuration/smo-sc.yaml index 6345c64a..1b3faf76 100644 --- a/smo-install/scripts/packages/pre-configuration/mariadb-galera-pv.yaml +++ b/smo-install/scripts/packages/pre-configuration/smo-sc.yaml @@ -1,6 +1,5 @@ ################################################################################ -# Copyright (c) 2021-2023 Nordix Foundation. # -# Copyright (C) 2023-2025 OpenInfra Foundation Europe # +# Copyright (C) 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. # @@ -15,17 +14,17 @@ # limitations under the License. # ################################################################################ -kind: PersistentVolume -apiVersion: v1 +apiVersion: storage.k8s.io/v1 +kind: StorageClass metadata: - name: mariadb-galera-pv -spec: - capacity: - storage: 3Gi - accessModes: - - ReadWriteOnce - - ReadWriteMany - persistentVolumeReclaimPolicy: Retain - hostPath: - path: /dockerdata-nfs/onap/mariadb - storageClassName: mariadb-galera-sc + annotations: + cas.openebs.io/config: | + - name: StorageType + value: "hostpath" + - name: BasePath + value: "/dockerdata/smo" + openebs.io/cas-type: local + name: smo-storage +provisioner: openebs.io/local +reclaimPolicy: Delete +volumeBindingMode: WaitForFirstConsumer diff --git a/smo-install/scripts/sub-scripts/install-nonrtric.sh b/smo-install/scripts/sub-scripts/install-nonrtric.sh index 7526b30d..6b4fa93d 100755 --- a/smo-install/scripts/sub-scripts/install-nonrtric.sh +++ b/smo-install/scripts/sub-scripts/install-nonrtric.sh @@ -92,3 +92,6 @@ else kubectl get secret $secret -n onap -o json | jq 'del(.metadata["namespace","creationTimestamp","resourceVersion","selfLink","uid","ownerReferences"])' | kubectl apply -n nonrtric -f - done fi + +# Wait for the Kong deployment to be ready +kubectl wait --for=condition=available deployment/oran-nonrtric-kong -n nonrtric \ No newline at end of file diff --git a/smo-install/scripts/sub-scripts/preconfigure-smo.sh b/smo-install/scripts/sub-scripts/preconfigure-smo.sh index 290df43c..326faf21 100755 --- a/smo-install/scripts/sub-scripts/preconfigure-smo.sh +++ b/smo-install/scripts/sub-scripts/preconfigure-smo.sh @@ -16,52 +16,13 @@ # ============LICENSE_END============================================ # -# Check whether k8s is multinode or not and provide warning -if [ $(kubectl get nodes --no-headers | wc -l) -gt 1 ]; then - echo "----------------------------------- WARNING!!! -------------------------------------------" - echo "This is a multi-node cluster." - echo "----------------------------------- Node Details -----------------------------------------" - kubectl get nodes - echo "-------------------------------------------------------------------------------------------" - echo "This installation uses /dockerdata-nfs as a volume mount point." - echo "Each application creates its own sub-directory under /dockerdata-nfs." - echo "-------------------------------------------------------------------------------------------" - echo "If there is any previous installation, please ensure that the /dockerdata-nfs directory is empty." - echo "Leaving any previous data in this directory may cause issues with the new installation." - echo "-------------------------------------------------------------------------------------------" - echo "The file permission of the sub-directory should be set to 777. " - echo "Setting the permission to 777 is required for the application to work properly." - echo "Hence, the following command should be run on all nodes in the cluster." - echo "-------------------------------------------------------------------------------------------" - echo "sudo mkdir -p /dockerdata-nfs/onap" - echo "sudo mkdir -p /dockerdata-nfs/onap/mariadb" - echo "sudo mkdir -p /dockerdata-nfs/onap/elastic-master-0" - echo "sudo mkdir -p /dockerdata-nfs/onap/cps-temporal/data" - echo "sudo mkdir -p /dockerdata-nfs/onap/strimzi-kafka/kafka-0" - echo "sudo mkdir -p /dockerdata-nfs/onap/strimzi-kafka/zk-0" - echo "sudo mkdir -p /dockerdata-nfs/onap/strimzi-kafka/controller-0" - echo "sudo mkdir -p /dockerdata-nfs/onap/strimzi-kafka/broker-0" - echo "sudo chmod -R 777 /dockerdata-nfs" - echo "-------------------------------------------------------------------------------------------" -else - echo "This is a single-node cluster." - echo "The installation will proceed with the assumption that /dockerdata-nfs is available on this node." - echo "------------------------------------- WARNING!!! -------------------------------------------" - echo "If there is any previous installation, please ensure that the /dockerdata-nfs directory is empty." - echo "Leaving any previous data in this directory may cause issues with the new installation." - echo "-------------------------------------------------------------------------------------------" -fi +# OpenEBS installation +helm repo add openebs https://openebs.github.io/openebs +helm repo update +helm upgrade --install openebs --namespace openebs openebs/openebs --version 4.3.0 --create-namespace --set engines.replicated.mayastor.enabled=false --set engines.local.lvm.enabled=false --set engines.local.zfs.enabled=false --set loki.enabled=false --set alloy.enabled=false --wait -# 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 mkdir -p /dockerdata-nfs/onap/cps-temporal/data -sudo mkdir -p /dockerdata-nfs/onap/strimzi-kafka/kafka-0 -sudo mkdir -p /dockerdata-nfs/onap/strimzi-kafka/zk-0 -sudo mkdir -p /dockerdata-nfs/onap/strimzi-kafka/controller-0 -sudo mkdir -p /dockerdata-nfs/onap/strimzi-kafka/broker-0 -sudo chmod -R 777 /dockerdata-nfs +# Create storage class for smo +kubectl apply -f ../packages/pre-configuration/smo-sc.yaml # Mariadb operator installation kubectl create ns mariadb-operator @@ -70,14 +31,3 @@ helm repo update helm install mariadb-operator-crds mariadb-operator/mariadb-operator-crds -n mariadb-operator helm install mariadb-operator mariadb-operator/mariadb-operator -n 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 - - - - - - - - -- 2.16.6