From 46140ff41c216933e91b997d35b1e703a5e9b5f4 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Mon, 23 Sep 2019 09:34:19 -0700 Subject: [PATCH] lds: Add HTTP API listener. (#8170) Signed-off-by: Mark D. Roth --- api/envoy/api/v2/BUILD | 2 ++ api/envoy/api/v2/lds.proto | 16 ++++++++++++- api/envoy/config/listener/v2/BUILD | 18 ++++++++++++++ .../config/listener/v2/api_listener.proto | 24 +++++++++++++++++++ 4 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 api/envoy/config/listener/v2/BUILD create mode 100644 api/envoy/config/listener/v2/api_listener.proto diff --git a/api/envoy/api/v2/BUILD b/api/envoy/api/v2/BUILD index 7e6536dc13ab..9bffa27360ee 100644 --- a/api/envoy/api/v2/BUILD +++ b/api/envoy/api/v2/BUILD @@ -27,6 +27,7 @@ api_proto_package( "//envoy/api/v2/listener:pkg", "//envoy/api/v2/ratelimit:pkg", "//envoy/api/v2/route:pkg", + "//envoy/config/listener/v2:pkg", "//envoy/type", ], ) @@ -87,6 +88,7 @@ api_proto_library_internal( "//envoy/api/v2/core:base", "//envoy/api/v2/listener", "//envoy/api/v2/listener:udp_listener_config", + "//envoy/config/listener/v2:api_listener", ], ) diff --git a/api/envoy/api/v2/lds.proto b/api/envoy/api/v2/lds.proto index a26d64cab5b4..58ecc067e47a 100644 --- a/api/envoy/api/v2/lds.proto +++ b/api/envoy/api/v2/lds.proto @@ -13,6 +13,7 @@ import "envoy/api/v2/core/base.proto"; import "envoy/api/v2/discovery.proto"; import "envoy/api/v2/listener/listener.proto"; import "envoy/api/v2/listener/udp_listener_config.proto"; +import "envoy/config/listener/v2/api_listener.proto"; import "google/api/annotations.proto"; import "google/protobuf/duration.proto"; @@ -42,7 +43,7 @@ service ListenerDiscoveryService { } } -// [#comment:next free field: 19] +// [#comment:next free field: 20] message Listener { // The unique name by which this listener is known. If no name is provided, // Envoy will allocate an internal UUID for the listener. If the listener is to be dynamically @@ -200,4 +201,17 @@ message Listener { // ` = "raw_udp_listener" for // creating a packet-oriented UDP listener. If not present, treat it as "raw_udp_listener". listener.UdpListenerConfig udp_listener_config = 18; + + // [#not-implemented-hide:] + // Used to represent an API listener, which is used in non-proxy clients. The type of API + // exposed to the non-proxy application depends on the type of API listener. + // When this field is set, no other field except for :ref:`name` + // should be set. + // [#next-major-version: In the v3 API, instead of this messy approach where the socket + // listener fields are directly in the top-level Listener message and the API listener types + // are in the ApiListener message, the socket listener messages should be in their own message, + // and the top-level Listener should essentially be a oneof that selects between the + // socket listener and the various types of API listener. That way, a given Listener message + // can structurally only contain the fields of the relevant type.] + envoy.config.listener.v2.ApiListener api_listener = 19; } diff --git a/api/envoy/config/listener/v2/BUILD b/api/envoy/config/listener/v2/BUILD new file mode 100644 index 000000000000..031cd7ce37cd --- /dev/null +++ b/api/envoy/config/listener/v2/BUILD @@ -0,0 +1,18 @@ +load("@envoy_api//bazel:api_build_system.bzl", "api_proto_library_internal", "api_proto_package") + +licenses(["notice"]) # Apache 2 + +package_group( + name = "friends", + packages = [ + "//envoy/api/v2", + ], +) + +api_proto_package() + +api_proto_library_internal( + name = "api_listener", + srcs = ["api_listener.proto"], + visibility = [":friends"], +) diff --git a/api/envoy/config/listener/v2/api_listener.proto b/api/envoy/config/listener/v2/api_listener.proto new file mode 100644 index 000000000000..0c2253596e43 --- /dev/null +++ b/api/envoy/config/listener/v2/api_listener.proto @@ -0,0 +1,24 @@ +syntax = "proto3"; + +package envoy.config.listener.v2; + +option java_outer_classname = "ApiListenerProto"; +option java_multiple_files = true; +option java_package = "io.envoyproxy.envoy.config.listener.v2"; + +import "google/protobuf/any.proto"; + +// [#not-implemented-hide:] +// Describes a type of API listener, which is used in non-proxy clients. The type of API +// exposed to the non-proxy application depends on the type of API listener. +message ApiListener { + // The type in this field determines the type of API listener. At present, the following + // types are supported: + // envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager (HTTP) + // [#next-major-version: In the v3 API, replace this Any field with a oneof containing the + // specific config message for each type of API listener. We could not do this in v2 because + // it would have caused circular dependencies for go protos: lds.proto depends on this file, + // and http_connection_manager.proto depends on rds.proto, which is in the same directory as + // lds.proto, so lds.proto cannot depend on this file.] + google.protobuf.Any api_listener = 1; +}