- Set up a local vagrant VM Environment once and run E2E tests on local machine, so you can test and debug locally.
- No need to worry about kubernetes cluster setup.
-
Set up Istio Dev environment using https://github.com/istio/istio/wiki/Dev-Guide.
-
Install
- virtual box - Verify
virtualbox
command opens up a virtual box window - docker - Verify
docker version
returns version >= 18.03.0-ce - vagrant - Verify
vagrant -v
returns version >= Vagrant 2.0.3 - kubectl - Verify
kubectl version
returns both server and client versions - curl - Verify
curl --help
prints the help information.
You can run the following script to check/install of all pre-requisites, or use it as a reference to install them manually. (This requires installation of Homebrew on macOS or debian based Linux distributions)
sh install_prereqs.sh
sh setup_vm.sh
sh setup_host.sh
MacOS ONLY Set up docker daemon in Docker UI.
- Open Docker and go to Preferences
- Click on the Daemon tag
- Add
10.10.0.2:5000
to the "Insecure registries" - Click the
Apply and Start
button in the bottom to restart Docker with the new setting
Push images from your local dev environment to the local registry on vagrant vm:
sh setup_test.sh
You should push new images whenever you modify istio source code.
You can issue test commands on your host machine. E.g.
cd $ISTIO/istio
make e2e_simple E2E_ARGS="--use_local_cluster" HUB=10.10.0.2:5000 TAG=latest
Note the special arguments like E2E_ARGS, HUB, and TAG. They are required to run these tests with the local cluster and a local registry inside the VM. And you can run multiple E2E tests sequentially against the same VM.
You can also ssh to VM and issue test commands within the VM. E.g.
cd $ISTIO/istio/vagrant-kubernetes-istio
vagrant ssh
# Inside VM
cd $ISTIO/istio
make e2e_simple E2E_ARGS="--use_local_cluster"
You can try debugging Istio with debugger tool. vm_setup.sh already installs Delve into VM for us. To use Delve, we need process id of the binary we want to debug. For example, if you want to debug a test, run that test in your host/vm.
# In the VM/Host
make e2e_simple E2E_ARGS="--use_local_cluster --skip_cleanup" HUB=10.10.0.2:5000 TAG=latest
Now, find the pid of the process say pilot-discovery that you want to debug.
vagrant ssh
ps -ef | grep pilot-discovery
Then, you can run Delve
sudo -E env "PATH=$PATH" dlv attach <pid of pilot-discovery>
For more information, please check Debug an Istio container with Delve
To save the vagrant VM status:
vagrant halt
To destroy the VM:
vagrant destroy
To cleanup host settings only (restore kubectl and remove docker daemon setup)
sh cleanup_host.sh
MacOS ONLY
- Open Docker and go to Preferences
- Click on the Daemon tag
- Remove
10.10.0.2:5000
from the "Insecure registries" - Click the
Apply and Start
button in the bottom to restart Docker with the new setting
Please refer Troubleshooting doc for information on this.
Please refer Tips doc for some suggestions that we have found useful for debugging with e2e tests.