Skip to content

Commit

Permalink
server: add handler for dumping out eds (envoyproxy#11577)
Browse files Browse the repository at this point in the history
/config_dump API now supports dumping out EDS while using parameter ?include_eds
Add help method dumpEndpointConfigs() to dump out EDS in /config_dump by calling this method in the handler handlerConfigDump()
This will dump out envoy::admin::v3::EndpointsConfigDump by generating envoy::config::endpoint::v3::ClusterLoadAssignment based on data stored in server_.clusterManager().clusters()

Missing Field:

- ClusterLoadAssignment
  - Policy
    - endpoint_stale_after
- StaticEndpointConfig
  - last_updated
- DynamicEndpointConfig
  - version_info
  - last_updated

Risk Level: Medium
Testing: add unit test, integration test
Docs Changes: operations_admin_interface
Release Notes: N/A

Part of fixing envoyproxy#3362

Signed-off-by: Yutong Li <[email protected]>
  • Loading branch information
Rainton authored and songhu committed Jun 25, 2020
1 parent 5066846 commit 7009f49
Show file tree
Hide file tree
Showing 11 changed files with 559 additions and 33 deletions.
13 changes: 7 additions & 6 deletions api/envoy/admin/v3/config_dump.proto
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ message ConfigDump {
//
// * *bootstrap*: :ref:`BootstrapConfigDump <envoy_api_msg_admin.v3.BootstrapConfigDump>`
// * *clusters*: :ref:`ClustersConfigDump <envoy_api_msg_admin.v3.ClustersConfigDump>`
// * *endpoints*: :ref:`EndpointsConfigDump <envoy_api_msg_admin.v3.EndpointsConfigDump>`
// * *listeners*: :ref:`ListenersConfigDump <envoy_api_msg_admin.v3.ListenersConfigDump>`
// * *routes*: :ref:`RoutesConfigDump <envoy_api_msg_admin.v3.RoutesConfigDump>`
// [#not-implemented-hide:] * *endpoints*: :ref:`EndpointsConfigDump <envoy_api_msg_admin.v3.EndpointsConfigDump>`
//
// EDS Configuration will only be dumped by using parameter `?include_eds`
//
// You can filter output with the resource and mask query parameters.
// See :ref:`/config_dump?resource={} <operations_admin_interface_config_dump_by_resource>`,
Expand Down Expand Up @@ -348,29 +350,28 @@ message SecretsConfigDump {
repeated DynamicSecret dynamic_warming_secrets = 3;
}

// [#not-implemented-hide:]
// Envoy's EDS implementation *will* fill this message with all currently known endpoints. Endpoint
// Envoy's admin fill this message with all currently known endpoints. Endpoint
// configuration information can be used to recreate an Envoy configuration by populating all
// endpoints as static endpoints or by returning them in an EDS response.
message EndpointsConfigDump {
message StaticEndpointConfig {
// The endpoint config.
google.protobuf.Any endpoint_config = 1;

// The timestamp when the Endpoint was last updated.
// [#not-implemented-hide:] The timestamp when the Endpoint was last updated.
google.protobuf.Timestamp last_updated = 2;
}

message DynamicEndpointConfig {
// This is the per-resource version information. This version is currently taken from the
// [#not-implemented-hide:] This is the per-resource version information. This version is currently taken from the
// :ref:`version_info <envoy_api_field_service.discovery.v3.DiscoveryResponse.version_info>` field at the time that
// the endpoint configuration was loaded.
string version_info = 1;

// The endpoint config.
google.protobuf.Any endpoint_config = 2;

// The timestamp when the Endpoint was last updated.
// [#not-implemented-hide:] The timestamp when the Endpoint was last updated.
google.protobuf.Timestamp last_updated = 3;
}

Expand Down
13 changes: 7 additions & 6 deletions api/envoy/admin/v4alpha/config_dump.proto
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ message ConfigDump {
//
// * *bootstrap*: :ref:`BootstrapConfigDump <envoy_api_msg_admin.v4alpha.BootstrapConfigDump>`
// * *clusters*: :ref:`ClustersConfigDump <envoy_api_msg_admin.v4alpha.ClustersConfigDump>`
// * *endpoints*: :ref:`EndpointsConfigDump <envoy_api_msg_admin.v4alpha.EndpointsConfigDump>`
// * *listeners*: :ref:`ListenersConfigDump <envoy_api_msg_admin.v4alpha.ListenersConfigDump>`
// * *routes*: :ref:`RoutesConfigDump <envoy_api_msg_admin.v4alpha.RoutesConfigDump>`
// [#not-implemented-hide:] * *endpoints*: :ref:`EndpointsConfigDump <envoy_api_msg_admin.v4alpha.EndpointsConfigDump>`
//
// EDS Configuration will only be dumped by using parameter `?include_eds`
//
// You can filter output with the resource and mask query parameters.
// See :ref:`/config_dump?resource={} <operations_admin_interface_config_dump_by_resource>`,
Expand Down Expand Up @@ -342,8 +344,7 @@ message SecretsConfigDump {
repeated DynamicSecret dynamic_warming_secrets = 3;
}

// [#not-implemented-hide:]
// Envoy's EDS implementation *will* fill this message with all currently known endpoints. Endpoint
// Envoy's admin fill this message with all currently known endpoints. Endpoint
// configuration information can be used to recreate an Envoy configuration by populating all
// endpoints as static endpoints or by returning them in an EDS response.
message EndpointsConfigDump {
Expand All @@ -356,23 +357,23 @@ message EndpointsConfigDump {
// The endpoint config.
google.protobuf.Any endpoint_config = 1;

// The timestamp when the Endpoint was last updated.
// [#not-implemented-hide:] The timestamp when the Endpoint was last updated.
google.protobuf.Timestamp last_updated = 2;
}

message DynamicEndpointConfig {
option (udpa.annotations.versioning).previous_message_type =
"envoy.admin.v3.EndpointsConfigDump.DynamicEndpointConfig";

// This is the per-resource version information. This version is currently taken from the
// [#not-implemented-hide:] This is the per-resource version information. This version is currently taken from the
// :ref:`version_info <envoy_api_field_service.discovery.v3.DiscoveryResponse.version_info>` field at the time that
// the endpoint configuration was loaded.
string version_info = 1;

// The endpoint config.
google.protobuf.Any endpoint_config = 2;

// The timestamp when the Endpoint was last updated.
// [#not-implemented-hide:] The timestamp when the Endpoint was last updated.
google.protobuf.Timestamp last_updated = 3;
}

Expand Down
7 changes: 7 additions & 0 deletions docs/root/operations/admin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ modify different aspects of the server:
The underlying proto is marked v2alpha and hence its contents, including the JSON representation,
are not guaranteed to be stable.

.. _operations_admin_interface_config_dump_include_eds:

.. http:get:: /config_dump?include_eds
Dump currently loaded configuration including EDS. See the :ref:`response definition <envoy_v3_api_msg_admin.v3.EndpointsConfigDump>` for more
information.

.. _operations_admin_interface_config_dump_by_mask:

.. http:get:: /config_dump?mask={}
Expand Down
1 change: 1 addition & 0 deletions docs/root/version_history/current.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ New Features
* access loggers: extened specifier for FilterStateFormatter to output :ref:`unstructured log string <config_access_log_format_filter_state>`.
* access loggers: file access logger config added :ref:`log_format <envoy_v3_api_field_extensions.access_loggers.file.v3.FileAccessLog.log_format>`.
* access loggers: gRPC access logger config added added :ref:`API version <envoy_v3_api_field_extensions.access_loggers.grpc.v3.CommonGrpcAccessLogConfig.transport_api_version>` to explicitly set the version of gRPC service endpoint and message to be used.
* admin: added support for dumping EDS config at :ref:`/config_dump?include_eds <operations_admin_interface_config_dump_include_eds>`.
* aggregate cluster: make route :ref:`retry_priority <envoy_v3_api_field_config.route.v3.RetryPolicy.retry_priority>` predicates work with :ref:`this cluster type <envoy_v3_api_msg_extensions.clusters.aggregate.v3.ClusterConfig>`.
* build: official released binary is now built on Ubuntu 18.04, requires glibc >= 2.27.
* build: official released binary is now built with Clang 10.0.0.
Expand Down
13 changes: 7 additions & 6 deletions generated_api_shadow/envoy/admin/v3/config_dump.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions generated_api_shadow/envoy/admin/v4alpha/config_dump.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions source/server/admin/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ envoy_cc_library(
"//source/extensions/access_loggers/file:file_access_log_lib",
"@envoy_api//envoy/admin/v3:pkg_cc_proto",
"@envoy_api//envoy/config/core/v3:pkg_cc_proto",
"@envoy_api//envoy/config/endpoint/v3:pkg_cc_proto",
"@envoy_api//envoy/config/route/v3:pkg_cc_proto",
"@envoy_api//envoy/extensions/filters/network/http_connection_manager/v3:pkg_cc_proto",
],
Expand Down
Loading

0 comments on commit 7009f49

Please sign in to comment.