Add warning message when the default storage class is not set 61/13361/1 master
authoraravind.est <aravindhan.a@est.tech>
Tue, 17 Sep 2024 16:21:59 +0000 (17:21 +0100)
committeraravind.est <aravindhan.a@est.tech>
Wed, 18 Sep 2024 08:51:58 +0000 (09:51 +0100)
Warning message added when the default storage class is not set.
This prevents the kong installation as the dependent postgres expects the PV to be available.

Issue-ID: NONRTRIC-1030
Change-Id: Ia11d7ab261095a875acec3fb690632a2f1f4e25a
Signed-off-by: aravind.est <aravindhan.a@est.tech>
bin/deploy-nonrtric
nonrtric/helm/kongstorage/kongvalues.yaml

index 6e5f74f..6ce07a5 100755 (executable)
@@ -165,6 +165,17 @@ fi
 echo "Install Kong- $INSTALL_KONG"
 
 if [ "$INSTALL_KONG" = true ];then
+  DEFAULT_SC=$(kubectl get sc -o jsonpath='{.items[?(@.metadata.annotations.storageclass\.kubernetes\.io/is-default-class=="true")].metadata.name}')
+  if [ -z "$DEFAULT_SC" ];then
+    echo "----------------------------------- WARNING!!! -------------------------------------------------------"
+    echo "Default storage class is not set."
+    echo "Kong PV and PVC creation may fail if it unable to create/use a storage class."
+    echo "Storage class for the kong installation can be specified in nonrtric/helm/kongstorage/kongvalues.yaml"
+    echo "------------------------------------------------------------------------------------------------------"
+  else
+    echo "Default storage class is set to $DEFAULT_SC"
+  fi
+
   echo "Install kongstorage through helm"
   helm install kongstorage -n "${NONRTRIC_NAMESPACE:-nonrtric}" ${HELM_NAME_OPT}  "$ROOT_DIR/../nonrtric/helm/kongstorage"
 
index 350cb03..c6fff53 100644 (file)
@@ -121,6 +121,10 @@ postgresql:
   primary:
     persistence:
       existingClaim: kongpvc
+      # If the default storage class is not set,
+      # This value should be set to create the PV
+      # storageClass: standard
+
 # -----------------------------------------------------------------------------
 # Miscellaneous parameters
 # -----------------------------------------------------------------------------