From a9251ab7088f3e6ffe165247d9bf4fb23fe158e4 Mon Sep 17 00:00:00 2001 From: "aravind.est" Date: Thu, 29 May 2025 17:33:13 +0100 Subject: [PATCH] Handle kong pv based on default storage class 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 --- smo-install/helm-override/default/oran-override.yaml | 1 + smo-install/scripts/sub-scripts/install-nonrtric.sh | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/smo-install/helm-override/default/oran-override.yaml b/smo-install/helm-override/default/oran-override.yaml index 760a9e33..0cbc8c97 100644 --- a/smo-install/helm-override/default/oran-override.yaml +++ b/smo-install/helm-override/default/oran-override.yaml @@ -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: diff --git a/smo-install/scripts/sub-scripts/install-nonrtric.sh b/smo-install/scripts/sub-scripts/install-nonrtric.sh index 73ab9bac..1f189166 100755 --- a/smo-install/scripts/sub-scripts/install-nonrtric.sh +++ b/smo-install/scripts/sub-scripts/install-nonrtric.sh @@ -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 -- 2.16.6