diff --git a/Makefile b/Makefile index 863693db..30226c80 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,9 @@ SANITIZE += -fno-omit-frame-pointer ## CFLAGS CFLAGS += -I. CFLAGS += -Ilib/usr/include +ifeq (${ARCH},aarch64) + CFLAGS += -I/usr/include/tirpc +endif CFLAGS += -g -O3 -DDEBUG -Llib CFLAGS += -std=c11 CFLAGS += -D_POSIX_C_SOURCE @@ -61,12 +64,19 @@ LDFLAGS += -l:libbpf.a LDFLAGS += -l:libelf.a LDFLAGS += -lz LDFLAGS += -lnsl +ifeq (${ARCH},aarch64) + LDFLAGS += -ltirpc +endif LDFLAGS += -static-liblsan LDFLAGS += -static-libubsan $(info LDFLAGS=$(LDFLAGS)) LLC=llc-7 -march=bpf -filetype=obj CLANG=clang-7 +ifeq (${ARCH},aarch64) + LLC=llc -march=bpf -filetype=obj + CLANG=clang +endif CLANGFLAGS= -I.\ -Wno-unused-value -Wno-pointer-sign\ -Wno-compare-distinct-pointer-types \ diff --git a/bootstrap.sh b/bootstrap.sh index a445cec0..c4961b64 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -21,6 +21,9 @@ # THE USE OR OTHER DEALINGS IN THE SOFTWARE. logout_needed=false +cpu_arch="amd64" +clang_pkg="clang-7" +llvm_pkg="llvm-7" function install-dev-packages { echo "" @@ -28,13 +31,18 @@ function install-dev-packages { sudo apt-get update -y sudo apt-get install -y \ build-essential \ - clang-7 \ - llvm-7 \ libelf-dev \ libcmocka-dev \ lcov \ scapy \ pkg-config + sudo apt-get install -y \ + ${llvm_pkg} \ + ${clang_pkg} + if [[ "$(arch)" == "aarch64" ]]; then + sudo apt-get install -y \ + libtirpc-dev + fi } function install-python { @@ -66,9 +74,9 @@ function install-python-ubuntu-18 { function install-go-for-mizar { echo "" echo "Installing go 1.13.9 ..." - wget -O /tmp/go1.13.9.linux-amd64.tar.gz https://dl.google.com/go/go1.13.9.linux-amd64.tar.gz - sudo tar -C /usr/local -xzf /tmp/go1.13.9.linux-amd64.tar.gz - rm -rf /tmp/go1.13.9.linux-amd64.tar.gz + wget -O /tmp/go1.13.9.linux-${cpu_arch}.tar.gz https://dl.google.com/go/go1.13.9.linux-${cpu_arch}.tar.gz + sudo tar -C /usr/local -xzf /tmp/go1.13.9.linux-${cpu_arch}.tar.gz + rm -rf /tmp/go1.13.9.linux-${cpu_arch}.tar.gz export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin cat ~/.profile | grep "PATH" | egrep "/usr/local/go/bin" if [ $? -ne 0 ]; then @@ -97,7 +105,7 @@ function install-docker { function install-kubectl { echo "" echo "Installing kubectl ..." - curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl" + curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/${cpu_arch}/kubectl" chmod +x ./kubectl sudo mv ./kubectl /usr/local/bin/kubectl } @@ -107,7 +115,7 @@ function install-kind { echo "Installing kind ..." pushd /tmp ver=$(curl -s https://api.github.com/repos/kubernetes-sigs/kind/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")') - curl -Lo kind "https://github.com/kubernetes-sigs/kind/releases/download/$ver/kind-$(uname)-amd64" + curl -Lo kind "https://github.com/kubernetes-sigs/kind/releases/download/$ver/kind-$(uname)-${cpu_arch}" chmod +x kind sudo mv kind /usr/local/bin popd @@ -128,62 +136,80 @@ function install-protobuf-and-pip-deps { } # Main bootstrap script -tput setaf 1 -echo "NOTE: This script will reboot the system if you opt to allow kernel update." -echo " If reboot is not required, it will log you out and require re-login for new permissions to take effect." -echo "" -read -n 1 -s -r -p "Press Ctrl-c to quit, any key to continue..." -tput sgr0 -echo " " - -# Install dev packages -install-dev-packages - -# Install python -install-python -cat /etc/os-release | grep VERSION_ID | grep "18.04" -if [ $? -eq 0 ]; then - install-python-ubuntu-18 -fi +function main { + tput setaf 1 + echo "NOTE: This script will reboot the system if you opt to allow kernel update." + echo " If reboot is not required, it will log you out and require re-login for new permissions to take effect." + echo "" + read -n 1 -s -r -p "Press Ctrl-c to quit, any key to continue..." + tput sgr0 + echo " " + + # Install dev packages + install-dev-packages + + # Install python + install-python + cat /etc/os-release | grep VERSION_ID | grep "18.04" + if [ $? -eq 0 ]; then + install-python-ubuntu-18 + fi -# Install go -which go -if [ $? -ne 0 ]; then - install-go-for-mizar -else - go_ver=$(go version | go version | awk '{print $3}') - if [[ "${go_ver}" != "go1.13.9" ]]; then + # Install go + which go + if [ $? -ne 0 ]; then install-go-for-mizar + else + go_ver=$(go version | go version | awk '{print $3}') + if [[ "${go_ver}" != "go1.13.9" ]]; then + install-go-for-mizar + fi fi -fi -# Install docker -which docker -if [ $? -ne 0 ]; then - install-docker -fi + # Install docker + which docker + if [ $? -ne 0 ]; then + install-docker + fi -# Install kind -which kind -if [ $? -ne 0 ]; then - install-kind -fi + # Install kind + which kind + if [ $? -ne 0 ]; then + install-kind + fi -# Install kubectl -which kubectl -if [ $? -ne 0 ]; then - install-kubectl -fi + # Install kubectl + which kubectl + if [ $? -ne 0 ]; then + install-kubectl + fi -git submodule update --init --recursive + git submodule update --init --recursive -# Install protobuf dependecies -install-protobuf-and-pip-deps + # Install protobuf dependecies + install-protobuf-and-pip-deps -# Install kernel needed for Mizar (if required) -source ${PWD}/kernelupdate.sh + # Install kernel needed for Mizar (if required) + source ${PWD}/kernelupdate.sh -if [ "$logout_needed" = true ]; then - PPPID=$(awk '{print $4}' "/proc/$PPID/stat") - kill $PPPID + if [ "$logout_needed" = true ]; then + PPPID=$(awk '{print $4}' "/proc/$PPID/stat") + kill $PPPID + fi +} + +if [[ "$(arch)" == "x86_64" ]]; then + main +elif [[ "$(arch)" == "aarch64" ]]; then + cat /etc/os-release | grep VERSION_ID | grep "2[1-9].04" + if [ $? -eq 0 ]; then + cpu_arch="arm64" + llvm_pkg="llvm" + clang_pkg="clang" + main + else + echo "CPU architecture $(arch) not supported below Ubuntu 22.04" + fi +else + echo "CPU architecture $(arch) not supported." fi diff --git a/kernelupdate.sh b/kernelupdate.sh index 39926a72..354bb823 100755 --- a/kernelupdate.sh +++ b/kernelupdate.sh @@ -70,4 +70,8 @@ function check-and-install-mizar-kernel { } # Main -check-and-install-mizar-kernel +if [[ "$(arch)" == "x86_64" ]]; then + check-and-install-mizar-kernel +else + echo "CPU architecture $(arch) not supported." +fi diff --git a/replace-containerd.sh b/replace-containerd.sh index 5f2863e7..08260af4 100644 --- a/replace-containerd.sh +++ b/replace-containerd.sh @@ -20,11 +20,19 @@ # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR # THE USE OR OTHER DEALINGS IN THE SOFTWARE. -cd $HOME/go/src/k8s.io/arktos -wget -qO- https://github.com/CentaurusInfra/containerd/releases/download/tenant-cni-args/containerd.zip | zcat > /tmp/containerd -sudo chmod +x /tmp/containerd -sudo systemctl stop containerd -sudo mv /usr/bin/containerd /usr/bin/containerd.bak -sudo mv /tmp/containerd /usr/bin/ -sudo systemctl restart containerd -sudo systemctl restart docker +function main { + cd $HOME/go/src/k8s.io/arktos + wget -qO- https://github.com/CentaurusInfra/containerd/releases/download/tenant-cni-args/containerd.zip | zcat > /tmp/containerd + sudo chmod +x /tmp/containerd + sudo systemctl stop containerd + sudo mv /usr/bin/containerd /usr/bin/containerd.bak + sudo mv /tmp/containerd /usr/bin/ + sudo systemctl restart containerd + sudo systemctl restart docker +} + +if [[ "$(arch)" == "x86_64" ]]; then + main +else + echo "CPU architecture $(arch) not supported." +fi diff --git a/setup-machine-arktos.sh b/setup-machine-arktos.sh index 100446df..31a43541 100644 --- a/setup-machine-arktos.sh +++ b/setup-machine-arktos.sh @@ -20,235 +20,244 @@ # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR # THE USE OR OTHER DEALINGS IN THE SOFTWARE. -#################### -echo Setup: Install go \(currently limited to version 1.13.9\) +function main { + #################### -sudo apt-get update -y -q -sudo apt-get install build-essential -y -q -sudo apt-get install zlib1g-dev -y -q -sudo apt-get install libreadline-gplv2-dev -y -q -sudo apt-get install libncursesw5-dev -y -q -sudo apt-get install libssl-dev -y -q -sudo apt-get install libnss3-dev -y -q -sudo apt-get install libsqlite3-dev -y -q -sudo apt-get install tk-dev -y -q -sudo apt-get install libgdbm-dev -y -q -sudo apt-get install libc6-dev -y -q -sudo apt-get install libbz2-dev -y -q -sudo apt-get install libreadline-dev -y -q -sudo apt-get install libffi-dev -y -q + echo Setup: Install go \(currently limited to version 1.13.9\) -wget -O /tmp/go1.13.9.linux-amd64.tar.gz https://dl.google.com/go/go1.13.9.linux-amd64.tar.gz -sudo tar -C /usr/local -xzf /tmp/go1.13.9.linux-amd64.tar.gz -rm -rf /tmp/go1.13.9.linux-amd64.tar.gz + sudo apt-get update -y -q + sudo apt-get install build-essential -y -q + sudo apt-get install zlib1g-dev -y -q + sudo apt-get install libreadline-gplv2-dev -y -q + sudo apt-get install libncursesw5-dev -y -q + sudo apt-get install libssl-dev -y -q + sudo apt-get install libnss3-dev -y -q + sudo apt-get install libsqlite3-dev -y -q + sudo apt-get install tk-dev -y -q + sudo apt-get install libgdbm-dev -y -q + sudo apt-get install libc6-dev -y -q + sudo apt-get install libbz2-dev -y -q + sudo apt-get install libreadline-dev -y -q + sudo apt-get install libffi-dev -y -q -#################### + wget -O /tmp/go1.13.9.linux-amd64.tar.gz https://dl.google.com/go/go1.13.9.linux-amd64.tar.gz + sudo tar -C /usr/local -xzf /tmp/go1.13.9.linux-amd64.tar.gz + rm -rf /tmp/go1.13.9.linux-amd64.tar.gz -echo Setup: Install bazel + #################### -sudo apt install g++ unzip zip -y -q -sudo apt-get install openjdk-8-jdk -y -q -wget -O /tmp/bazel-0.26.1-installer-linux-x86_64.sh https://github.com/bazelbuild/bazel/releases/download/0.26.1/bazel-0.26.1-installer-linux-x86_64.sh -chmod +x /tmp/bazel-0.26.1-installer-linux-x86_64.sh -/tmp/bazel-0.26.1-installer-linux-x86_64.sh --user + echo Setup: Install bazel -#################### + sudo apt install g++ unzip zip -y -q + sudo apt-get install openjdk-8-jdk -y -q + wget -O /tmp/bazel-0.26.1-installer-linux-x86_64.sh https://github.com/bazelbuild/bazel/releases/download/0.26.1/bazel-0.26.1-installer-linux-x86_64.sh + chmod +x /tmp/bazel-0.26.1-installer-linux-x86_64.sh + /tmp/bazel-0.26.1-installer-linux-x86_64.sh --user -echo Setup: Enlist arktos + #################### -cd ~ -git clone https://github.com/CentaurusInfra/arktos.git ~/go/src/k8s.io/arktos -cd ~/go/src/k8s.io -ln -s ./arktos kubernetes + echo Setup: Enlist arktos -git config --global credential.helper 'cache --timeout=3600000' + cd ~ + git clone https://github.com/CentaurusInfra/arktos.git ~/go/src/k8s.io/arktos + cd ~/go/src/k8s.io + ln -s ./arktos kubernetes -#################### + git config --global credential.helper 'cache --timeout=3600000' -echo Setup: Install etcd + #################### -cd ~/go/src/k8s.io/arktos/ -git tag v1.15.0 -./hack/install-etcd.sh - -#################### - -echo Setup: Install Docker - -sudo apt -y install docker.io -sudo gpasswd -a $USER docker + echo Setup: Install etcd -#################### + cd ~/go/src/k8s.io/arktos/ + git tag v1.15.0 + ./hack/install-etcd.sh -echo Setup: Install crictl + #################### + + echo Setup: Install Docker + + sudo apt -y install docker.io + sudo gpasswd -a $USER docker -wget -O /tmp/crictl-v1.17.0-linux-amd64.tar.gz https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.17.0/crictl-v1.17.0-linux-amd64.tar.gz -sudo tar -zxvf /tmp/crictl-v1.17.0-linux-amd64.tar.gz -C /usr/local/bin -rm -f /tmp/crictl-v1.17.0-linux-amd64.tar.gz + #################### -touch /tmp/crictl.yaml -echo runtime-endpoint: unix:///run/containerd/containerd.sock >> /tmp/crictl.yaml -echo image-endpoint: unix:///run/containerd/containerd.sock >> /tmp/crictl.yaml -echo timeout: 10 >> /tmp/crictl.yaml -echo debug: true >> /tmp/crictl.yaml -sudo mv /tmp/crictl.yaml /etc/crictl.yaml + echo Setup: Install crictl -sudo mkdir -p /etc/containerd -sudo rm -rf /etc/containerd/config.toml -sudo containerd config default > /tmp/config.toml -sudo mv /tmp/config.toml /etc/containerd/config.toml -sudo systemctl restart containerd - -#################### - -echo Setup: Install miscellaneous - -wget -O $HOME/Python-3.8.8.tgz https://www.python.org/ftp/python/3.8.8/Python-3.8.8.tgz -tar -C $HOME -xzf $HOME/Python-3.8.8.tgz -cd $HOME/Python-3.8.8 -sudo ./configure --enable-optimizations -sudo make -sudo make altinstall -sudo ln -sfn /usr/local/bin/python3.8 /usr/bin/python3 -sudo apt remove -fy python3-apt -sudo apt install -fy python3-apt -sudo apt update -sudo apt install -fy python3-pip - -sudo sed -i '1c\#!/usr/bin/python3.6 -Es' /usr/bin/lsb_release -sudo /usr/local/bin/python3.8 -m pip install --upgrade pip + wget -O /tmp/crictl-v1.17.0-linux-amd64.tar.gz https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.17.0/crictl-v1.17.0-linux-amd64.tar.gz + sudo tar -zxvf /tmp/crictl-v1.17.0-linux-amd64.tar.gz -C /usr/local/bin + rm -f /tmp/crictl-v1.17.0-linux-amd64.tar.gz -sudo apt install awscli -y -q -sudo apt install jq -y -q + touch /tmp/crictl.yaml + echo runtime-endpoint: unix:///run/containerd/containerd.sock >> /tmp/crictl.yaml + echo image-endpoint: unix:///run/containerd/containerd.sock >> /tmp/crictl.yaml + echo timeout: 10 >> /tmp/crictl.yaml + echo debug: true >> /tmp/crictl.yaml + sudo mv /tmp/crictl.yaml /etc/crictl.yaml -sudo rm -rf $HOME/Python-3.8.8.tgz -sudo rm -rf $HOME/Python-3.8.8 - -#################### + sudo mkdir -p /etc/containerd + sudo rm -rf /etc/containerd/config.toml + sudo containerd config default > /tmp/config.toml + sudo mv /tmp/config.toml /etc/containerd/config.toml + sudo systemctl restart containerd + + #################### + + echo Setup: Install miscellaneous + + wget -O $HOME/Python-3.8.8.tgz https://www.python.org/ftp/python/3.8.8/Python-3.8.8.tgz + tar -C $HOME -xzf $HOME/Python-3.8.8.tgz + cd $HOME/Python-3.8.8 + sudo ./configure --enable-optimizations + sudo make + sudo make altinstall + sudo ln -sfn /usr/local/bin/python3.8 /usr/bin/python3 + sudo apt remove -fy python3-apt + sudo apt install -fy python3-apt + sudo apt update + sudo apt install -fy python3-pip + + sudo sed -i '1c\#!/usr/bin/python3.6 -Es' /usr/bin/lsb_release + sudo /usr/local/bin/python3.8 -m pip install --upgrade pip -echo Setup: Mizar Related + sudo apt install awscli -y -q + sudo apt install jq -y -q -cd ~/mizar -sudo apt-get update -sudo apt-get install -y \ - build-essential clang-7 llvm-7 \ - libelf-dev \ - python3 \ - python3-pip \ - libcmocka-dev \ - lcov \ - protobuf-compiler \ - libprotobuf-dev -sudo python3 -m pip install --upgrade pip + sudo rm -rf $HOME/Python-3.8.8.tgz + sudo rm -rf $HOME/Python-3.8.8 + + #################### -GO111MODULE="on" go get google.golang.org/protobuf/cmd/protoc-gen-go@v1.26 -GO111MODULE="on" go get google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1 + echo Setup: Mizar Related -sudo pip3 install netaddr docker scapy -sudo systemctl unmask docker.service -sudo systemctl unmask docker.socket -sudo systemctl start docker -sudo systemctl enable docker + cd ~/mizar + sudo apt-get update + sudo apt-get install -y \ + build-essential clang-7 llvm-7 \ + libelf-dev \ + python3 \ + python3-pip \ + libcmocka-dev \ + lcov \ + protobuf-compiler \ + libprotobuf-dev + sudo python3 -m pip install --upgrade pip -sudo docker build -f ./test/Dockerfile -t buildbox:v2 ./test + GO111MODULE="on" go get google.golang.org/protobuf/cmd/protoc-gen-go@v1.26 + GO111MODULE="on" go get google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1 -git submodule update --init --recursive + sudo pip3 install netaddr docker scapy + sudo systemctl unmask docker.service + sudo systemctl unmask docker.socket + sudo systemctl start docker + sudo systemctl enable docker -ver=$(curl -s https://api.github.com/repos/kubernetes-sigs/kind/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")') -curl -Lo kind https://github.com/kubernetes-sigs/kind/releases/download/$ver/kind-$(uname)-amd64 -chmod +x kind -sudo mv kind /usr/local/bin + sudo docker build -f ./test/Dockerfile -t buildbox:v2 ./test -curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl -chmod +x ./kubectl -sudo mv ./kubectl /usr/local/bin/kubectl + git submodule update --init --recursive -sudo pip3 install fs -sudo pip3 install protobuf -sudo pip3 install grpcio -sudo pip3 install grpcio-tools -sudo pip3 install luigi==2.8.12 -sudo pip3 install kubernetes==11.0.0 -sudo pip3 install rpyc -sudo pip3 install pyroute2 -sudo pip3 install ipaddress -sudo pip3 install netaddr -sudo pip3 install kopf -sudo pip3 install PyYAML - -##################### - -echo Setup: Install Containerd - -cd $HOME -wget https://github.com/containerd/containerd/releases/download/v1.4.2/containerd-1.4.2-linux-amd64.tar.gz -cd /usr -sudo tar -xvf $HOME/containerd-1.4.2-linux-amd64.tar.gz -sudo rm -rf $HOME/containerd-1.4.2-linux-amd64.tar.gz - -#################### - -echo Setup: Setup profile - -echo PATH=\"\$HOME/go/src/k8s.io/arktos/third_party/etcd:/usr/local/go/bin:\$HOME/go/bin:\$HOME/go/src/k8s.io/arktos/_output/bin:\$HOME/go/src/k8s.io/arktos/_output/dockerized/bin/linux/amd64:\$PATH\" >> ~/.profile -echo GOPATH=\"\$HOME/go\" >> ~/.profile -echo GOROOT=\"/usr/local/go\" >> ~/.profile -echo >> ~/.profile -echo alias arktos=\"cd \$HOME/go/src/k8s.io/arktos\" >> ~/.profile -echo alias k8s=\"cd \$HOME/go/src/k8s.io/kubernetes\" >> ~/.profile -echo alias mizar=\"cd \$HOME/mizar\" >> ~/.profile -echo alias up=\"\$HOME/go/src/k8s.io/arktos/hack/arktos-up.sh\" >> ~/.profile -echo alias status=\"git status\" >> ~/.profile -echo alias pods=\"kubectl get pods -A -o wide\" >> ~/.profile -echo alias nets=\"echo 'kubectl get subnets'\; kubectl get subnets\; echo\; echo 'kubectl get droplets'\; kubectl get droplets\; echo\; echo 'kubectl get bouncers'\; kubectl get bouncers\; echo\; echo 'kubectl get dividers'\; kubectl get dividers\; echo\; echo 'kubectl get vpcs'\; kubectl get vpcs\; echo\; echo 'kubectl get eps'\; kubectl get eps\; echo\; echo 'kubectl get networks'\; kubectl get networks\" >> ~/.profile - -echo alias kubectl=\'$HOME/go/src/k8s.io/arktos/cluster/kubectl.sh\' >> ~/.profile -echo alias kubeop=\"kubectl get pods \|\ grep mizar-operator \|\ awk \'{print \$1}\' \|\ xargs -i kubectl logs {}\" >> ~/.profile -echo alias kubed=\"kubectl get pods \|\ grep mizar-daemon \|\ awk \'{print \$1}\' \|\ xargs -i kubectl logs {}\" >> ~/.profile -echo export CONTAINER_RUNTIME_ENDPOINT=\"\containerRuntime,container,/run/containerd/containerd.sock\" >> ~/.profile -echo export PYTHONPATH=\"\$HOME/mizar/\" >> ~/.profile -echo export KUBECTL_LOG=\"\/tmp/${USER}_kubetctl.err\" >> ~/.profile -echo export GPG_TTY=\$\(tty\) >> ~/.profile - -echo cd \$HOME/go/src/k8s.io/arktos >> ~/.profile - -source "$HOME/.profile" + ver=$(curl -s https://api.github.com/repos/kubernetes-sigs/kind/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")') + curl -Lo kind https://github.com/kubernetes-sigs/kind/releases/download/$ver/kind-$(uname)-amd64 + chmod +x kind + sudo mv kind /usr/local/bin -#################### - -echo Setup: Install Kind + curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl + chmod +x ./kubectl + sudo mv ./kubectl /usr/local/bin/kubectl -cd ~/go/src/ -GO111MODULE="on" go get sigs.k8s.io/kind@v0.7.0 + sudo pip3 install fs + sudo pip3 install protobuf + sudo pip3 install grpcio + sudo pip3 install grpcio-tools + sudo pip3 install luigi==2.8.12 + sudo pip3 install kubernetes==11.0.0 + sudo pip3 install rpyc + sudo pip3 install pyroute2 + sudo pip3 install ipaddress + sudo pip3 install netaddr + sudo pip3 install kopf + sudo pip3 install PyYAML + + ##################### + + echo Setup: Install Containerd + + cd $HOME + wget https://github.com/containerd/containerd/releases/download/v1.4.2/containerd-1.4.2-linux-amd64.tar.gz + cd /usr + sudo tar -xvf $HOME/containerd-1.4.2-linux-amd64.tar.gz + sudo rm -rf $HOME/containerd-1.4.2-linux-amd64.tar.gz + + #################### + + echo Setup: Setup profile + + echo PATH=\"\$HOME/go/src/k8s.io/arktos/third_party/etcd:/usr/local/go/bin:\$HOME/go/bin:\$HOME/go/src/k8s.io/arktos/_output/bin:\$HOME/go/src/k8s.io/arktos/_output/dockerized/bin/linux/amd64:\$PATH\" >> ~/.profile + echo GOPATH=\"\$HOME/go\" >> ~/.profile + echo GOROOT=\"/usr/local/go\" >> ~/.profile + echo >> ~/.profile + echo alias arktos=\"cd \$HOME/go/src/k8s.io/arktos\" >> ~/.profile + echo alias k8s=\"cd \$HOME/go/src/k8s.io/kubernetes\" >> ~/.profile + echo alias mizar=\"cd \$HOME/mizar\" >> ~/.profile + echo alias up=\"\$HOME/go/src/k8s.io/arktos/hack/arktos-up.sh\" >> ~/.profile + echo alias status=\"git status\" >> ~/.profile + echo alias pods=\"kubectl get pods -A -o wide\" >> ~/.profile + echo alias nets=\"echo 'kubectl get subnets'\; kubectl get subnets\; echo\; echo 'kubectl get droplets'\; kubectl get droplets\; echo\; echo 'kubectl get bouncers'\; kubectl get bouncers\; echo\; echo 'kubectl get dividers'\; kubectl get dividers\; echo\; echo 'kubectl get vpcs'\; kubectl get vpcs\; echo\; echo 'kubectl get eps'\; kubectl get eps\; echo\; echo 'kubectl get networks'\; kubectl get networks\" >> ~/.profile + + echo alias kubectl=\'$HOME/go/src/k8s.io/arktos/cluster/kubectl.sh\' >> ~/.profile + echo alias kubeop=\"kubectl get pods \|\ grep mizar-operator \|\ awk \'{print \$1}\' \|\ xargs -i kubectl logs {}\" >> ~/.profile + echo alias kubed=\"kubectl get pods \|\ grep mizar-daemon \|\ awk \'{print \$1}\' \|\ xargs -i kubectl logs {}\" >> ~/.profile + echo export CONTAINER_RUNTIME_ENDPOINT=\"\containerRuntime,container,/run/containerd/containerd.sock\" >> ~/.profile + echo export PYTHONPATH=\"\$HOME/mizar/\" >> ~/.profile + echo export KUBECTL_LOG=\"\/tmp/${USER}_kubetctl.err\" >> ~/.profile + echo export GPG_TTY=\$\(tty\) >> ~/.profile + + echo cd \$HOME/go/src/k8s.io/arktos >> ~/.profile + + source "$HOME/.profile" + + #################### + + echo Setup: Install Kind + + cd ~/go/src/ + GO111MODULE="on" go get sigs.k8s.io/kind@v0.7.0 + + #################### + + echo Setup: Install kubetest + + cd ~/go/src/k8s.io + git clone https://github.com/kubernetes/test-infra.git + cd ~/go/src/k8s.io/test-infra/ + GO111MODULE=on go install ./kubetest + GO111MODULE=on go mod vendor + + #################### + + echo Setup: Basic settings + + sudo systemctl stop ufw + sudo systemctl disable ufw + sudo swapoff -a + sudo sed -i '/swap/s/^/#/g' /etc/fstab + sudo partprobe + IP_ADDR=$(hostname -I | awk '{print $1}') + HOSTNAME=$(hostname) + sudo sed -i '2s/.*/'$IP_ADDR' '$HOSTNAME'/' /etc/hosts + sudo rm -f /etc/resolv.conf + sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf + + ##################### -#################### - -echo Setup: Install kubetest - -cd ~/go/src/k8s.io -git clone https://github.com/kubernetes/test-infra.git -cd ~/go/src/k8s.io/test-infra/ -GO111MODULE=on go install ./kubetest -GO111MODULE=on go mod vendor - -#################### - -echo Setup: Basic settings - -sudo systemctl stop ufw -sudo systemctl disable ufw -sudo swapoff -a -sudo sed -i '/swap/s/^/#/g' /etc/fstab -sudo partprobe -IP_ADDR=$(hostname -I | awk '{print $1}') -HOSTNAME=$(hostname) -sudo sed -i '2s/.*/'$IP_ADDR' '$HOSTNAME'/' /etc/hosts -sudo rm -f /etc/resolv.conf -sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf + echo Setup: Machine setup completed! -##################### - -echo Setup: Machine setup completed! - -sudo reboot + sudo reboot +} + +if [[ "$(arch)" == "x86_64" ]]; then + main +else + echo "CPU architecture $(arch) not supported." +fi