github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/deploy/dev/k8s/utils/pre_check.sh (about)

     1  #!/bin/bash
     2  set +e
     3  os=$(uname -s | tr '[:upper:]' '[:lower:]')
     4  # Installing minikube if not present
     5  install_minikube='true'
     6  if command -v minikube &> /dev/null; then
     7    MINIKUBE_VER=$(minikube version --short 2>&1 | cut -d'v' -f2)
     8    if ! [[ "$MINIKUBE_VER" < "1.20.0" ]] ; then
     9      install_minikube='false'
    10    fi
    11  fi
    12  if [[ "$install_minikube" == "true" ]]; then
    13    echo "minikube >= v1.20.0 could not be found"
    14    echo "Fetching and installing the latest minikube ..."
    15    curl -Lo /tmp/minikube https://storage.googleapis.com/minikube/releases/latest/minikube-${os}-amd64 \
    16    && chmod +x /tmp/minikube
    17    sudo mkdir -p /usr/local/bin/
    18    sudo install /tmp/minikube /usr/local/bin/
    19  fi
    20  
    21  # Installing kubectl if not present
    22  if ! command -v kubectl &> /dev/null; then
    23    curl -Lo /tmp/kubectl "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/${os}/amd64/kubectl"
    24    chmod +x /tmp/kubectl
    25    sudo mv /tmp/kubectl /usr/local/bin/kubectl
    26  fi
    27  
    28  # The invoker of the parent script must not be root as `minikube`
    29  # should not be run as root
    30  if [[ $EUID -eq 0 ]]; then
    31    echo "This script must not be run as root"
    32    exit 1
    33  fi
    34  
    35