-
Notifications
You must be signed in to change notification settings - Fork 11
/
minikube-start.sh
executable file
·76 lines (55 loc) · 1.51 KB
/
minikube-start.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
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
set -o errexit -o pipefail -o nounset
script_dir="$( dirname "$0" | xargs readlink -e )"
repo_root=$script_dir/../..
__minikube() {
minikube -p=crun-vm-example "$@"
}
__cp() {
__minikube cp "$@"
}
__ssh() {
__minikube ssh -- sudo "$@" </dev/null
}
__apt_get() {
__ssh DEBIAN_FRONTEND=noninteractive apt-get \
-o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold \
"$@"
}
# build runtime
make -C "$repo_root"
# create minikube cluster
__minikube start --driver=docker --container-runtime=cri-o
# minikube currently uses an old Ubuntu version that doesn't provide all our
# dependencies with the minimum versions we require, so we just hackily add the
# repo for a more recent version
__ssh sed -i s/jammy/mantic/g /etc/apt/sources.list
__apt_get update
# install dependencies
__apt_get install -yq --no-install-recommends \
libvirt-clients \
libvirt-daemon \
libvirt-daemon-system \
genisoimage \
passt \
qemu-system-x86 \
qemu-utils \
virtiofsd
# configure runtime
__ssh 'tee --append /etc/crio/crio.conf <<EOF
[crio.runtime.runtimes.crun-vm]
runtime_path = "/usr/local/bin/crun-vm"
EOF'
__cp "$repo_root/out/crun-vm" /usr/local/bin/crun-vm
__ssh chmod +x /usr/local/bin/crun-vm
# reload cluster so that the new runtime is picked up
__minikube start
# create ResourceClass
kubectl create -f - <<EOF
apiVersion: node.k8s.io/v1
kind: RuntimeClass
metadata:
name: crun-vm
handler: crun-vm
EOF