From 350d362da929e0b058fbb3d0d9ca66010c4e80a4 Mon Sep 17 00:00:00 2001 From: Jimmy Xu Date: Fri, 21 Dec 2018 22:08:29 +0800 Subject: [PATCH 1/2] [add-tensorflow-image] add Dockerfile for tensorflow --- tensorflow/README.md | 5 ++ tensorflow/kata-benchmark/Dockerfile | 8 +++ tensorflow/kata-benchmark/README.md | 10 ++++ tensorflow/kata-benchmark/files/test/test.txt | 0 tensorflow/kata-benchmark/util.sh | 46 +++++++++++++++ tensorflow/tensorflow/.gitignore | 1 + tensorflow/tensorflow/Dockerfile | 9 +++ tensorflow/tensorflow/README.md | 10 ++++ tensorflow/tensorflow/util.sh | 56 +++++++++++++++++++ 9 files changed, 145 insertions(+) create mode 100644 tensorflow/README.md create mode 100644 tensorflow/kata-benchmark/Dockerfile create mode 100644 tensorflow/kata-benchmark/README.md create mode 100644 tensorflow/kata-benchmark/files/test/test.txt create mode 100755 tensorflow/kata-benchmark/util.sh create mode 100644 tensorflow/tensorflow/.gitignore create mode 100644 tensorflow/tensorflow/Dockerfile create mode 100644 tensorflow/tensorflow/README.md create mode 100755 tensorflow/tensorflow/util.sh diff --git a/tensorflow/README.md b/tensorflow/README.md new file mode 100644 index 0000000..3b5bbb2 --- /dev/null +++ b/tensorflow/README.md @@ -0,0 +1,5 @@ +Dockerfile for tensorflow +-------------------------------------------------------- + +- [tea0water/tensorflow](tensorflow) +- [tea0water/kata-benchmark](kata-benchmark) diff --git a/tensorflow/kata-benchmark/Dockerfile b/tensorflow/kata-benchmark/Dockerfile new file mode 100644 index 0000000..afa224d --- /dev/null +++ b/tensorflow/kata-benchmark/Dockerfile @@ -0,0 +1,8 @@ +FROM ubuntu:16.04 + +RUN apt-get update && \ + apt-get install -y --no-install-recommends fio apache2-utils iperf redis-tools sysbench && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +COPY files/ /root/kata-benchmark/ diff --git a/tensorflow/kata-benchmark/README.md b/tensorflow/kata-benchmark/README.md new file mode 100644 index 0000000..d799392 --- /dev/null +++ b/tensorflow/kata-benchmark/README.md @@ -0,0 +1,10 @@ +Usage +---------- + +``` +// build image tea0water/kata-benchmark +$ ./util.sh build + +// run test container +$ ./util.sh run +``` diff --git a/tensorflow/kata-benchmark/files/test/test.txt b/tensorflow/kata-benchmark/files/test/test.txt new file mode 100644 index 0000000..e69de29 diff --git a/tensorflow/kata-benchmark/util.sh b/tensorflow/kata-benchmark/util.sh new file mode 100755 index 0000000..a6ad0e2 --- /dev/null +++ b/tensorflow/kata-benchmark/util.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +IMAGE_NAME="tea0water/kata-benchmark" + +function quit() { + echo $@ + exit 1 +} + +function show_usage() { +cat < + +action: + build # build image ${IMAGE_NAME} + run # run test container +EOF +} + +function build_image() { + echo "> start build $IMAGE_NAME" + docker build -t $IMAGE_NAME . + if [ $? -eq 0 ]; then + echo "> build ok" + else + quit "> build failed" + fi +} + +function run_container() { + docker run -it --rm $IMAGE_NAME bash +} + +## main ## + +case $1 in + build) + build_image + ;; + run) + run_container + ;; + *) + show_usage + ;; +esac diff --git a/tensorflow/tensorflow/.gitignore b/tensorflow/tensorflow/.gitignore new file mode 100644 index 0000000..36f0260 --- /dev/null +++ b/tensorflow/tensorflow/.gitignore @@ -0,0 +1 @@ +benchmarks diff --git a/tensorflow/tensorflow/Dockerfile b/tensorflow/tensorflow/Dockerfile new file mode 100644 index 0000000..3423cec --- /dev/null +++ b/tensorflow/tensorflow/Dockerfile @@ -0,0 +1,9 @@ +FROM tensorflow/tensorflow:latest +# Start a CPU-only container with Python 2 + +RUN apt-get update && \ + apt-get install -y --no-install-recommends fio apache2-utils iperf redis-tools sysbench && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +COPY benchmarks/scripts/ /benchmarks/scripts/ diff --git a/tensorflow/tensorflow/README.md b/tensorflow/tensorflow/README.md new file mode 100644 index 0000000..93a503d --- /dev/null +++ b/tensorflow/tensorflow/README.md @@ -0,0 +1,10 @@ +Usage +---------- + +``` +// build image tea0water/tensorflow +$ ./util.sh build + +// run test container +$ ./util.sh run +``` diff --git a/tensorflow/tensorflow/util.sh b/tensorflow/tensorflow/util.sh new file mode 100755 index 0000000..d7db5bd --- /dev/null +++ b/tensorflow/tensorflow/util.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +IMAGE_NAME="tea0water/tensorflow" + +function quit() { + echo $@ + exit 1 +} + +function show_usage() { +cat < + +action: + build # build image ${IMAGE_NAME} + run # run test container +EOF +} + +function build_image() { + if [ ! -d benchmarks ]; then + echo "> benchmarks not exist, start clone now" + git clone -v https://github.com/tensorflow/benchmarks.git + if [ $? -ne 0 ]; then + quit "error: failed to clone benchmarks" + fi + else + echo "> benchmarks is ready" + fi + + echo "> start build $IMAGE_NAME" + docker build -t $IMAGE_NAME . + if [ $? -eq 0 ]; then + echo "> build ok" + else + quit "> build failed" + fi +} + +function run_container() { + docker run -it --rm $IMAGE_NAME bash +} + +## main ## + +case $1 in + build) + build_image + ;; + run) + run_container + ;; + *) + show_usage + ;; +esac From 6e26c229029bfff1a88a343d0423e0e1e16c9de9 Mon Sep 17 00:00:00 2001 From: Jimmy Xu Date: Sat, 22 Dec 2018 13:34:02 +0800 Subject: [PATCH 2/2] [add-tensorflow-image] add files for tea0water/kata-benchmark --- tensorflow/kata-benchmark/files/cpu-test.sh | 1 + .../kata-benchmark/files/data/10-mynet.conf | 16 ++ .../kata-benchmark/files/data/config.toml | 9 + .../kata-benchmark/files/data/crictl.yaml | 4 + .../kata-benchmark/files/example-pod.json | 18 ++ .../files/fio-rand-128k-read.fio | 16 ++ .../files/fio-rand-128k-write.fio | 16 ++ .../kata-benchmark/files/fio-rand-4k-read.fio | 16 ++ .../files/fio-rand-4k-write.fio | 16 ++ .../kata-benchmark/files/iperf-container.yaml | 12 ++ tensorflow/kata-benchmark/files/mem-test.sh | 1 + .../kata-benchmark/files/nginx-container.json | 8 + .../kata-benchmark/files/redis-container.yaml | 10 + .../files/scripts/fio-benchmark-docker.sh | 178 ++++++++++++++++++ .../files/scripts/fio-benchmark.sh | 74 ++++++++ .../kata-benchmark/files/scripts/install.sh | 8 + .../kata-benchmark/files/scripts/setup.sh | 138 ++++++++++++++ .../files/scripts/setup_kubecon.sh | 139 ++++++++++++++ tensorflow/kata-benchmark/files/test/test.txt | 0 .../files/ubuntu-container.json | 18 ++ 20 files changed, 698 insertions(+) create mode 100755 tensorflow/kata-benchmark/files/cpu-test.sh create mode 100644 tensorflow/kata-benchmark/files/data/10-mynet.conf create mode 100644 tensorflow/kata-benchmark/files/data/config.toml create mode 100644 tensorflow/kata-benchmark/files/data/crictl.yaml create mode 100644 tensorflow/kata-benchmark/files/example-pod.json create mode 100644 tensorflow/kata-benchmark/files/fio-rand-128k-read.fio create mode 100644 tensorflow/kata-benchmark/files/fio-rand-128k-write.fio create mode 100644 tensorflow/kata-benchmark/files/fio-rand-4k-read.fio create mode 100644 tensorflow/kata-benchmark/files/fio-rand-4k-write.fio create mode 100644 tensorflow/kata-benchmark/files/iperf-container.yaml create mode 100755 tensorflow/kata-benchmark/files/mem-test.sh create mode 100644 tensorflow/kata-benchmark/files/nginx-container.json create mode 100644 tensorflow/kata-benchmark/files/redis-container.yaml create mode 100755 tensorflow/kata-benchmark/files/scripts/fio-benchmark-docker.sh create mode 100755 tensorflow/kata-benchmark/files/scripts/fio-benchmark.sh create mode 100755 tensorflow/kata-benchmark/files/scripts/install.sh create mode 100755 tensorflow/kata-benchmark/files/scripts/setup.sh create mode 100755 tensorflow/kata-benchmark/files/scripts/setup_kubecon.sh delete mode 100644 tensorflow/kata-benchmark/files/test/test.txt create mode 100644 tensorflow/kata-benchmark/files/ubuntu-container.json diff --git a/tensorflow/kata-benchmark/files/cpu-test.sh b/tensorflow/kata-benchmark/files/cpu-test.sh new file mode 100755 index 0000000..8d5254a --- /dev/null +++ b/tensorflow/kata-benchmark/files/cpu-test.sh @@ -0,0 +1 @@ +for i in `seq 1 5`; do echo "==========test num $i========"; sysbench cpu --events=20000 run; done diff --git a/tensorflow/kata-benchmark/files/data/10-mynet.conf b/tensorflow/kata-benchmark/files/data/10-mynet.conf new file mode 100644 index 0000000..ec3ee12 --- /dev/null +++ b/tensorflow/kata-benchmark/files/data/10-mynet.conf @@ -0,0 +1,16 @@ +{ + "cniVersion": "0.2.0", + "name": "mynet", + "type": "bridge", + "bridge": "cni0", + "isGateway": true, + "ipMasq": true, + "ipam": { + "type": "host-local", + "subnet": "172.19.0.0/24", + "routes": [ + { "dst": "0.0.0.0/0" } + ] + } +} + diff --git a/tensorflow/kata-benchmark/files/data/config.toml b/tensorflow/kata-benchmark/files/data/config.toml new file mode 100644 index 0000000..f6835a3 --- /dev/null +++ b/tensorflow/kata-benchmark/files/data/config.toml @@ -0,0 +1,9 @@ +[plugins] + [plugins.cri] + sandbox_image = "mirrorgooglecontainers/pause-amd64:3.1" + [plugins.cri.containerd] + [plugins.cri.containerd.default_runtime] + runtime_type = "io.containerd.kata.v2" +[plugins.cri.cni] + # conf_dir is the directory in which the admin places a CNI conf. + conf_dir = "/etc/cni/net.d" diff --git a/tensorflow/kata-benchmark/files/data/crictl.yaml b/tensorflow/kata-benchmark/files/data/crictl.yaml new file mode 100644 index 0000000..acb8231 --- /dev/null +++ b/tensorflow/kata-benchmark/files/data/crictl.yaml @@ -0,0 +1,4 @@ +runtime-endpoint: unix:///var/run/containerd/containerd.sock +image-endpoint: unix:///var/run/containerd/containerd.sock +timeout: 10 +debug: true diff --git a/tensorflow/kata-benchmark/files/example-pod.json b/tensorflow/kata-benchmark/files/example-pod.json new file mode 100644 index 0000000..50238a2 --- /dev/null +++ b/tensorflow/kata-benchmark/files/example-pod.json @@ -0,0 +1,18 @@ +{ + "metadata": { + "name": "podsandbox", + "attempt": 1 + }, + "port_mappings": [ + { + "protocol": 0, + "container_port": 80, + "host_port": 8080 + }, + { + "protocol": 0, + "container_port": 5001, + "host_port": 5001 + } + ] +} diff --git a/tensorflow/kata-benchmark/files/fio-rand-128k-read.fio b/tensorflow/kata-benchmark/files/fio-rand-128k-read.fio new file mode 100644 index 0000000..0931846 --- /dev/null +++ b/tensorflow/kata-benchmark/files/fio-rand-128k-read.fio @@ -0,0 +1,16 @@ +; fio-rand-read.job for fiotest + +[global] +name=fio-rand-read +filename=/root/kata-benchmark/mnt/fio-rand-read +rw=randread +bs=128K +direct=1 +numjobs=8 +time_based=1 +runtime=900 + +[file1] +size=10G +ioengine=libaio +iodepth=16 diff --git a/tensorflow/kata-benchmark/files/fio-rand-128k-write.fio b/tensorflow/kata-benchmark/files/fio-rand-128k-write.fio new file mode 100644 index 0000000..9d5b0b1 --- /dev/null +++ b/tensorflow/kata-benchmark/files/fio-rand-128k-write.fio @@ -0,0 +1,16 @@ +; fio-rand-write.job for fiotest + +[global] +name=fio-rand-write +filename=/root/kata-benchmark/mnt/fio-rand-write +rw=randwrite +bs=128K +direct=1 +numjobs=8 +time_based=1 +runtime=900 + +[file1] +size=10G +ioengine=libaio +iodepth=16 diff --git a/tensorflow/kata-benchmark/files/fio-rand-4k-read.fio b/tensorflow/kata-benchmark/files/fio-rand-4k-read.fio new file mode 100644 index 0000000..11805de --- /dev/null +++ b/tensorflow/kata-benchmark/files/fio-rand-4k-read.fio @@ -0,0 +1,16 @@ +; fio-rand-read.job for fiotest + +[global] +name=fio-rand-read +filename=/root/kata-benchmark/mnt/fio-rand-read +rw=randread +bs=4K +numjobs=1 +direct=1 +time_based=1 +runtime=900 + +[file1] +size=10G +ioengine=libaio +iodepth=16 diff --git a/tensorflow/kata-benchmark/files/fio-rand-4k-write.fio b/tensorflow/kata-benchmark/files/fio-rand-4k-write.fio new file mode 100644 index 0000000..acb90b1 --- /dev/null +++ b/tensorflow/kata-benchmark/files/fio-rand-4k-write.fio @@ -0,0 +1,16 @@ +; fio-rand-write.job for fiotest + +[global] +name=fio-rand-write +filename=/root/kata-benchmark/mnt/fio-rand-write +rw=randwrite +bs=4K +direct=1 +numjobs=8 +time_based=1 +runtime=900 + +[file1] +size=10G +ioengine=libaio +iodepth=16 diff --git a/tensorflow/kata-benchmark/files/iperf-container.yaml b/tensorflow/kata-benchmark/files/iperf-container.yaml new file mode 100644 index 0000000..3b3714d --- /dev/null +++ b/tensorflow/kata-benchmark/files/iperf-container.yaml @@ -0,0 +1,12 @@ +{ + "metadata": { + "name": "iperf" + }, + "image":{ + "image": "mlabbe/iperf" + }, + "port_mappings": [{ + "container_port":80, + "host_port": 8080 + }] +} diff --git a/tensorflow/kata-benchmark/files/mem-test.sh b/tensorflow/kata-benchmark/files/mem-test.sh new file mode 100755 index 0000000..4c8beda --- /dev/null +++ b/tensorflow/kata-benchmark/files/mem-test.sh @@ -0,0 +1 @@ +for i in `seq 1 5`; do echo "==========test num $i========"; sysbench memory --memory-access-mode=rnd run; done diff --git a/tensorflow/kata-benchmark/files/nginx-container.json b/tensorflow/kata-benchmark/files/nginx-container.json new file mode 100644 index 0000000..38d803a --- /dev/null +++ b/tensorflow/kata-benchmark/files/nginx-container.json @@ -0,0 +1,8 @@ +{ + "metadata": { + "name": "nginx" + }, + "image":{ + "image": "fupanli/nginx-benchmark" + } +} diff --git a/tensorflow/kata-benchmark/files/redis-container.yaml b/tensorflow/kata-benchmark/files/redis-container.yaml new file mode 100644 index 0000000..bb4f985 --- /dev/null +++ b/tensorflow/kata-benchmark/files/redis-container.yaml @@ -0,0 +1,10 @@ +{ + "metadata": { + "name": "redis" + }, + "image":{ + "image": "docker.io/library/redis:latest" + }, + "linux": { + } +} diff --git a/tensorflow/kata-benchmark/files/scripts/fio-benchmark-docker.sh b/tensorflow/kata-benchmark/files/scripts/fio-benchmark-docker.sh new file mode 100755 index 0000000..260cbaa --- /dev/null +++ b/tensorflow/kata-benchmark/files/scripts/fio-benchmark-docker.sh @@ -0,0 +1,178 @@ +#!/bin/bash +ID="" +JOBS=1 +RUNTIME="runc" +KVM=0 +HOST=0 +scriptDir=`dirname $0` +scriptDir=`realpath $scriptDir` +prjDir="$scriptDir/../" +if [ ! -d $prjDir/fioLogs ]; then + mkdir $prjDir/fioLogs +fi + +VOLUME=$prjDir + +cleanup(){ + if [ "$ID" != "" ]; then + sudo docker stop $ID + fi + systemctl stop docker +} + +usage(){ + echo "Usage: $0 -j -r -k" + echo "runtime type can be kata, runsc or runc" + echo "runc will be the fefault choice" + echo "-k" is used to enable kvm for runsc. + echo "-v" is used to add volume + exit 0 +} + +if [ "X$1" == "X" ]; then + usage +fi + +while getopts "j:r:v:kh" arg #选项后面的冒号表示该选项需要参数 +do + case $arg in + j) + JOBS=$OPTARG + ;; + r) + RUNTIME=$OPTARG + ;; + v) + VOLUME=$OPTARG + ;; + k) + KVM=1 + ;; + h) + HOST=1 + ;; + ?) #当有不认识的选项的时候arg为? + echo "unkonw argument" + exit 1 + ;; + esac +done + +if [ "$RUNTIME" != "kata-runtime" -a "$RUNTIME" != "runsc" -a "$RUNTIME" != "runc" ]; then + echo "Error: runtime type isn't supported" + usage +fi + +if [ $KVM == 1 ]; then + +cat >/etc/docker/daemon.json </etc/docker/daemon.json </dev/null 2>&1 & + +sudo crictl pull ubuntu:latest + +pod=`sudo crictl runp example-pod.json` + +if [ "$pod" == "" ]; then + echo "Error: failed to start pod" + cleanup + exit 1 +fi + +c=`sudo crictl create $pod ubuntu-container.json example-pod.json` +if [ "$c" == "" ]; then + echo "Error: failed to create container" + cleanup + exit 1 +fi + +sudo crictl start $c +if [ $? != 0 ]; then + echo "Start container $c failed" + cleanup + exit 1 +fi + +scriptDir=`dirname $0` +scriptDir=`realpath $scriptDir` +if [ ! -d $scriptDir/../fioLogs ]; then + mkdir $scriptDir/../fioLogs +fi + +sed -i "s/^numjobs=.*$/numjobs=$threads/" $scriptDir/../fio-rand-4k-read.fio +sed -i "s/^numjobs=.*$/numjobs=$threads/" $scriptDir/../fio-rand-4k-write.fio +sed -i "s/^numjobs=.*$/numjobs=$threads/" $scriptDir/../fio-rand-128k-read.fio +sed -i "s/^numjobs=.*$/numjobs=$threads/" $scriptDir/../fio-rand-128k-write.fio + +sudo crictl exec -ti $c apt-get update +sudo crictl exec -ti $c apt-get install fio -y +sudo crictl exec -ti $c fio --output=/test/fioLogs/fio-4k-read.log /test/fio-rand-4k-read.fio +sudo crictl exec -ti $c fio --output=/test/fioLogs/fio-4k-write.log /test/fio-rand-4k-write.fio +sudo crictl exec -ti $c fio --output=/test/fioLogs/fio-128k-read.log /test/fio-rand-128k-read.fio +sudo crictl exec -ti $c fio --output=/test/fioLogs/fio-128k-write.log /test/fio-rand-128k-write.fio + +cleanup diff --git a/tensorflow/kata-benchmark/files/scripts/install.sh b/tensorflow/kata-benchmark/files/scripts/install.sh new file mode 100755 index 0000000..221f73a --- /dev/null +++ b/tensorflow/kata-benchmark/files/scripts/install.sh @@ -0,0 +1,8 @@ +#!/bin/bash +curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - +cat < /etc/apt/sources.list.d/kubernetes.list +deb http://apt.kubernetes.io/ kubernetes-xenial main +EOF +apt-get update +apt-get install -y docker.io kubeadm + diff --git a/tensorflow/kata-benchmark/files/scripts/setup.sh b/tensorflow/kata-benchmark/files/scripts/setup.sh new file mode 100755 index 0000000..e010dac --- /dev/null +++ b/tensorflow/kata-benchmark/files/scripts/setup.sh @@ -0,0 +1,138 @@ +#!/bin/bash + +if [ -z "$GOPATH" ]; then + export GOPATH=/root/go +fi + +install_kata(){ + ARCH=$(arch) + sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/katacontainers:/releases:/${ARCH}:/master/xUbuntu_$(lsb_release -rs)/ /' > /etc/apt/sources.list.d/kata-containers.list" + curl -sL http://download.opensuse.org/repositories/home:/katacontainers:/releases:/${ARCH}:/master/xUbuntu_$(lsb_release -rs)/Release.key | sudo apt-key add - + sudo -E apt-get update + sudo -E apt-get -y install kata-runtime kata-proxy kata-shim +} + +install_docker(){ + sudo -E apt-get -y install apt-transport-https ca-certificates software-properties-common + curl -sL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - + arch=$(dpkg --print-architecture) + sudo -E add-apt-repository "deb [arch=${arch}] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" + sudo -E apt-get update + sudo -E apt-get -y install docker-ce +} + +install_essential(){ + sudo apt-get update + sudo apt-get install wget golang-1.10-go libseccomp-dev btrfs-tools git -y +} + +install_shimv2(){ + go get github.com/kata-containers/runtime + pushd $GOPATH/src/github.com/kata-containers/runtime + git remote add hyper https://github.com/hyperhq/kata-runtime + git fetch hyper + git checkout -b shimv2 hyper/shimv2 + make + sudo -E PATH=$PATH make install + popd + + sed -i 's/image =/#image =/' /usr/share/defaults/kata-containers/configuration.toml +} + +install_containerd(){ + go get github.com/containerd/containerd + pushd $GOPATH/src/github.com/containerd/containerd + make + sudo -E PATH=$PATH make install + popd +} + +install_cni(){ + go get github.com/containernetworking/plugins + pushd $GOPATH/src/github.com/containernetworking/plugins + ./build.sh + mkdir /opt/cni + cp -r bin /opt/cni/ + popd +} + +install_cri(){ + go get github.com/kubernetes-incubator/cri-tools + pushd $GOPATH/src/github.com/kubernetes-incubator/cri-tools + make + make install + popd +} + +install_gvisor(){ + wget https://storage.googleapis.com/gvisor/releases/nightly/latest/runsc + chmod +x runsc + sudo mv runsc /usr/local/bin/ +} + +export PATH=$PATH:/usr/lib/go-1.10/bin + +install_essential || +if [ $? != 0 ]; then + echo "Error: Installing the essential pkgs failed." + exit 1 +fi + +install_kata +if [ $? != 0 ]; then + echo "Error: installing kata failed" + exit 1 +fi + +install_containerd +if [ $? != 0 ]; then + echo "Error: installing containerd failed" + exit 1 +fi + +install_cni +if [ $? != 0 ]; then + echo "Error: installing cni failed" + exit 1 +fi + +install_shimv2 +if [ $? != 0 ]; then + echo "Error: installing shimv2 failed" + exit 1 +fi + +install_cri +if [ $? != 0 ]; then + echo "Error: installing cri failed" + exit 1 +fi + +install_docker +if [ $? != 0 ]; then + echo "Error: installing docker failed" + exit 1 +fi + +install_gvisor +if [ $? != 0 ]; then + echo "Error: installing gvisor failed" + exit 1 +fi + +scripDir=`dirname $0` +scripDir=`realpath $scripDir` +prjDir=`dirname $scripDir` +dataDir="$prjDir/data" + +echo "Deploy the containerd configure file" +sudo mkdir /etc/containerd/ +cp $dataDir/config.toml /etc/containerd/ + +echo "Deploy cni configure file" +sudo mkdir -p /etc/cni/net.d +sudo cp $dataDir/10-mynet.conf /etc/cni/net.d/ + +echo "Deploy crictl configure file" +sudo cp $dataDir/crictl.yaml /etc/ + diff --git a/tensorflow/kata-benchmark/files/scripts/setup_kubecon.sh b/tensorflow/kata-benchmark/files/scripts/setup_kubecon.sh new file mode 100755 index 0000000..e31502f --- /dev/null +++ b/tensorflow/kata-benchmark/files/scripts/setup_kubecon.sh @@ -0,0 +1,139 @@ +#!/bin/bash + +if [ -z "$GOPATH" ]; then + export GOPATH=/root/go +fi + +install_kata(){ + ARCH=$(arch) + sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/katacontainers:/releases:/${ARCH}:/master/xUbuntu_$(lsb_release -rs)/ /' > /etc/apt/sources.list.d/kata-containers.list" + curl -sL http://download.opensuse.org/repositories/home:/katacontainers:/releases:/${ARCH}:/master/xUbuntu_$(lsb_release -rs)/Release.key | sudo apt-key add - + sudo -E apt-get update + sudo -E apt-get -y install kata-runtime kata-proxy kata-shim +} + +install_docker(){ + sudo -E apt-get -y install apt-transport-https ca-certificates software-properties-common + curl -sL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - + arch=$(dpkg --print-architecture) + sudo -E add-apt-repository "deb [arch=${arch}] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" + sudo -E apt-get update + sudo -E apt-get -y install docker-ce +} + +install_essential(){ + sudo apt-get update + sudo apt-get install wget golang-1.10-go libseccomp-dev btrfs-tools git -y +} + +install_shimv2(){ + go get github.com/kata-containers/runtime + pushd $GOPATH/src/github.com/kata-containers/runtime + git remote add hyper https://github.com/hyperhq/kata-runtime + git fetch hyper + git checkout -b shimv2 hyper/shimv2 + make + sudo -E PATH=$PATH make install + popd + + sed -i 's/image =/#image =/' /usr/share/defaults/kata-containers/configuration.toml +} + +install_containerd(){ + go get github.com/containerd/containerd + pushd $GOPATH/src/github.com/containerd/containerd + make + sudo -E PATH=$PATH make install + popd +} + +install_cni(){ + go get github.com/containernetworking/plugins + pushd $GOPATH/src/github.com/containernetworking/plugins + ./build.sh + mkdir /opt/cni + cp -r bin /opt/cni/ + popd +} + +install_cri(){ + go get github.com/kubernetes-incubator/cri-tools + pushd $GOPATH/src/github.com/kubernetes-incubator/cri-tools + make + make install + popd +} + +install_gvisor(){ + wget https://storage.googleapis.com/gvisor/releases/nightly/latest/runsc + chmod +x runsc + sudo mv runsc /usr/local/bin/ +} + +export PATH=$PATH:/usr/lib/go-1.10/bin + +install_essential || +if [ $? != 0 ]; then + echo "Error: Installing the essential pkgs failed." + exit 1 +fi + +install_kata +if [ $? != 0 ]; then + echo "Error: installing kata failed" + exit 1 +fi + +install_containerd +if [ $? != 0 ]; then + echo "Error: installing containerd failed" + exit 1 +fi + +#install_cni +#if [ $? != 0 ]; then +# echo "Error: installing cni failed" +# exit 1 +#fi + +install_shimv2 +if [ $? != 0 ]; then + echo "Error: installing shimv2 failed" + exit 1 +fi + +install_cri +if [ $? != 0 ]; then + echo "Error: installing cri failed" + exit 1 +fi + +#install_docker +#if [ $? != 0 ]; then +# echo "Error: installing docker failed" +# exit 1 +#fi + +#install_gvisor +#if [ $? != 0 ]; then +# echo "Error: installing gvisor failed" +# exit 1 +#fi + +scripDir=`dirname $0` +scripDir=`realpath $scripDir` +prjDir=`dirname $scripDir` +dataDir="$prjDir/data" + +echo "Deploy the containerd configure file" +sudo mkdir /etc/containerd/ +cp $dataDir/config.toml /etc/containerd/ + +#echo "Deploy cni configure file" +#sudo mkdir -p /etc/cni/net.d +#sudo cp $dataDir/10-mynet.conf /etc/cni/net.d/ +# + +echo "Deploy crictl configure file" +sudo cp $dataDir/crictl.yaml /etc/ + diff --git a/tensorflow/kata-benchmark/files/test/test.txt b/tensorflow/kata-benchmark/files/test/test.txt deleted file mode 100644 index e69de29..0000000 diff --git a/tensorflow/kata-benchmark/files/ubuntu-container.json b/tensorflow/kata-benchmark/files/ubuntu-container.json new file mode 100644 index 0000000..00132bb --- /dev/null +++ b/tensorflow/kata-benchmark/files/ubuntu-container.json @@ -0,0 +1,18 @@ +{ + "metadata": { + "name": "ubuntu" + }, + "image":{ + "image": "ubuntu" + }, + "port_mappings": [{ + "container_port":80, + "host_port": 8080 + }], + "mounts": [ + { + "container_path": "/test", + "host_path": "/root/kata-benchmark" + } + ] +}