vitess.io/vitess@v0.16.2/tools/get_kubectl_kind.sh (about)

     1  #!/bin/bash
     2  
     3  set -euo pipefail
     4  source build.env
     5  
     6  # This script downloads kind binary that are
     7  # used as part of the vtop test environment,
     8  # and places them in vitess/bin/.
     9  #
    10  # The vtop example test expects kind binary to be found in the PATH.
    11  
    12  mkdir -p "$VTROOT/bin"
    13  cd "$VTROOT/bin"
    14  
    15  KUBE_VERSION="${KUBE_VERSION:-v1.21.1}"
    16  KUBERNETES_RELEASE_URL="${KUBERNETES_RELEASE_URL:-https://dl.k8s.io}"
    17  
    18  # Download kubectl if needed.
    19  if [ ! -f "kubectl-${KUBE_VERSION}" ]; then
    20      echo "Downloading kubectl ${KUBE_VERSION}..."
    21      curl -L "${KUBERNETES_RELEASE_URL}/${KUBE_VERSION}/bin/linux/amd64/kubectl" > "kubectl-${KUBE_VERSION}"
    22      chmod +x "kubectl-${KUBE_VERSION}"
    23  fi
    24  echo "Using kubectl ${KUBE_VERSION}."
    25  ln -sf "kubectl-${KUBE_VERSION}" kubectl
    26  
    27  # Download kind if needed.
    28  if ! command -v kind &> /dev/null
    29  then
    30      echo "Downloading kind..."
    31      curl -L https://kind.sigs.k8s.io/dl/v0.12.0/kind-linux-amd64 > "kind"
    32      chmod +x "kind"
    33      echo "Installed kind"
    34  else
    35      echo "Kind already installed"
    36  fi