mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-15 16:13:20 +00:00
ci: k8s: Add a method to install CRI-O
This is based on official CRI-O documentations[0] and right now we're
making this specific to Ubuntu as that's what we have as runners.
We may want to expand this in the future, but we're good for now.
[0]:
https://github.com/cri-o/cri-o/blob/main/install.md#apt-based-operating-systems
Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
(cherry picked from commit d7105cf7a4
)
This commit is contained in:
parent
67fef9d5c6
commit
b41fa6d946
@ -181,6 +181,53 @@ function deploy_rke2() {
|
||||
sudo chown ${USER}:${USER} ~/.kube/config
|
||||
}
|
||||
|
||||
function _get_k0s_kubernetes_version_for_crio() {
|
||||
# k0s version will look like:
|
||||
# v1.27.5+k0s.0
|
||||
#
|
||||
# The CRI-O repo for such version of Kubernetes expects something like:
|
||||
# 1.27
|
||||
k0s_version=$(curl -sSLf "https://docs.k0sproject.io/stable.txt")
|
||||
|
||||
# Remove everything after the second '.'
|
||||
crio_version=${k0s_version%\.*+*}
|
||||
# Remove the 'v'
|
||||
crio_version=${crio_version#v}
|
||||
|
||||
echo ${crio_version}
|
||||
}
|
||||
|
||||
function _get_os_for_crio() {
|
||||
source /etc/os-release
|
||||
|
||||
if [ "${NAME}" != "Ubuntu" ]; then
|
||||
echo "Only Ubuntu is supported for now"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
echo "x${NAME}_${VERSION_ID}"
|
||||
}
|
||||
|
||||
function setup_crio() {
|
||||
# Get the CRI-O version to be installed depending on the version of the
|
||||
# "k8s distro" that we are using
|
||||
case ${KUBERNETES} in
|
||||
k0s) crio_version=$(_get_k0s_kubernetes_version_for_crio) ;;
|
||||
*) >&2 echo "${KUBERNETES} flavour is not supported with CRI-O"; exit 2 ;;
|
||||
|
||||
esac
|
||||
|
||||
os=$(_get_os_for_crio)
|
||||
|
||||
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/${os}/ /"|sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
|
||||
echo "deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/${crio_version}/${os}/ /"|sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable:cri-o:${crio_version}.list
|
||||
curl -L https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable:cri-o:${crio_version}/${os}/Release.key | sudo apt-key add -
|
||||
curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/${os}/Release.key | sudo apt-key add -
|
||||
sudo apt update
|
||||
sudo apt install cri-o cri-o-runc
|
||||
sudo systemctl enable --now crio
|
||||
}
|
||||
|
||||
function deploy_k8s() {
|
||||
echo "::group::Deploying ${KUBERNETES}"
|
||||
|
||||
|
@ -203,6 +203,7 @@ function main() {
|
||||
login-azure) login_azure ;;
|
||||
create-cluster) create_cluster ;;
|
||||
configure-snapshotter) configure_snapshotter ;;
|
||||
setup-crio) setup_crio ;;
|
||||
deploy-k8s) deploy_k8s ;;
|
||||
install-bats) install_bats ;;
|
||||
install-kubectl) install_kubectl ;;
|
||||
|
Loading…
Reference in New Issue
Block a user