Add Script for KServe Runtime Installation 63/13363/2
authorhyuksun98 <gurtjs0116@khu.ac.kr>
Wed, 18 Sep 2024 13:22:03 +0000 (13:22 +0000)
committerHyuk Sun Kwon <gurtjs0116@khu.ac.kr>
Wed, 18 Sep 2024 14:11:52 +0000 (14:11 +0000)
Issue-ID: AIMLFW-129

- Update KServe installation script(align with KServe version)
- Implement Kserve-runtime installation script for InferenceService in AIMLFW
- Update KServe uninstallation script and identify issues in the existing script regarding knative(align with KServe version)

Change-Id: Iac5b3259444414f6c36d08fd8e3fd173d83f3c21
Signed-off-by: hyuksun98 <gurtjs0116@khu.ac.kr>
bin/install_kserve.sh
bin/uninstall_kserve.sh

index f6b1d8e..0e756c3 100755 (executable)
@@ -162,13 +162,26 @@ function rpt() {
 rpt
 kubectl delete -f "${DIR}/../tools/kserve/cert-manager-test.yaml"
 
-IS_KSERVE_INSTALLED=$(kubectl get crd inferenceservices.serving.kserve.io 2>&1 | grep "Error from server (NotFound)" | wc -l)
-if [ "$IS_KSERVE_INSTALLED" -eq 1 ]; then
+########## Install Kserve & Kserve Runtimes ##########
+IS_KSERVE_INSTALLED=$(kubectl get crd inferenceservices.serving.kserve.io --ignore-not-found)
+if [ -z "$IS_KSERVE_INSTALLED" ]; then
     kubectl apply -f https://raw.githubusercontent.com/kserve/kserve/master/install/${KSERVE_VERSION}/kserve.yaml
-    KSERVE_STATEFULSETS="kserve-controller-manager"
-    for KSERVE_STATEFULSET in $KSERVE_STATEFULSETS; do
-        wait_for_statefulset $KSERVE_STATEFULSET "kserve-system"
+    KSERVE_DEPLOYMENTS="kserve-controller-manager"
+    for KSERVE_DEPLOYMENT in $KSERVE_DEPLOYMENTS; do
+        wait_for_deployment $KSERVE_DEPLOYMENT "kserve"
     done
+
+    # Wait for KServe Webhook to be ready by checking kserve-controller-manager logs
+    echo "Waiting for KServe Webhook to be ready..."
+    kubectl wait --for=condition=available --timeout=120s deployment/kserve-controller-manager -n kserve
 else
-    echo "skip kserve install"
+    echo "KServe already exist, skipping installation"
 fi
+
+RUNTIMES_INSTALLED=$(kubectl get clusterservingruntimes.serving.kserve.io --ignore-not-found)
+if [ -z "$RUNTIMES_INSTALLED" ]; then
+    echo "Installing KServe runtimes"
+    kubectl apply -f https://raw.githubusercontent.com/kserve/kserve/master/install/${KSERVE_VERSION}/kserve-runtimes.yaml
+else
+    echo "KServe runtimes already exist, skipping installation"
+fi
\ No newline at end of file
index de666c9..6b78952 100755 (executable)
@@ -41,11 +41,12 @@ function wait_for_pods_terminate() {
     echo
 }
 
-########## Uninstall Kserve ##########
+########## Uninstall Kserve & Kserve Runtimes ##########
+kubectl delete --timeout=10s -f https://raw.githubusercontent.com/kserve/kserve/master/install/${KSERVE_VERSION}/kserve-runtimes.yaml
 kubectl delete --timeout=10s -f https://raw.githubusercontent.com/kserve/kserve/master/install/${KSERVE_VERSION}/kserve.yaml
-KSERVE_STATEFULSETS="kserve-controller-manager"
-for KSERVE_STATEFULSET in $KSERVE_STATEFULSETS; do
-    wait_for_pods_terminate $KSERVE_STATEFULSET "kserve-system"
+KSERVE_DEPLOYMENTS="kserve-controller-manager"
+for KSERVE_DEPLOYMENT in $KSERVE_DEPLOYMENTS; do
+    wait_for_pods_terminate $KSERVE_DEPLOYMENT "kserve"
 done
 
 ########## Uninstall Cert Manager ##########
@@ -63,6 +64,8 @@ for KNATIVE_DEPLOYMENT in $KNATIVE_DEPLOYMENTS; do
 done
 
 set +e
+# TODO: Review and resolve errors from deleting overlapping resources in serving-crds.yaml and serving-core.yaml
+# These errors occur due to overlapping resource definitions but are not expected to affect the installation or functionality
 kubectl delete -f https://github.com/knative/serving/releases/download/${KNATIVE_VERSION}/serving-core.yaml       
 kubectl delete -f https://github.com/knative/serving/releases/download/${KNATIVE_VERSION}/serving-crds.yaml       
 set -e