forked from kata-containers/tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_crio.sh
executable file
·174 lines (156 loc) · 6.28 KB
/
install_crio.sh
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#!/bin/bash
#
# Copyright (c) 2017-2018 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
set -o errexit
set -o nounset
set -o pipefail
cidir=$(dirname "$0")
source "${cidir}/lib.sh"
source /etc/os-release || source /usr/lib/os-release
echo "Install go-md2man"
go_md2man_url=$(get_test_version "externals.go-md2man.url")
go_md2man_version=$(get_test_version "externals.go-md2man.version")
go_md2man_repo=${go_md2man_url/https:\/\/}
go get -d "${go_md2man_repo}"
pushd "$GOPATH/src/${go_md2man_repo}"
git checkout "${go_md2man_version}"
go build
go install
popd
echo "Install conmon"
conmon_url=$(get_version "externals.conmon.url")
conmon_version=$(get_version "externals.conmon.version")
conmon_repo=${conmon_url/https:\/\/}
go get -d "${conmon_repo}" || true
pushd "$GOPATH/src/${conmon_repo}"
git checkout "${conmon_version}"
make
sudo -E make install
popd
echo "Configure registries"
sudo mkdir -p /etc/containers/registries.conf.d/
cat <<EOF| sudo tee "/etc/containers/registries.conf.d/ciregistries.conf"
unqualified-search-registries = ["registry.fedoraproject.org", "registry.access.redhat.com", "registry.centos.org", "docker.io"]
[aliases]
# centos
"centos" = "quay.io/centos/centos"
# containers
"skopeo" = "quay.io/skopeo/stable"
"buildah" = "quay.io/buildah/stable"
"podman" = "quay.io/podman/stable"
# docker
"alpine" = "docker.io/library/alpine"
"docker" = "docker.io/library/docker"
"registry" = "docker.io/library/registry"
"hello-world" = "docker.io/library/hello-world"
"swarm" = "docker.io/library/swarm"
# Fedora
"fedora-minimal" = "registry.fedoraproject.org/fedora-minimal"
"fedora" = "registry.fedoraproject.org/fedora"
# openSUSE
"opensuse/tumbleweed" = "registry.opensuse.org/opensuse/tumbleweed"
"opensuse/tumbleweed-dnf" = "registry.opensuse.org/opensuse/tumbleweed-dnf"
"opensuse/tumbleweed-microdnf" = "registry.opensuse.org/opensuse/tumbleweed-microdnf"
"opensuse/leap" = "registry.opensuse.org/opensuse/leap"
"opensuse/busybox" = "registry.opensuse.org/opensuse/busybox"
"tumbleweed" = "registry.opensuse.org/opensuse/tumbleweed"
"tumbleweed-dnf" = "registry.opensuse.org/opensuse/tumbleweed-dnf"
"tumbleweed-microdnf" = "registry.opensuse.org/opensuse/tumbleweed-microdnf"
"leap" = "registry.opensuse.org/opensuse/leap"
"tw-busybox" = "registry.opensuse.org/opensuse/busybox"
# SUSE
"suse/sle15" = "registry.suse.com/suse/sle15"
"suse/sles12sp5" = "registry.suse.com/suse/sles12sp5"
"suse/sles12sp4" = "registry.suse.com/suse/sles12sp4"
"suse/sles12sp3" = "registry.suse.com/suse/sles12sp3"
"sle15" = "registry.suse.com/suse/sle15"
"sles12sp5" = "registry.suse.com/suse/sles12sp5"
"sles12sp4" = "registry.suse.com/suse/sles12sp4"
"sles12sp3" = "registry.suse.com/suse/sles12sp3"
# Red Hat Enterprise Linux
"rhel" = "registry.access.redhat.com/rhel"
"rhel6" = "registry.access.redhat.com/rhel6"
"rhel7" = "registry.access.redhat.com/rhel7"
"ubi7" = "registry.access.redhat.com/ubi7"
"ubi7-init" = "registry.access.redhat.com/ubi7-init"
"ubi7-minimal" = "registry.access.redhat.com/ubi7-minimal"
"ubi8" = "registry.access.redhat.com/ubi8"
"ubi8-minimal" = "registry.access.redhat.com/ubi8-minimal"
"ubi8-init" = "registry.access.redhat.com/ubi8-init"
"ubi8-micro" = "registry.access.redhat.com/ubi8-micro"
"ubi8/ubi" = "registry.access.redhat.com/ubi8/ubi"
"ubi8/ubi-minimal" = "registry.access.redhat.com/ubi8-minimal"
"ubi8/ubi-init" = "registry.access.redhat.com/ubi8-init"
"ubi8/ubi-micro" = "registry.access.redhat.com/ubi8-micro"
# Debian
"debian" = "docker.io/library/debian"
# Oracle Linux
"oraclelinux" = "container-registry.oracle.com/os/oraclelinux"
EOF
echo "Get CRI-O sources"
kubernetes_sigs_org="github.com/kubernetes-sigs"
ghprbGhRepository="${ghprbGhRepository:-}"
crio_repo=$(get_version "externals.crio.url")
# remove https:// from the url
crio_repo="${crio_repo#*//}"
crio_branch=$(get_version "externals.crio.branch")
crictl_repo=$(get_version "externals.critools.url")
crictl_version=$(get_version "externals.critools.version")
crictl_tag_prefix="v"
go get -d "$crio_repo" || true
if [ "$ghprbGhRepository" != "${crio_repo/github.com\/}" ]
then
# Only fetch and checkout if we are not testing changes in the cri-o repo.
pushd "${GOPATH}/src/${crio_repo}"
git fetch
git checkout "${crio_branch}"
popd
fi
pushd "${GOPATH}/src/${crio_repo}"
echo "Installing CRI-O"
make clean
make BUILDTAGS='seccomp selinux exclude_graphdriver_btrfs exclude_graphdriver_devicemapper libdm_no_deferred_remove'
make test-binaries
sudo -E PATH=$PATH sh -c "make install"
sudo -E PATH=$PATH sh -c 'crio -d "" --log-level "debug" --cgroup-manager "systemd" --storage-driver "overlay" --storage-opt "overlay.override_kernel_check=1" config > crio.conf'
sudo -E PATH=$PATH sh -c "make install.config"
containers_config_path="/etc/containers"
echo "Copy containers policy from CRI-O repo to $containers_config_path"
sudo mkdir -p "$containers_config_path"
sudo install -m0444 test/policy.json "$containers_config_path"
popd
# Install cri-tools
echo "Installing CRI Tools"
crictl_url="${crictl_repo}/releases/download/v${crictl_version}/crictl-${crictl_tag_prefix}${crictl_version}-linux-$(${cidir}/kata-arch.sh -g).tar.gz"
curl -Ls "$crictl_url" | sudo tar xfz - -C /usr/local/bin
echo "Install runc for CRI-O"
runc_version=$(get_version "externals.runc.version")
go get -d github.com/opencontainers/runc
pushd "${GOPATH}/src/github.com/opencontainers/runc"
git checkout "$runc_version"
typeset -a build_union
lib_union=(libapparmor libseccomp libselinux)
for item in ${lib_union[*]}
do
if pkg-config --exists ${item}; then
build_union+=(${item#lib})
fi
done
make BUILDTAGS="$(IFS=" "; echo "${build_union[*]}")"
sudo -E install -D -m0755 runc "/usr/local/bin/crio-runc"
# Allow other tests to find the binary by it's normal name
sudo ln -s /usr/local/bin/crio-runc /usr/local/bin/runc
popd
service_path="/etc/systemd/system"
kubelet_service_dir="${service_path}/kubelet.service.d/"
sudo mkdir -p "${kubelet_service_dir}"
sudo rm -f "${kubelet_service_dir}/0-containerd.conf"
cat <<EOF| sudo tee "${kubelet_service_dir}/0-crio.conf"
[Service]
Environment="KUBELET_EXTRA_ARGS=--container-runtime=remote --runtime-request-timeout=15m --container-runtime-endpoint=unix:///var/run/crio/crio.sock"
EOF
echo "Reload systemd services"
sudo systemctl daemon-reload