github.com/dmaizel/tests@v0.0.0-20210728163746-cae6a2d9cee8/integration/kubernetes/e2e_conformance/setup.sh (about)

     1  #!/bin/bash
     2  #
     3  # Copyright (c) 2020 Intel Corporation
     4  #
     5  # SPDX-License-Identifier: Apache-2.0
     6  #
     7  
     8  # Entry point to start a K8S cluster for end-to-end testing
     9  # If cluster is already running with Kata RuntimeClass, skip this script and
    10  # use run.sh
    11  
    12  set -o errexit
    13  set -o nounset
    14  set -o pipefail
    15  
    16  SCRIPT_PATH=$(dirname "$(readlink -f "$0")")
    17  source "${SCRIPT_PATH}/../../../lib/common.bash"
    18  source "${SCRIPT_PATH}/../../../.ci/lib.sh"
    19  CRI_RUNTIME="${CRI_RUNTIME:-containerd}"
    20  
    21  wait_init_retry="10s"
    22  
    23  info "Setup env for K8s e2e testing"
    24  cd "${GOPATH}/src/github.com/kata-containers/tests/integration/kubernetes"
    25  if ! bash ./init.sh; then
    26  	info "k8s init failed trying again"
    27  	sudo systemctl restart "${CRI_RUNTIME}"
    28  	sleep "${wait_init_retry}"
    29  	bash ./init.sh
    30  fi
    31  crictl --version
    32  kubectl get runtimeclass
    33  kubectl apply -f "runtimeclass_workloads/kata-runtimeclass.yaml"
    34  kubectl get pods --all-namespaces