2017-02-22 03:27:51 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
|
2019-08-06 23:33:04 +00:00
|
|
|
# This script runs the integration tests on a Linux machine for the none Driver
|
2017-02-22 03:27:51 +00:00
|
|
|
|
|
|
|
# The script expects the following env variables:
|
2017-05-10 20:26:05 +00:00
|
|
|
# MINIKUBE_LOCATION: GIT_COMMIT from upstream build.
|
|
|
|
# COMMIT: Actual commit ID from upstream build
|
|
|
|
# EXTRA_BUILD_ARGS (optional): Extra args to be passed into the minikube integrations tests
|
2022-04-25 07:54:40 +00:00
|
|
|
# access_token: The GitHub API access token. Injected by the Jenkins credential provider.
|
2017-05-10 20:26:05 +00:00
|
|
|
|
2017-02-22 03:27:51 +00:00
|
|
|
set -e
|
|
|
|
|
2021-05-06 23:23:41 +00:00
|
|
|
OS="linux"
|
|
|
|
ARCH="amd64"
|
2021-05-06 19:43:16 +00:00
|
|
|
DRIVER="none"
|
2019-08-06 23:33:04 +00:00
|
|
|
JOB_NAME="none_Linux"
|
2020-12-09 00:18:12 +00:00
|
|
|
EXTRA_START_ARGS="--bootstrapper=kubeadm"
|
2017-10-20 21:28:43 +00:00
|
|
|
|
2017-07-07 17:28:30 +00:00
|
|
|
SUDO_PREFIX="sudo -E "
|
|
|
|
export KUBECONFIG="/root/.kube/config"
|
2017-02-22 03:27:51 +00:00
|
|
|
|
2022-06-23 21:31:18 +00:00
|
|
|
if ! kubeadm &>/dev/null; then
|
|
|
|
echo "WARNING: kubeadm is not installed. will try to install."
|
2023-02-13 18:34:42 +00:00
|
|
|
curl -LO "https://dl.k8s.io/release/$(curl -sSL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubeadm"
|
2022-06-23 21:31:18 +00:00
|
|
|
sudo install kubeadm /usr/local/bin/kubeadm
|
|
|
|
fi
|
2017-12-28 04:57:44 +00:00
|
|
|
# "none" driver specific cleanup from previous runs.
|
2022-06-23 21:31:18 +00:00
|
|
|
sudo kubeadm reset -f --cri-socket unix:///var/run/cri-dockerd.sock || true
|
2019-10-30 04:50:02 +00:00
|
|
|
# kubeadm reset may not stop pods immediately
|
|
|
|
docker rm -f $(docker ps -aq) >/dev/null 2>&1 || true
|
2018-12-14 22:10:39 +00:00
|
|
|
|
2017-12-28 04:57:44 +00:00
|
|
|
# Cleanup data directory
|
|
|
|
sudo rm -rf /data/*
|
2018-12-04 21:37:31 +00:00
|
|
|
# Cleanup old Kubernetes configs
|
|
|
|
sudo rm -rf /etc/kubernetes/*
|
2020-02-13 02:11:44 +00:00
|
|
|
sudo rm -rf /var/lib/minikube/*
|
|
|
|
|
2020-02-14 04:10:32 +00:00
|
|
|
# Stop any leftover kubelet
|
2020-03-12 18:43:34 +00:00
|
|
|
sudo systemctl is-active --quiet kubelet \
|
2018-12-03 20:46:58 +00:00
|
|
|
&& echo "stopping kubelet" \
|
2020-03-24 01:37:13 +00:00
|
|
|
&& sudo systemctl stop -f kubelet
|
|
|
|
|
2022-05-19 21:37:45 +00:00
|
|
|
# conntrack is required for Kubernetes 1.18 and higher for none driver
|
2020-03-24 01:37:13 +00:00
|
|
|
if ! conntrack --version &>/dev/null; then
|
2022-06-23 21:31:18 +00:00
|
|
|
echo "WARNING: conntrack is not installed. will try to install."
|
2020-03-24 01:37:13 +00:00
|
|
|
sudo apt-get update -qq
|
|
|
|
sudo apt-get -qq -y install conntrack
|
|
|
|
fi
|
|
|
|
|
2022-05-19 21:37:45 +00:00
|
|
|
# socat is required for kubectl port forward which is used in some tests such as validateHelmTillerAddon
|
2020-03-25 20:26:47 +00:00
|
|
|
if ! which socat &>/dev/null; then
|
2020-03-25 20:30:08 +00:00
|
|
|
echo "WARNING: socat is not installed. will try to install."
|
2020-03-25 20:26:47 +00:00
|
|
|
sudo apt-get update -qq
|
|
|
|
sudo apt-get -qq -y install socat
|
|
|
|
fi
|
2017-12-28 04:57:44 +00:00
|
|
|
|
2022-05-19 21:37:45 +00:00
|
|
|
# cri-dockerd is required for Kubernetes 1.24 and higher for none driver
|
2022-06-23 21:31:18 +00:00
|
|
|
if ! cri-dockerd --version &>/dev/null; then
|
2022-05-19 21:37:45 +00:00
|
|
|
echo "WARNING: cri-dockerd is not installed. will try to install."
|
2023-01-30 18:30:53 +00:00
|
|
|
CRI_DOCKERD_VERSION="v0.3.1"
|
|
|
|
CRI_DOCKERD_COMMIT="9a87d6ae274ecf0f23776920964d6484bd679282"
|
|
|
|
CRI_DOCKERD_BASE_URL="https://storage.googleapis.com/kicbase-artifacts/cri-dockerd/${CRI_DOCKERD_COMMIT}"
|
2022-08-03 21:51:17 +00:00
|
|
|
sudo curl -L "${CRI_DOCKERD_BASE_URL}/amd64/cri-dockerd" -o /usr/bin/cri-dockerd
|
|
|
|
sudo curl -L "${CRI_DOCKERD_BASE_URL}/cri-docker.socket" -o /usr/lib/systemd/system/cri-docker.socket
|
|
|
|
sudo curl -L "${CRI_DOCKERD_BASE_URL}/cri-docker.service" -o /usr/lib/systemd/system/cri-docker.service
|
2022-08-03 21:54:16 +00:00
|
|
|
sudo chmod +x /usr/bin/cri-dockerd
|
2022-05-19 21:37:45 +00:00
|
|
|
fi
|
|
|
|
|
2022-05-19 23:57:02 +00:00
|
|
|
# crictl is required for Kubernetes 1.24 and higher for none driver
|
|
|
|
if ! crictl &>/dev/null; then
|
|
|
|
echo "WARNING: crictl is not installed. will try to install."
|
2022-08-03 20:28:50 +00:00
|
|
|
CRICTL_VERSION="v1.17.0"
|
|
|
|
curl -L https://github.com/kubernetes-sigs/cri-tools/releases/download/$CRICTL_VERSION/crictl-${CRICTL_VERSION}-linux-amd64.tar.gz --output crictl-${CRICTL_VERSION}-linux-amd64.tar.gz
|
|
|
|
sudo tar zxvf crictl-$CRICTL_VERSION-linux-amd64.tar.gz -C /usr/local/bin
|
2022-05-19 23:57:02 +00:00
|
|
|
fi
|
|
|
|
|
2020-12-15 17:06:17 +00:00
|
|
|
# We need this for reasons now
|
|
|
|
sudo sysctl fs.protected_regular=0
|
|
|
|
|
2021-05-06 20:05:02 +00:00
|
|
|
source ./common.sh
|