From 2882535e2918fafe49bbc48e4b07991cdcb551c2 Mon Sep 17 00:00:00 2001 From: Victor Morales Date: Mon, 12 Jun 2023 16:01:06 -0700 Subject: [PATCH 1/2] Enable devcontainers support Signed-off-by: Victor Morales --- .devcontainer.json | 13 +++++++++++++ e2e/provision/README.md | 1 + e2e/provision/install_sandbox.sh | 3 +++ e2e/provision/playbooks/cluster.yml | 4 +++- 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 .devcontainer.json diff --git a/.devcontainer.json b/.devcontainer.json new file mode 100644 index 00000000..78eaecc4 --- /dev/null +++ b/.devcontainer.json @@ -0,0 +1,13 @@ +{ + "image": "mcr.microsoft.com/vscode/devcontainers/base:ubuntu-20.04", + "features": { + "ghcr.io/devcontainers/features/docker-in-docker:1": {}, + "ghcr.io/devcontainers/features/sshd:1": {} + }, + "hostRequirements": { + "cpus": 8, + "memory": "32gb" + }, + "postCreateCommand": "cd e2e/provision/; ./install_sandbox.sh | tee ~/install_sandbox.log", + "forwardPorts": [7007, 3000] +} diff --git a/e2e/provision/README.md b/e2e/provision/README.md index d111cf43..751b8ef4 100644 --- a/e2e/provision/README.md +++ b/e2e/provision/README.md @@ -1,4 +1,5 @@ # Quick Start for GCE and VMs running in other environments +[![Create a Sandbox in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?repo=nephio-project/test-infra) Moved to the docs repository: * [Install diff --git a/e2e/provision/install_sandbox.sh b/e2e/provision/install_sandbox.sh index f69110d9..920f9fa4 100755 --- a/e2e/provision/install_sandbox.sh +++ b/e2e/provision/install_sandbox.sh @@ -87,6 +87,9 @@ if [ "${DEPLOYMENT_TYPE:-r1}" == "one-summit" ]; then done popd >/dev/null else + if [ "${CODESPACE_NAME-}" ] && ! grep -q "ansible_port: 2222" ~/nephio.yaml; then + echo " ansible_port: 2222" >> ~/nephio.yaml + fi # Management cluster creation if [[ ${DEBUG:-false} != "true" ]]; then ansible-playbook -i ./nephio.yaml playbooks/cluster.yml diff --git a/e2e/provision/playbooks/cluster.yml b/e2e/provision/playbooks/cluster.yml index 625ed8ae..81a4606a 100644 --- a/e2e/provision/playbooks/cluster.yml +++ b/e2e/provision/playbooks/cluster.yml @@ -21,7 +21,9 @@ roles: - role: andrewrothstein.docker_engine become: true - when: ( container_engine is not defined ) or ( container_engine == "docker" ) + when: + - ( container_engine is not defined ) or ( container_engine == "docker" ) + - not lookup('ansible.builtin.env', 'CODESPACE_NAME') - role: andrewrothstein.podman when: container_engine == "podman" - andrewrothstein.kind From df801676dd9f7f2bd988bea8c6fd8dd1fbbf24fc Mon Sep 17 00:00:00 2001 From: Victor Morales Date: Tue, 13 Jun 2023 08:10:08 -0700 Subject: [PATCH 2/2] Reduce RAM requirements Signed-off-by: Victor Morales --- .devcontainer.json | 2 +- e2e/provision/Vagrantfile | 2 +- e2e/provision/nephio.yaml | 2 +- e2e/provision/playbooks/roles/bootstrap/defaults/main.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.devcontainer.json b/.devcontainer.json index 78eaecc4..bba425fb 100644 --- a/.devcontainer.json +++ b/.devcontainer.json @@ -6,7 +6,7 @@ }, "hostRequirements": { "cpus": 8, - "memory": "32gb" + "memory": "16gb" }, "postCreateCommand": "cd e2e/provision/; ./install_sandbox.sh | tee ~/install_sandbox.log", "forwardPorts": [7007, 3000] diff --git a/e2e/provision/Vagrantfile b/e2e/provision/Vagrantfile index 77bc45b0..0724ece7 100644 --- a/e2e/provision/Vagrantfile +++ b/e2e/provision/Vagrantfile @@ -55,7 +55,7 @@ Vagrant.configure('2') do |config| %i[virtualbox libvirt].each do |provider| config.vm.provider provider do |p| p.cpus = ENV['CPUS'] || 8 - p.memory = ENV['MEMORY'] || 32 * 1024 + p.memory = ENV['MEMORY'] || 16 * 1024 end end diff --git a/e2e/provision/nephio.yaml b/e2e/provision/nephio.yaml index 826f7337..ec0284a3 100644 --- a/e2e/provision/nephio.yaml +++ b/e2e/provision/nephio.yaml @@ -23,7 +23,7 @@ all: host_os: "linux" # use "darwin" for MacOS X, "windows" for Windows host_arch: "amd64" # other possible values: "386","arm64","arm","ppc64le","s390x" host_min_vcpu: 8 # minimum required vCPUs before install - host_min_cpu_ram: 16 # minimum required CPU RAM before install; value in GB + host_min_cpu_ram: 8 # minimum required CPU RAM before install; value in GB host_min_root_disk_space: 50 # minimum required disk space before install; value in GB tmp_directory: "/tmp" bin_directory: "/usr/local/bin" diff --git a/e2e/provision/playbooks/roles/bootstrap/defaults/main.yml b/e2e/provision/playbooks/roles/bootstrap/defaults/main.yml index 318911b7..679c6d2d 100644 --- a/e2e/provision/playbooks/roles/bootstrap/defaults/main.yml +++ b/e2e/provision/playbooks/roles/bootstrap/defaults/main.yml @@ -9,7 +9,7 @@ ############################################################################## host_min_vcpu: 8 # minimum required vCPUs before install -host_min_cpu_ram: 16 # minimum required CPU RAM before install; value in GB +host_min_cpu_ram: 8 # minimum required CPU RAM before install; value in GB host_min_root_disk_space: 50 # minimum required disk space before install; value in GB container_engine: docker