From d6974fd53ee53a2479977b07b09dcc2196376586 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sat, 15 May 2021 13:49:50 -0700 Subject: hack: firecracker binary and CNI configuration Add a target to the Makefile to download a version of firecracker and extract it under the repository hack/firecracker. We will then use this binary for running the VM. Add a CNI configuration under hack/cni. This configuration will need to be copied to `/etc/cni/conf.d`. --- .gitignore | 3 +++ Makefile | 6 ++++++ hack/cni/50-c2vm.conflist | 26 ++++++++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 hack/cni/50-c2vm.conflist diff --git a/.gitignore b/.gitignore index 6f01038..aaebe20 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ /cmd/c2vm/c2vm /c2vm +/hack/firecracker.tgz +/hack/firecracker/ +/hack/linux/ diff --git a/Makefile b/Makefile index a071aeb..a7997d8 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,9 @@ .PHONY: build build: go build -o c2vm cmd/c2vm/main.go + +.PHONY: firecracker-binary +firecracker-binary: + mkdir -p hack/firecracker + curl -L -o hack/firecracker/firecracker.tgz https://github.com/firecracker-microvm/firecracker/releases/download/v0.24.3/firecracker-v0.24.3-x86_64.tgz + tar xvzf hack/firecracker/firecracker.tgz -C hack/firecracker diff --git a/hack/cni/50-c2vm.conflist b/hack/cni/50-c2vm.conflist new file mode 100644 index 0000000..9321e54 --- /dev/null +++ b/hack/cni/50-c2vm.conflist @@ -0,0 +1,26 @@ +{ + "name": "c2vm", + "cniVersion": "0.4.0", + "plugins": [ + { + "type": "bridge", + "bridge": "c2vm-br", + "isDefaultGateway": true, + "forceAddress": false, + "ipMasq": true, + "hairpinMode": true, + "mtu": 1500, + "ipam": { + "type": "host-local", + "subnet": "192.168.128.0/24", + "resolvConf": "/etc/resolv.conf" + } + }, + { + "type": "firewall" + }, + { + "type": "tc-redirect-tap" + } + ] +} -- cgit 1.4.1