ESPv2 is based on Envoy Proxy and Config Manager. Envoy written in C++ is built using bazel with clang and Config Manager written in go is built using go build.
See the architecture overview before getting started.
View all Prow job statuses on https://testgrid.k8s.io/:
- Periodic jobs from
master
branch once a day - Presubmit jobs, also viewable as PR status
- Postsubmit jobs for ESPv2 release
Prow job configuration is located in oss-test-infra repository.
Prow build
and *-presubmit
jobs use Bazel's RBE Remote Caching.
Remote caching dramatically speeds up job build time for incremental builds.
Sometimes remote caches may get corrupted and jobs are stuck in build phase.
Increment the silo_uuid
in try_setup_bazel_remote_cache()
to force a cache refresh.
A few prow jobs deploy ESPv2 in GCP for full end-to-end tests.
These jobs use GCP project cloudesf-testing
.
There are two ways to setup the development environment for this project: the Docker mode and the native mode. Due to the frequent version changes of software dependecies, it is recommended to setup your dev env in Docker mode. Later, we will walk through how to use Intellij and CLion IDEs for the project.
git clone https://github.com/GoogleCloudPlatform/esp-v2.git
Go to Setup yaml, copy the latest working image link.
For example: gcr.io/cloudesf-testing/gcpproxy-prow:v20240727-v2.46.0-27-g6c21f955-master
Run the following command by replacing the latest_image_link with the link found above.
docker run -ti --privileged -v /var/run/docker.sock:/var/run/docker.sock -v ~/esp-v2:/esp-v2 ${latest_image_link} /bin/bash
cd esp-v2
git config --global --add safe.directory /esp-v2
make depend.install
make build
make build-envoy
Trigger Integration Test (iam_imds_data_path_test)
go test -v -timeout 20m ./tests/integration_test/iam_imds_data_path_test/iam_imds_data_path_test.go --debug_components=envoy --logtostderr
Reference the official golang installation instructions for your OS. The latest go version should work.
Add the following setting in .profile, then source it:
export GOPATH=$HOME/go
export GOBIN=$GOPATH/bin
export PATH=$GOBIN:$PATH
It is recommended to use Bazelisk installed as bazel
to avoid Bazel compatibility issues. Follow the instructions on the linked website to install it.
To get started building Envoy locally, following the instructions from Envoy.
Add the package sources with the following commands. If these commands fail, reference the official clang installation instructions for your OS.
Install the following packages:
sudo apt-get update
sudo apt-get install -y llvm-14-dev libclang-14-dev clang-14 \
clang-tools-14 clang-format-14 xz-utils lld-14
sudo apt install -y cmake ninja-build protobuf-compiler brotli \
libicu-dev libbrotli-dev
sudo apt-get install jq nodejs npm python-is-python3
To download the source code, use go get
:
go get github.com/GoogleCloudPlatform/esp-v2
This will create the following folder structure:
- $HOME/go
- bin
- src
- github.com
- GoogleCloudPlatform
- esp-v2
In order to build Config Manager, need to install its dependent libraries:
make depend.install
make depend.install.endpoints
To build:
# Config Manager
make build
# Envoy
make build-envoy
To run unit tests:
# Config Manager
make test
# Envoy
make test-envoy
To run integration tests:
make integration-test-run-parallel
For the C++ code, we will use CLion with the Blaze / Bazel plugin. Import the project as a Bazel project. CLion should automatically pick up the targets and run configurations.
For the golang code, we will use Intellij Ultimate edition. Import the project as a Git project (do NOT use the Bazel plugin). Intellij will automatically pick up the run configurations.
For both CLion and Intellij, change the blaze plugin to use bazelisk
instead of bazel
for any commands:
- Search for the
Bazel binary location
item in the Intellij Settings - Change it to the output of
which bazelisk
You will need the following tools to run manual e2e tests:
- Docker Engine
gcloud
Alternatively, you can rely on ESPv2 Prow CI/CD to run e2e tests.