admin: expose listener name/address through /listener admin endpoint (#7131)

The current /listeners admin endpoint only returns a JSON-encoded list of addresses/ports. If a listener config binds to port 0, the endpoint will return the port that was assigned, but if there are multiple listeners binding to port 0, there's no way to tell which listener received which port.

This PR adds a proto that contains the listener's name and address. The /listeners endpoint returns this data in both text and JSON format, similar to the /clusters admin endpoint.

Risk Level: Low (according to #6959 the /listeners admin endpoint is only used for testing)

Testing:
I updated integration_admin_test.cc to test the new output formats for the /listeners endpoint.

I also updated the tools/socket_passing.py script that's used for integration/hotrestart_test.

Docs Changes:

new inline docs in listeners.proto
updated the admin menu description of /listeners
Release Notes:
admin: /listener endpoint now returns :ref:listener.proto<api/envoy/admin/v2alpha/listeners.proto>

Fixes #6959

Signed-off-by: Kaisen Chen <kaisen@yelp.com>

Mirrored from https://github.com/envoyproxy/envoy @ 4461f431112876932e0328f6af31de7cf34fadfc
pull/620/head
data-plane-api(CircleCI) 6 years ago
parent f2b62fb83e
commit a83394157a
  1. 1
      docs/BUILD
  2. 9
      envoy/admin/v2alpha/BUILD
  3. 28
      envoy/admin/v2alpha/listeners.proto

@ -15,6 +15,7 @@ proto_library(
"//envoy/admin/v2alpha:certs",
"//envoy/admin/v2alpha:clusters",
"//envoy/admin/v2alpha:config_dump",
"//envoy/admin/v2alpha:listeners",
"//envoy/admin/v2alpha:memory",
"//envoy/admin/v2alpha:mutex_stats",
"//envoy/admin/v2alpha:server_info",

@ -27,6 +27,15 @@ api_proto_library_internal(
],
)
api_proto_library_internal(
name = "listeners",
srcs = ["listeners.proto"],
visibility = ["//visibility:public"],
deps = [
"//envoy/api/v2/core:address",
],
)
api_proto_library_internal(
name = "metrics",
srcs = ["metrics.proto"],

@ -0,0 +1,28 @@
syntax = "proto3";
package envoy.admin.v2alpha;
option java_outer_classname = "ListenersProto";
option java_multiple_files = true;
option java_package = "io.envoyproxy.envoy.admin.v2alpha";
import "envoy/api/v2/core/address.proto";
// [#protodoc-title: Listeners]
// Admin endpoint uses this wrapper for `/listeners` to display listener status information.
// See :ref:`/listeners <operations_admin_interface_listeners>` for more information.
message Listeners {
// List of listener statuses.
repeated ListenerStatus listener_statuses = 1;
}
// Details an individual listener's current status.
message ListenerStatus {
// Name of the listener
string name = 1;
// The actual local address that the listener is listening on. If a listener was configured
// to listen on port 0, then this address has the port that was allocated by the OS.
envoy.api.v2.core.Address local_address = 2;
}
Loading…
Cancel
Save