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

     1  #!/bin/bash
     2  
     3  source utils/ais_minikube_setup.sh
     4  
     5  # Default values and environment variables
     6  export AIS_FS_PATHS=""
     7  export TEST_FSPATH_COUNT=4
     8  REGISTRY_URL="${REGISTRY_URL:-docker.io}"
     9  IMAGE_TAG="latest"
    10  
    11  if [ -n "$1" ]; then
    12    HTTPS="$1"
    13  fi
    14  
    15  IMAGE_NAME=aistorage/aisnode-minikube
    16  export DOCKER_IMAGE="${REGISTRY_URL}/${IMAGE_NAME}:${IMAGE_TAG}"
    17  
    18  PRIMARY_PORT=8080
    19  
    20  if [ -n "${HTTPS}" ] && [ "${HTTPS}" == "true" ]; then
    21    source utils/create_certs.sh
    22    HOST_URL="https://$(minikube ip):${PRIMARY_PORT}"
    23    export AIS_USE_HTTPS=true
    24    export AIS_SKIP_VERIFY_CRT=true
    25    export AIS_SERVER_CRT="/var/certs/tls.crt"
    26    export AIS_SERVER_KEY="/var/certs/tls.key"
    27    export PROTOCOL="HTTPS"
    28  else
    29    HOST_URL="http://$(minikube ip):${PRIMARY_PORT}"
    30    export AIS_USE_HTTPS=false
    31    export AIS_SKIP_VERIFY_CRT=false
    32    export AIS_SERVER_CRT=""
    33    export AIS_SERVER_KEY=""
    34    export PROTOCOL="HTTP"
    35  fi
    36  
    37  export AIS_PRIMARY_URL=$HOST_URL
    38  export HOSTNAME_LIST="$(minikube ip)"
    39  export AIS_BACKEND_PROVIDERS=""
    40  export TARGET_CNT=1
    41  
    42  export POD_NAME="ais-proxy-0"
    43  export PORT=$PRIMARY_PORT
    44  export INSTANCE=0
    45  
    46  export AIS_LOG_DIR="/tmp/ais/${INSTANCE}/log"
    47  (minikube ssh "sudo mkdir -p ${AIS_LOG_DIR}")
    48  
    49  ([[ $(kubectl get pods | grep -c "${POD_NAME}") -gt 0 ]] && kubectl delete pods ${POD_NAME}) || true
    50  envsubst < kube_templates/aisproxy_deployment.yml | kubectl apply -f -
    51  
    52  echo "Waiting for the primary proxy to be ready..."
    53  kubectl wait --for="condition=ready" --timeout=2m pod ais-proxy-0
    54  
    55  echo "Starting target deployment..."
    56  
    57  export POD_NAME="ais-target-0"
    58  export PORT=9090
    59  export PORT_INTRA_CONTROL=9080
    60  export PORT_INTRA_DATA=10080
    61  export TARGET_POS_NUM=1
    62  export INSTANCE=1
    63  
    64  export AIS_LOG_DIR="/tmp/ais/${INSTANCE}/log"
    65  (minikube ssh "sudo mkdir -p ${AIS_LOG_DIR}")
    66  
    67  # Delete and apply target deployment
    68  ([[ $(kubectl get pods | grep -c "${POD_NAME}") -gt 0 ]] && kubectl delete pods ${POD_NAME}) || true
    69  envsubst < kube_templates/aistarget_deployment.yml | kubectl create -f -
    70  
    71  echo "Waiting for the targets to be ready..."
    72  kubectl wait --for="condition=ready" --timeout=2m pods -l type=aistarget
    73  
    74  # Display a list of running pods
    75  echo "List of running pods"
    76  kubectl get pods -o wide
    77  
    78  echo "Done."
    79  echo ""
    80  
    81  # Set AIS_ENDPOINT for use with the CLI
    82  export AIS_ENDPOINT=$HOST_URL
    83  echo "Set the \"AIS_ENDPOINT\" for use of CLI:"
    84  echo "export AIS_ENDPOINT=\"$AIS_ENDPOINT\""