You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.3 KiB

  1. # use virtualenv to install all python requirements
  2. VENVDIR=venv
  3. python3 -m venv $VENVDIR
  4. source $VENVDIR/bin/activate
  5. pip install --upgrade pip
  6. pip install wheel
  7. pip install --upgrade setuptools
  8. pip install -r requirements.txt
  9. pip install -r tests/requirements.txt
  10. pre-commit install
  11. # prepare an inventory to test with
  12. INV=inventory/lab
  13. rm -rf ${INV}.bak &> /dev/null
  14. mv ${INV} ${INV}.bak &> /dev/null
  15. cp -a inventory/sample ${INV}
  16. rm -f ${INV}/hosts.ini
  17. # customize the vagrant environment
  18. mkdir vagrant
  19. cat << EOF > vagrant/config.rb
  20. \$instance_name_prefix = kub"
  21. \$vm_cpus = 2
  22. \$num_instances = 3
  23. \$os = "almalinux8"
  24. \$subnet = "192.168.56"
  25. \$network_plugin = "calico"
  26. \$inventory = "$INV"
  27. \$shared_folders = { 'temp/docker_rpms' => "/var/cache/yum/x86_64/7/docker-ce/packages" }
  28. EOF
  29. # make the rpm cache
  30. mkdir -p temp/docker_rpms
  31. vagrant up
  32. # make a copy of the downloaded docker rpm, to speed up the next provisioning run
  33. scp kub-1:/var/cache/yum/x86_64/7/docker-ce/packages/* temp/docker_rpms/
  34. # copy kubectl access configuration in place
  35. mkdir $HOME/.kube/ &> /dev/null
  36. ln -s $PWD/$INV/artifacts/admin.conf $HOME/.kube/config
  37. # make the kubectl binary available
  38. sudo ln -s $PWD/$INV/artifacts/kubectl /usr/local/bin/kubectl
  39. #or
  40. export PATH=$PATH:$PWD/$INV/artifacts