-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This adds a --mode command-line flag. --mode=serve is the default and can be omitted; in that mode Envoy runs as it always has. With --mode=validate Envoy checks that the configuration file in --config-file is valid, then exits. "Valid" means that it performs the JSON schema check as usual, but also initializes as much of its internal state as possible, exiting with any errors as it would under --mode=serve. When initialization is complete, instead of listening for traffic, Envoy prints an "OK" message to stderr and exits, returning success. In validation mode, to the extent possible, Envoy avoids interfering with its environment. For example, the hot-restart process is skipped, so validation can safely be run on the same machine as a serving Envoy. Validation mode also doesn't send any upstream traffic or open any listeners. It does attempt to read any files referenced in the config, like certs and private keys, so validation will fail if those files aren't located at the expected paths. A future "lite validation" mode, that mocks out the filesystem as well as the network, is not yet implemented as of this patch.
- Loading branch information
Showing
47 changed files
with
1,092 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
licenses(["notice"]) # Apache 2 | ||
|
||
load("//bazel:envoy_build_system.bzl", "envoy_cc_library", "envoy_package") | ||
|
||
envoy_package() | ||
|
||
envoy_cc_library( | ||
name = "api_lib", | ||
srcs = ["api.cc"], | ||
hdrs = ["api.h"], | ||
deps = [ | ||
":dispatcher_lib", | ||
"//include/envoy/api:api_interface", | ||
"//include/envoy/filesystem:filesystem_interface", | ||
"//source/common/api:api_lib", | ||
], | ||
) | ||
|
||
envoy_cc_library( | ||
name = "async_client_lib", | ||
srcs = ["async_client.cc"], | ||
hdrs = ["async_client.h"], | ||
deps = [ | ||
"//include/envoy/http:async_client_interface", | ||
"//include/envoy/http:message_interface", | ||
], | ||
) | ||
|
||
envoy_cc_library( | ||
name = "cluster_manager_lib", | ||
srcs = ["cluster_manager.cc"], | ||
hdrs = ["cluster_manager.h"], | ||
deps = [ | ||
":async_client_lib", | ||
"//include/envoy/upstream:cluster_manager_interface", | ||
"//source/common/upstream:cluster_manager_lib", | ||
], | ||
) | ||
|
||
envoy_cc_library( | ||
name = "connection_handler_lib", | ||
srcs = ["connection_handler.cc"], | ||
hdrs = ["connection_handler.h"], | ||
deps = [ | ||
"//include/envoy/api:api_interface", | ||
"//include/envoy/network:connection_handler_interface", | ||
"//include/envoy/network:filter_interface", | ||
"//include/envoy/network:listen_socket_interface", | ||
"//source/common/common:assert_lib", | ||
], | ||
) | ||
|
||
envoy_cc_library( | ||
name = "dispatcher_lib", | ||
srcs = ["dispatcher.cc"], | ||
hdrs = ["dispatcher.h"], | ||
deps = [ | ||
"//include/envoy/event:dispatcher_interface", | ||
"//source/common/common:assert_lib", | ||
"//source/common/event:dispatcher_lib", | ||
], | ||
) | ||
|
||
envoy_cc_library( | ||
name = "dns_lib", | ||
srcs = ["dns.cc"], | ||
hdrs = ["dns.h"], | ||
deps = [ | ||
"//include/envoy/event:dispatcher_interface", | ||
"//include/envoy/network:dns_interface", | ||
], | ||
) | ||
|
||
envoy_cc_library( | ||
name = "server_lib", | ||
srcs = ["server.cc"], | ||
hdrs = ["server.h"], | ||
deps = [ | ||
":api_lib", | ||
":cluster_manager_lib", | ||
":connection_handler_lib", | ||
":dns_lib", | ||
"//include/envoy/common:optional", | ||
"//include/envoy/server:drain_manager_interface", | ||
"//include/envoy/server:instance_interface", | ||
"//include/envoy/ssl:context_manager_interface", | ||
"//include/envoy/tracing:http_tracer_interface", | ||
"//source/common/access_log:access_log_manager_lib", | ||
"//source/common/common:assert_lib", | ||
"//source/common/runtime:runtime_lib", | ||
"//source/common/ssl:context_lib", | ||
"//source/common/stats:stats_lib", | ||
"//source/common/thread_local:thread_local_lib", | ||
"//source/server:configuration_lib", | ||
"//source/server:server_lib", | ||
"//source/server/http:admin_lib", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include "server/config_validation/api.h" | ||
|
||
#include "server/config_validation/dispatcher.h" | ||
|
||
namespace Envoy { | ||
namespace Api { | ||
|
||
ValidationImpl::ValidationImpl(std::chrono::milliseconds file_flush_interval_msec) | ||
: Impl(file_flush_interval_msec) {} | ||
|
||
Event::DispatcherPtr ValidationImpl::allocateDispatcher() { | ||
return Event::DispatcherPtr{new Event::ValidationDispatcher()}; | ||
} | ||
|
||
} // Api | ||
} // Envoy |
Oops, something went wrong.