envoyproxy/envoy

Support sanity checking of extension configuration without requiring all dependencies

Open

#15,032 opened on Feb 11, 2021

View on GitHub
 (6 comments) (0 reactions) (1 assignee)C++ (5,373 forks)batch import
area/configurationhelp wanted

Repository metrics

Stars
 (27,997 stars)
PR merge metrics
 (Avg merge 8d) (378 merged PRs in 30d)

Description

I want to deploy my Envoys using my custom FooFilter attached to a static listener. FooFilter has a custom configuration with some fields that must be set, with cross-field dependencies (specifically things that can't be checked using PGV annotations). I want to verify that as I add and remove fields, my checked-in bootstrap configs are still valid.

In a world in which all abstractions are correct, my development environment would perfectly mirror production and there would be no difference in instantiating FooFilter for validation versus execution. This seems like an unreasonable expectation, though, so instead I would like my FooFilter to be able to know somehow whether it should actually expect to find all its dependencies or just sanity check its config to the best of its ability.

Right now, Envoy has a notion of execution versus validation modes, available via Envoy::Server::Options::mode(). Mode::Validate seems closes to what I want. The implicit contract seems to be that if Mode::Validate produces errors, then any other mode will also produce errors (but not the reverse). Extensions have access to information about the current context via the various .*FactoryContext interfaces, but Options is not exposed.

This feature request is two-fold:

  1. make Envoy::Server::Options available to ResourceMonitorFactoryContext and FilterFactoryContext and optionally other factory contexts
  2. clarify the contract between, or at least the documentation of, the various Mode options

Contributor guide