From: ssum21 Date: Mon, 30 Sep 2024 17:25:07 +0000 (+0900) Subject: Enhance logging install_kserve.sh X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=2d967c92fd323fbe7efc44b89dc894d1adb59905;p=aiml-fw%2Faimlfw-dep.git Enhance logging install_kserve.sh Change-Id: I2fdf0ed52480a668af61c2ea6c8b996cdc67ae67 Signed-off-by: ssum21 Enhance logging install_kserve.sh [StatefulSet] Update log readability for function to wait for Kubernetes StatefulSets Issue-ID: AIMLFW-103 Change-Id: I2b94f4261024a7c7f8edbdf46625f2f883d835bb Signed-off-by: ssum21 --- diff --git a/bin/install_kserve.sh b/bin/install_kserve.sh index 94bfdce..920a1e7 100755 --- a/bin/install_kserve.sh +++ b/bin/install_kserve.sh @@ -56,9 +56,9 @@ wait_for_deployment() { log_message "INFO" "Kubernetes" "All pods for deployment $1 are now running" } -function wait_for_statefulset() { - echo -n "waiting for $1 statefulset to run" - +# Function to wait for Kubernetes StatefulSets +wait_for_statefulset() { + log_message "INFO" "Kubernetes" "Waiting for statefulset $1 in namespace $2" STILL_WAITING=true while $STILL_WAITING; do STILL_WAITING=false @@ -69,24 +69,26 @@ function wait_for_statefulset() { if [ $DESIRED_STATE -ne $CURRENT_STATE ]; then STILL_WAITING=true sleep 1 - echo -n "." + log_message "INFO" "Kubernetes" "Statefulset $1 not fully ready. Retrying..." fi done done - - echo + log_message "INFO" "Kubernetes" "Statefulset $1 is now running" } ########## Install Cert Manager ########## +log_message "INFO" "Cert-Manager" "Checking Cert Manager installation..." IS_CERT_INSTALLED=$(kubectl get crd certificaterequests.cert-manager.io 2>&1 | grep "Error from server (NotFound)" | wc -l) if [ "$IS_CERT_INSTALLED" -eq 1 ]; then + log_message "INFO" "Cert-Manager" "Installing Cert Manager" kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/${CERT_MANAGER_VERSION}/cert-manager.yaml CERT_MANAGER_DEPLOYMENTS="cert-manager-cainjector cert-manager-webhook cert-manager" for CERT_MANAGER_DEPLOYMENT in $CERT_MANAGER_DEPLOYMENTS; do wait_for_deployment $CERT_MANAGER_DEPLOYMENT "cert-manager" done + log_message "INFO" "Cert-Manager" "Cert Manager installation completed" else - echo "skip cert-manager install" + log_message "INFO" "Cert-Manager" "Cert Manager already installed, skipping installation" fi # temp dir