From 609cd4dfcfabe16da3c23ba46baa1cc6b0ec1e7b Mon Sep 17 00:00:00 2001 From: Victor Morales Date: Tue, 8 Nov 2022 21:00:11 -0800 Subject: [PATCH] Add documentation for install.sh Signed-off-by: Victor Morales --- Makefile | 4 ++-- Vagrantfile | 18 +++++++++++++++++- scripts/README.md | 30 ++++++++++++++++++++++++++++++ scripts/install.sh | 11 +++++++---- 4 files changed, 56 insertions(+), 7 deletions(-) create mode 100644 scripts/README.md diff --git a/Makefile b/Makefile index c1ad1c1..4d7a44e 100644 --- a/Makefile +++ b/Makefile @@ -14,8 +14,8 @@ DOCKER_CMD ?= $(shell which docker 2> /dev/null || which podman 2> /dev/null || lint: sudo -E $(DOCKER_CMD) run --rm -v $$(pwd):/tmp/lint \ -e RUN_LOCAL=true \ - -e LINTER_RULES_PATH=/ \ - -e VALIDATE_KUBERNETES_KUBEVAL=false \ + -e LINTER_RULES_PATH=.github/linters \ + -e KUBERNETES_KUBEVAL_OPTIONS=--ignore-missing-schemas \ github/super-linter .PHONY: fmt diff --git a/Vagrantfile b/Vagrantfile index 8248a6f..8f74162 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -36,7 +36,23 @@ Vagrant.configure('2') do |config| config.vm.box_check_update = false config.vm.synced_folder './', '/vagrant' - config.vm.provision 'shell', privileged: false, path: './scripts/install.sh', reset: true + config.vm.provision 'shell', privileged: false do |sh| + sh.env = { + DEBUG: ENV.fetch('DEBUG', true) + } + sh.inline = <<-SHELL + set -o errexit + set -o pipefail + + if [ -f /etc/netplan/01-netcfg.yaml ]; then + sudo sed -i "s/addresses: .*/addresses: [1.1.1.1, 8.8.8.8, 8.8.4.4]/g" /etc/netplan/01-netcfg.yaml + sudo netplan apply + fi + + cd /vagrant/scripts + ./install.sh | tee ~/install.log + SHELL + end %i[virtualbox libvirt].each do |provider| config.vm.provider provider do |p| diff --git a/scripts/README.md b/scripts/README.md new file mode 100644 index 0000000..c80308d --- /dev/null +++ b/scripts/README.md @@ -0,0 +1,30 @@ +# install.sh + +This bash script installs the following dependencies required for the creation +of a multi-cluster environment. + +- [KinD](https://kind.sigs.k8s.io/) +- [kubectl](https://kubernetes.io/docs/reference/kubectl/kubectl/) +- [Docker](https://www.docker.com/) +- [kpt](https://kpt.dev/) + +The following diagram shows the result after its execution. + +```text ++---------------------------------+ +---------------------------------+ +---------------------------------+ +---------------------------------+ +| nephio (k8s) | | regional (k8s) | | edge-1 (k8s) | | edge-2 (k8s) | +| +-----------------------------+ | | +-----------------------------+ | | +-----------------------------+ | | +-----------------------------+ | +| | nephio-control-plane | | | | regional-control-plane | | | | edge-1-control-plane | | | | edge-2-control-plane | | +| | podSubnet: 10.196.0.0/16 | | | | podSubnet: 10.197.0.0/16 | | | | podSubnet: 10.198.0.0/16 | | | | podSubnet: 10.199.0.0/16 | | +| | serviceSubnet: 10.96.0.0/16 | | | | serviceSubnet: 10.97.0.0/16 | | | | serviceSubnet: 10.98.0.0/16 | | | | serviceSubnet: 10.99.0.0/16 | | +| +-----------------------------+ | | +-----------------------------+ | | +-----------------------------+ | | +-----------------------------+ | +| | eth0(172.88.0.2/16) | | | | eth0(172.89.0.2/16) | | | | eth0(172.90.0.2/16) | | | | eth0(172.91.0.2/16) | | +| +-----------------------------+ | | +-----------------------------+ | | +-----------------------------+ | | +-----------------------------+ | +| | | | | | | | ++--------------+------------------+ +--------------+------------------+ +--------------+------------------+ +--------------+------------------+ + | | | | + +=========+============+ +=========+============+ +=========+===========+ +=========+===========+ + | net-nephio(bridge) | | net-regional(bridge) | | net-edge-1(bridge) | | net-edge-2(bridge) | + | 172.88.0.0/16 | | 172.89.0.0/16 | | 172.90.0.0/16 | | 172.91.0.0/16 | + +======================+ +======================+ +=====================+ +=====================+ +``` diff --git a/scripts/install.sh b/scripts/install.sh index 1ab0d87..df0e3c3 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -17,6 +17,9 @@ if [[ ${DEBUG:-false} == "true" ]]; then fi export PKG_KREW_PLUGINS_LIST=" " +export PKG_KIND_VERSION=0.17.0 +export PKG_KUBECTL_VERSION=1.25.3 +KPT_VERSION=1.0.0-beta.23 declare -A clusters clusters=( @@ -31,10 +34,9 @@ clusters=( curl -fsSL http://bit.ly/install_pkg | PKG_COMMANDS_LIST="kind,docker,kubectl" bash if ! command -v kpt; then - curl -s 'https://i.jpillora.com/GoogleContainerTools/kpt@v1.0.0-beta.23!' | bash + curl -s "https://i.jpillora.com/GoogleContainerTools/kpt@v$KPT_VERSION!" | bash kpt completion bash | sudo tee /etc/bash_completion.d/kpt >/dev/null fi -exit function deploy_k8s_cluster { local name="$1" @@ -43,9 +45,9 @@ function deploy_k8s_cluster { local svc_subnet="$4" newgrp docker <