aravind.est | acdf2fe | 2023-07-18 10:59:06 +0100 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # ============LICENSE_START=============================================== |
| 4 | # Copyright (C) 2023 Nordix Foundation. All rights reserved. |
| 5 | # ======================================================================== |
| 6 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | # you may not use this file except in compliance with the License. |
| 8 | # You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, software |
| 13 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | # See the License for the specific language governing permissions and |
| 16 | # limitations under the License. |
| 17 | # ============LICENSE_END================================================= |
| 18 | # |
| 19 | |
| 20 | echo "######### Installing Kserve #########" |
| 21 | |
| 22 | KSERVE_CRD_RESPONSE=$(kubectl get crd inferenceservice.serving.kserve.io) |
| 23 | if [ -z "$KSERVE_CRD_RESPONSE" ]; then |
| 24 | echo "Adding istio helm repository" |
| 25 | helm repo add istio https://istio-release.storage.googleapis.com/charts |
| 26 | helm repo update |
| 27 | |
| 28 | echo "Installing Istio..." |
| 29 | kubectl create namespace istio-system |
| 30 | helm install istio-base istio/base -n istio-system --set defaultRevision=default |
| 31 | helm install istiod istio/istiod -n istio-system --wait |
| 32 | |
| 33 | echo "Installing Istio Kserve ingress..." |
| 34 | kubectl apply -f resources/kserve-istio-ingress.yaml |
| 35 | |
| 36 | echo "Installing Cert Manager v1.12.0 ..." |
| 37 | kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.12.0/cert-manager.yaml |
| 38 | |
| 39 | while [[ $TIME -lt 20 ]]; do |
| 40 | CERT_MANAGER_PODS=$(kubectl get pods -n cert-manager --field-selector=status.phase!=Running --no-headers) |
| 41 | if [[ -z "$CERT_MANAGER_PODS" ]]; then |
| 42 | echo "Cert manager is running." |
| 43 | break |
| 44 | fi |
| 45 | |
| 46 | echo "Waiting for cert manager to be running..." |
| 47 | echo "These pods are not running" |
| 48 | echo "$CERT_MANAGER_PODS" |
| 49 | TIME=$(expr $TIME + 3) |
| 50 | sleep 3 |
| 51 | done |
| 52 | echo "Waiting for cert-manager to get initialized..." |
| 53 | |
| 54 | echo "Installing Kserve v0.10.0 ..." |
| 55 | kubectl apply -f https://github.com/kserve/kserve/releases/download/v0.10.0/kserve.yaml |
| 56 | kubectl apply -f https://github.com/kserve/kserve/releases/download/v0.10.0/kserve-runtimes.yaml |
| 57 | echo "Patching Kserve ..." |
| 58 | kubectl patch configmap/inferenceservice-config -n kserve --type=strategic -p '{"data": {"deploy": "{\"defaultDeploymentMode\": \"RawDeployment\"}"}}' |
| 59 | echo "Kserve installation completed." |
| 60 | else |
| 61 | echo "Kserve already installed." |
| 62 | fi |