-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Plamen Petrov <plamb0brt@gmail.com>
- Loading branch information
1 parent
9e2cf95
commit 78970a5
Showing
5 changed files
with
158 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,4 +96,7 @@ $(SUBDIRS): | |
|
||
test-subdirs: $(SUBDIRS) | ||
|
||
test-cri: | ||
$(MAKE) -C cri test | ||
|
||
.PHONY: test-orch $(SUBDIRS) test-subdirs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
EXTRAGOARGS:=-v -race -cover | ||
|
||
test: | ||
sudo env "PATH=$(PATH)" go test ./ $(EXTRAGOARGS) | ||
|
||
test-man: | ||
echo "Nothing to test manually" | ||
|
||
.PHONY: test test-man |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
#!/bin/bash | ||
sudo apt-get update 1>/dev/null | ||
|
||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
|
||
sudo apt-get install -y btrfs-tools pkg-config libseccomp-dev unzip tar libseccomp2 socat util-linux apt-transport-https curl ipvsadm git-lfs 1>/dev/null | ||
|
||
pushd $DIR | ||
git lfs pull 1>/dev/null | ||
popd | ||
|
||
wget -c https://github.com/google/protobuf/releases/download/v3.11.4/protoc-3.11.4-linux-x86_64.zip 1>/dev/null | ||
sudo unzip protoc-3.11.4-linux-x86_64.zip -d /usr/local 1>/dev/null | ||
|
||
|
||
export KUBECONFIG=/etc/kubernetes/admin.conf | ||
echo 'export KUBECONFIG=/etc/kubernetes/admin.conf' >> /etc/profile | ||
|
||
# Build and install runc and containerd | ||
GOGITHUB=${HOME}/go/src/github.com/ | ||
RUNC_ROOT=${GOGITHUB}/opencontainers/runc | ||
CONTAINERD_ROOT=${GOGITHUB}/containerd/containerd | ||
mkdir -p $RUNC_ROOT | ||
mkdir -p $CONTAINERD_ROOT | ||
|
||
git clone https://github.com/opencontainers/runc.git $RUNC_ROOT 1>/dev/null | ||
git clone -b cri_logging https://github.com/plamenmpetrov/containerd.git $CONTAINERD_ROOT 1>/dev/null | ||
|
||
cd $RUNC_ROOT | ||
sudo make && sudo make install 1>/dev/null | ||
|
||
cd $CONTAINERD_ROOT | ||
sudo make && sudo make install 1>/dev/null | ||
|
||
containerd --version || echo "failed to build containerd" | ||
|
||
|
||
# Install k8s | ||
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - | ||
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list 1>/dev/null | ||
sudo apt install -y cri-tools ebtables ethtool kubeadm kubectl kubelet kubernetes-cni 1>/dev/null | ||
|
||
|
||
# Install knative CLI | ||
git clone https://github.com/knative/client.git $HOME/client 1>/dev/null | ||
cd $HOME/client | ||
sudo hack/build.sh -f 1>/dev/null | ||
sudo mv kn /usr/local/bin | ||
|
||
|
||
# Necessary for containerd as container runtime but not docker | ||
sudo modprobe overlay | ||
sudo modprobe br_netfilter | ||
|
||
# Set up required sysctl params, these persist across reboots. | ||
cat <<EOF | sudo tee /etc/sysctl.d/99-kubernetes-cri.conf | ||
net.bridge.bridge-nf-call-iptables = 1 | ||
net.ipv4.ip_forward = 1 | ||
net.bridge.bridge-nf-call-ip6tables = 1 | ||
EOF | ||
|
||
sudo sysctl --system | ||
# --------------------------------------------------------- | ||
sudo swapoff -a | ||
sudo sysctl net.ipv4.ip_forward=1 | ||
|
||
|
||
################################ | ||
# Setup firecracker-containerd | ||
sudo mkdir -p /var/lib/firecracker-containerd/runtime | ||
curl -fsSL -o /var/lib/firecracker-containerd/runtime/hello-vmlinux.bin https://s3.amazonaws.com/spec.ccfc.min/img/hello/kernel/hello-vmlinux.bin 1>/dev/null | ||
|
||
mkdir -p /etc/firecracker-containerd | ||
|
||
sudo tee /etc/firecracker-containerd/config.toml <<EOF | ||
disabled_plugins = ["cri"] | ||
root = "/var/lib/firecracker-containerd/containerd" | ||
state = "/run/firecracker-containerd" | ||
[grpc] | ||
address = "/run/firecracker-containerd/containerd.sock" | ||
[plugins] | ||
[plugins.devmapper] | ||
pool_name = "fc-dev-thinpool" | ||
base_image_size = "10GB" | ||
root_path = "/var/lib/firecracker-containerd/snapshotter/devmapper" | ||
[debug] | ||
level = "debug" | ||
EOF | ||
|
||
sudo mkdir -p /etc/containerd/ | ||
|
||
sudo tee /etc/containerd/firecracker-runtime.json <<EOF | ||
{ | ||
"firecracker_binary_path": "/usr/local/bin/firecracker", | ||
"kernel_image_path": "/var/lib/firecracker-containerd/runtime/hello-vmlinux.bin", | ||
"kernel_args": "console=ttyS0 noapic reboot=k panic=1 pci=off nomodules ro systemd.journald.forward_to_console systemd.unit=firecracker.target init=/sbin/overlay-init", | ||
"root_drive": "/var/lib/firecracker-containerd/runtime/default-rootfs.img", | ||
"cpu_template": "T2", | ||
"log_levels": ["info"] | ||
} | ||
EOF | ||
|
||
|
||
cd $DIR | ||
../create_devmapper.sh 1>/dev/null | ||
|
||
BINS=../../bin/ | ||
DST=/usr/local/bin | ||
|
||
pushd $BINS | ||
|
||
cp firecracker $DST | ||
cp jailer $DST | ||
cp containerd-shim-aws-firecracker $DST | ||
cp firecracker-containerd $DST | ||
cp firecracker-ctr $DST | ||
cp default-rootfs.img /var/lib/firecracker-containerd/runtime/ | ||
|
||
popd | ||
|
||
sudo env PATH=$PATH containerd 1>/dev/null 2>/dev/null & | ||
sudo PATH=$PATH /usr/local/bin/firecracker-containerd --config /etc/firecracker-containerd/config.toml 1>/dev/null 2>/dev/null & | ||
|
||
cd $DIR | ||
|
||
cd ../../../ | ||
go build ./... | ||
|
||
cd $DIR | ||
./../../fccd-orchestrator & | ||
|
||
./../cri/create_kubeadm_cluster.sh | ||
|
||
sleep 2m | ||
|
||
sudo env PATH=$PATH kubectl apply -f ../../knative_workloads/helloworld.yaml | ||
sudo env PATH=$PATH kubectl apply -f ../../knative_workloads/pyaes.yaml | ||
sudo env PATH=$PATH kubectl apply -f ../../knative_workloads/rnn_serving.yaml | ||
|