File: kubernetes-e2e

package info (click to toggle)
conmon 2.1.13%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 732 kB
  • sloc: ansic: 3,324; sh: 701; makefile: 120
file content (99 lines) | stat: -rwxr-xr-x 2,767 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/usr/bin/env bash
set -euo pipefail

# Check for root
if [[ $EUID -ne 0 ]]; then
    echo "Please run this script as root"
    exit 1
fi

# Install latest CRI-O
curl https://raw.githubusercontent.com/cri-o/cri-o/master/scripts/get | bash
crio --version

# Use runc as default runtime
rm /etc/crio/crio.conf.d/10-crun.conf
cat <<EOT >>/etc/crio/crio.conf.d/10-config.conf
[crio.runtime]
log_level = "debug"
[crio.runtime.runtimes.runc]
runtime_path = "/usr/local/bin/runc"
EOT
runc --version

# Start CRI-O
systemctl daemon-reload
systemctl start crio
systemctl is-active --quiet crio && echo CRI-O is running
journalctl --no-pager -u crio

# Start Kubernetes
GOROOT="$GOROOT_1_17_X64"
GOPATH="$HOME/go"
PATH="$GOROOT/bin:$PATH"
K8SPATH="$GOPATH/src/k8s.io"
mkdir -p "$K8SPATH"
pushd "$K8SPATH"
git clone --depth=1 https://github.com/kubernetes/kubernetes
pushd kubernetes

LATEST=$(curl -sSfL https://dl.k8s.io/ci/latest.txt)
echo "Using Kubernetes build $LATEST"

URL="https://dl.k8s.io/ci/$LATEST"
mkdir -p _output/bin

echo Downloading server binaries
curl -sSfL "$URL/kubernetes-server-linux-amd64.tar.gz" -o- | tar xfz -
cp kubernetes/server/bin/{kubectl,kube-apiserver,kube-controller-manager,kube-proxy,kube-scheduler,kubelet} \
    _output/bin

echo Downloading test binaries
curl -sSfL "$URL/kubernetes-test-linux-amd64.tar.gz" -o- | tar xfz -
cp kubernetes/test/bin/{ginkgo,e2e.test} _output/bin

export CONTAINER_RUNTIME=remote
export CGROUP_DRIVER=systemd
export CGROUP_ROOT=/
export KUBELET_FLAGS='--runtime-cgroups=/system.slice/crio.service --non-masquerade-cidr=0.0.0.0/0'
export CONTAINER_RUNTIME_ENDPOINT=/var/run/crio/crio.sock
export ALLOW_PRIVILEGED=1

IP=$(ip route get 1.2.3.4 | cut -d ' ' -f7 | tr -d '[:space:]')
echo "Using IP: $IP"
export DNS_SERVER_IP=$IP
export API_HOST_IP=$IP

iptables -F
hack/install-etcd.sh
export PATH="$GOPATH/src/k8s.io/kubernetes/third_party/etcd:$PATH"

OUTPUT=$(mktemp)
hack/local-up-cluster.sh -O 2>&1 | tee "$OUTPUT" &
PID=$!

until grep -q "Local Kubernetes cluster is running" "$OUTPUT"; do
    echo Waiting for hack/local-up-cluster.sh
    if ! ps $PID >/dev/null; then
        exit 1
    fi
    sleep 5
done

echo Cluster is up and running

# Run the tests
export KUBERUN=/var/run/kubernetes
export KUBECONFIG=$KUBERUN/admin.kubeconfig
export PATH="$GOPATH/src/k8s.io/kubernetes/_output/local/bin/linux/amd64:$PATH"
export KUBE_MASTER_URL=$IP
export KUBE_MASTER_IP=$IP
export KUBE_MASTER=$IP
export HOSTNAME_OVERRIDE=$IP

export GINKGO_PARALLEL_NODES=4
export GINKGO_PARALLEL=y

_output/bin/e2e.test --provider=local --host="https://$IP:6443" \
    --ginkgo.focus='\[NodeConformance|NodeFeature:.*\]' \
    --ginkgo.skip='\[Flaky|Slow|Serial|sig-network|NodeFeature:RuntimeHandler\]|exec hook properly'