Envoy Filter Example

repository·main·Indexed 18 days ago

https://github.com/envoyproxy/envoy-filter-example

A demonstration project for linking custom network filters into the Envoy binary by building a custom static Envoy executable. It features the echo2 filter as a functional example and provides instructions for building with Bazel and running integration tests.

Tokens
352
Snippets
2
Records
3
Agent score
13%

What's inside envoy-filter-example

  1. How custom filter linking works in Envoy

    main

    This project demonstrates how to link additional filters into the Envoy binary by creating a new static binary target.

    1. Submodule Integration: The main Envoy repository is included as a git submodule.
    2. Workspace Mapping: The WORKSPACE file maps the @envoy repository to the local submodule path.
    3. Binary Construction: The BUILD file defines a new target (//:envoy) that links the custom filter (e.g., echo2) with the standard Envoy main entry library (@envoy//source/exe:envoy_main_entry_lib).
    4. Registration: The custom filter registers itself during the static initialization phase of the Envoy binary, making it available for use in Envoy configurations.
  2. Run Envoy integration tests

    main

    You can run specific integration tests for the echo2 filter or run the standard Envoy test suite from within this project using Bazel.

    # Run the echo2 integration test
    bazel test //:echo2_integration_test
    
    # Run the regular Envoy tests
    bazel test @envoy//test/...