Handle kong pv based on default storage class 10/14510/1
authoraravind.est <aravindhan.a@est.tech>
Thu, 29 May 2025 16:33:13 +0000 (17:33 +0100)
committeraravind.est <aravindhan.a@est.tech>
Thu, 29 May 2025 16:33:13 +0000 (17:33 +0100)
Kong PV enable flag should be configured based on the default storage class in the k8s cluster.
This handles the flag based on the result during the installation time.

Issue-ID: NONRTRIC-1020
Change-Id: I993f75bf3c6f43a47eff65bc2175baf51726df34
Signed-off-by: aravind.est <aravindhan.a@est.tech>
smo-install/helm-override/default/oran-override.yaml
smo-install/scripts/sub-scripts/install-nonrtric.sh

index 760a9e3..0cbc8c9 100644 (file)
@@ -91,6 +91,7 @@ kong:
     # This enables/disables the PV creation for kong
     # PV creation is necessary when there is no default storage class
     # This should be set to false when there is a default storage class, Which lets the PVC provisions the PV dynamically.
+    # In SMO installation, this is handled as part of smo-install/scripts/sub-scripts/install-nonrtric.sh script
     enabled: true
 
 controlpanel:
index 73ab9ba..1f18916 100755 (executable)
@@ -35,9 +35,17 @@ fi
 
 MODE=$2
 
+defaultSc=$(kubectl get storageclass -o jsonpath='{.items[?(@.metadata.annotations.storageclass\.kubernetes\.io/is-default-class=="true")].metadata.name}')
+kongPvEnabled=true
+if [ -n "$defaultSc" ]; then
+    echo "Default storage is set to : $defaultSc. Setting kong.kongpv.enable to false"
+    kongPvEnabled=false
+fi
+
+
 if [ "$MODE" == "dev" ]; then
     echo "Installing NONRTRIC in dev mode"
-    helm install --debug oran-nonrtric local/nonrtric --namespace nonrtric -f $OVERRIDEYAML --set nonrtric.persistence.mountPath="/dockerdata-nfs/deployment-$3"
+    helm install --debug oran-nonrtric local/nonrtric --namespace nonrtric -f $OVERRIDEYAML --set nonrtric.persistence.mountPath="/dockerdata-nfs/deployment-$3" --set kong.kongpv.enable=$kongPvEnabled
 else
     echo "Installing NONRTRIC in release mode"
     # This following should be modified once the charts are uploaded and available in the nexus repository
@@ -45,7 +53,7 @@ else
         # helm repo add nonrtric https://nexus3.o-ran-sc.org/repository/smo-helm-snapshots/
         # helm repo update
         # helm install oran-nonrtric nonrtric/nonrtric --namespace nonrtric -f $OVERRIDEYAML --create-namespace
-    helm install oran-nonrtric local/nonrtric --namespace nonrtric -f $OVERRIDEYAML --set nonrtric.persistence.mountPath="/dockerdata-nfs/deployment-$3"
+    helm install oran-nonrtric local/nonrtric --namespace nonrtric -f $OVERRIDEYAML --set nonrtric.persistence.mountPath="/dockerdata-nfs/deployment-$3" --set kong.kongpv.enable=$kongPvEnabled
 fi