Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 83 additions & 15 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -133,33 +133,101 @@ def _envoy_api_deps():
api_bind_targets = [
"address",
"base",
"bootstrap",
"discovery",
"cds",
"discovery",
"eds",
"grpc_service",
"health_check",
"lds",
"metrics",
"protocol",
]
for t in api_bind_targets:
native.bind(
name = "envoy_" + t,
actual = "@envoy_api//envoy/api/v2:" + t + "_cc",
)
native.bind(
name = "envoy_bootstrap",
actual = "@envoy_api//envoy/config/bootstrap/v2:bootstrap_cc",
)
native.bind(
name = "envoy_metrics",
actual = "@envoy_api//envoy/service/metrics/v2:metrics_service_cc",
)
native.bind(
name = "envoy_load_stats",
actual = "@envoy_api//envoy/service/load_stats/v2:lrs_cc",
)
native.bind(
name = "envoy_ratelimit",
actual = "@envoy_api//envoy/config/ratelimit/v2:rls_cc",
)
native.bind(
name = "envoy_accesslog",
actual = "@envoy_api//envoy/service/accesslog/v2:als_cc",
)
native.bind(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be happy to clean this up separately to avoid binding so many names...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, yes please

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer not using binds (I think they might be an antipattern as they make working with multiple workspaces difficult). We should use "actual" names, since the path is more or less stable.

@htuch htuch Jan 26, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, yeah, some history here. When we first started to Bazelify Envoy, it was unclear to me how best to handle external deps from a few perspectives:

  • How would we be able to map to prebuilts at Lyft as well as use native Bazel repositories?
  • How would we redirect dependencies when we imported into Google's monorepo.

Bind made sense at that time as an indirection mechanism to provide flexibility.

The prebuilt situation has stabilized and doesn't apply here (we don't prebuild @envoy_api). The import for Google is also now moot. While it's a little neater to rebind, TBH we're sed-ing a ton during the import, so rewriting @envoy_api is trivial.

So, definitely for this dependency, which is now sprawling with binds, let's just switch to direct reference to @envoy_api everywhere.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 if we can just do this now since this is already a giant change and mostly find/replace. I wondered why we did this in the first place, thanks for the explanation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, with a sed swoosh

name = "envoy_config_accesslog",
actual = "@envoy_api//envoy/config/accesslog/v2:als_cc",
)
native.bind(
name = "envoy_stats",
actual = "@envoy_api//envoy/config/metrics/v2:stats_cc",
)
native.bind(
name = "envoy_trace",
actual = "@envoy_api//envoy/config/trace/v2:trace_cc",
)
native.bind(
name = "envoy_cluster",
actual = "@envoy_api//envoy/api/v2/cluster:cluster_cc",
)
native.bind(
name = "envoy_endpoint",
actual = "@envoy_api//envoy/api/v2/endpoint:endpoint_cc",
)
native.bind(
name = "envoy_load_report",
actual = "@envoy_api//envoy/api/v2/endpoint:load_report_cc",
)
native.bind(
name = "envoy_circuit_breaker",
actual = "@envoy_api//envoy/api/v2/cluster:circuit_breaker_cc",
)
native.bind(
name = "envoy_route",
actual = "@envoy_api//envoy/api/v2/route:route_cc",
)
native.bind(
name = "envoy_listener",
actual = "@envoy_api//envoy/api/v2/listener:listener_cc",
)
native.bind(
name = "envoy_cert",
actual = "@envoy_api//envoy/api/v2/auth:cert_cc",
)

discovery_bind_targets = [
"ads",
"cds",
"eds",
"lds",
"rds",
"sds",
"stats",
"trace",
]
for t in api_bind_targets:
for t in discovery_bind_targets:
native.bind(
name = "envoy_" + t,
actual = "@envoy_api//api:" + t + "_cc",
actual = "@envoy_api//envoy/service/discovery/v2:" + t + "_cc",
)
native.bind(
name = "envoy_discovery",
actual = "@envoy_api//envoy/service/discovery/v2:common_cc",
)

filter_bind_targets = [
"fault",
]
for t in filter_bind_targets:
native.bind(
name = "envoy_filter_" + t,
actual = "@envoy_api//api/filter:" + t + "_cc",
actual = "@envoy_api//envoy/api/v2/filter:" + t + "_cc",
)
http_filter_bind_targets = [
"buffer",
Expand All @@ -174,7 +242,7 @@ def _envoy_api_deps():
for t in http_filter_bind_targets:
native.bind(
name = "envoy_filter_http_" + t,
actual = "@envoy_api//api/filter/http:" + t + "_cc",
actual = "@envoy_api//envoy/api/v2/filter/http:" + t + "_cc",
)
network_filter_bind_targets = [
"http_connection_manager",
Expand All @@ -187,11 +255,11 @@ def _envoy_api_deps():
for t in network_filter_bind_targets:
native.bind(
name = "envoy_filter_network_" + t,
actual = "@envoy_api//api/filter/network:" + t + "_cc",
actual = "@envoy_api//envoy/api/v2/filter/network:" + t + "_cc",
)
native.bind(
name = "envoy_filter_accesslog",
actual = "@envoy_api//api/filter/accesslog:accesslog_cc",
actual = "@envoy_api//envoy/api/v2/filter/accesslog:accesslog_cc",
)
native.bind(
name = "http_api_protos",
Expand Down
2 changes: 1 addition & 1 deletion bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ REPOSITORY_LOCATIONS = dict(
urls = ["https://github.com/google/protobuf/archive/v3.5.0.tar.gz"],
),
envoy_api = dict(
commit = "fd1a8c4269910caa2d99bf919c0ad13fb3d70f4f",
commit = "a66448b203e3a4f8ebbea0a5b7beede5c25640f6",
remote = "https://github.com/envoyproxy/data-plane-api",
),
grpc_httpjson_transcoding = dict(
Expand Down
6 changes: 3 additions & 3 deletions include/envoy/config/grpc_mux.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class GrpcMux {
/**
* Start a configuration subscription asynchronously for some API type and resources.
* @param type_url type URL corresponding to xDS API, e.g.
* type.googleapis.com/envoy.api.v2.Cluster.
* type.googleapis.com/envoy.api.v2.cluster.Cluster.
* @param resources vector of resource names to watch for. If this is empty, then all
* resources for type_url will result in callbacks.
* @param callbacks the callbacks to be notified of configuration updates. These must be valid
Expand All @@ -74,15 +74,15 @@ class GrpcMux {
* for LDS or CDS and don't want a flood of updates for RDS or EDS respectively. Discovery
* requests may later be resumed with resume().
* @param type_url type URL corresponding to xDS API, e.g.
* type.googleapis.com/envoy.api.v2.Cluster.
* type.googleapis.com/envoy.api.v2.cluster.Cluster.
*/
virtual void pause(const std::string& type_url) PURE;

/**
* Resume discovery requests for a given API type. This will send a discovery request if one would
* have been sent during the pause.
* @param type_url type URL corresponding to xDS API,
* e.g.type.googleapis.com/envoy.api.v2.Cluster.
* e.g.type.googleapis.com/envoy.api.v2.cluster.Cluster.
*/
virtual void resume(const std::string& type_url) PURE;
};
Expand Down
3 changes: 1 addition & 2 deletions include/envoy/grpc/async_client_manager.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#pragma once

#include "envoy/api/v2/grpc_service.pb.h"
#include "envoy/grpc/async_client.h"
#include "envoy/stats/stats.h"

#include "api/grpc_service.pb.h"

namespace Envoy {
namespace Grpc {

Expand Down
3 changes: 1 addition & 2 deletions include/envoy/local_info/local_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

#include <string>

#include "envoy/api/v2/base.pb.h"
#include "envoy/common/pure.h"
#include "envoy/network/address.h"

#include "api/base.pb.h"

namespace Envoy {
namespace LocalInfo {

Expand Down
3 changes: 1 addition & 2 deletions include/envoy/network/resolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
#include <cstdint>
#include <string>

#include "envoy/api/v2/address.pb.h"
#include "envoy/common/pure.h"
#include "envoy/network/address.h"

#include "api/address.pb.h"

namespace Envoy {
namespace Network {
namespace Address {
Expand Down
3 changes: 1 addition & 2 deletions include/envoy/router/route_config_provider_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <string>

#include "envoy/api/v2/filter/network/http_connection_manager.pb.h"
#include "envoy/event/dispatcher.h"
#include "envoy/init/init.h"
#include "envoy/json/json_object.h"
Expand All @@ -12,8 +13,6 @@
#include "envoy/thread_local/thread_local.h"
#include "envoy/upstream/cluster_manager.h"

#include "api/filter/network/http_connection_manager.pb.h"

namespace Envoy {
namespace Router {

Expand Down
3 changes: 1 addition & 2 deletions include/envoy/router/router.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <string>

#include "envoy/access_log/access_log.h"
#include "envoy/api/v2/base.pb.h"
#include "envoy/common/optional.h"
#include "envoy/http/codec.h"
#include "envoy/http/codes.h"
Expand All @@ -19,8 +20,6 @@
#include "common/protobuf/protobuf.h"
#include "common/protobuf/utility.h"

#include "api/base.pb.h"

namespace Envoy {
namespace Router {

Expand Down
2 changes: 1 addition & 1 deletion include/envoy/server/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ envoy_cc_library(
envoy_cc_library(
name = "listener_manager_interface",
hdrs = ["listener_manager.h"],
external_deps = ["envoy_lds"],
external_deps = ["envoy_listener"],
deps = [
":drain_manager_interface",
":filter_config_interface",
Expand Down
3 changes: 1 addition & 2 deletions include/envoy/server/filter_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <functional>

#include "envoy/access_log/access_log.h"
#include "envoy/api/v2/base.pb.h"
#include "envoy/http/filter.h"
#include "envoy/init/init.h"
#include "envoy/json/json_object.h"
Expand All @@ -20,8 +21,6 @@
#include "common/common/macros.h"
#include "common/protobuf/protobuf.h"

#include "api/base.pb.h"

namespace Envoy {
namespace Server {
namespace Configuration {
Expand Down
17 changes: 9 additions & 8 deletions include/envoy/server/listener_manager.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include "envoy/api/v2/listener/listener.pb.h"
#include "envoy/network/filter.h"
#include "envoy/network/listen_socket.h"
#include "envoy/network/listener.h"
Expand All @@ -9,8 +10,6 @@

#include "common/protobuf/protobuf.h"

#include "api/lds.pb.h"

namespace Envoy {
namespace Server {

Expand All @@ -36,9 +35,9 @@ class ListenerComponentFactory {
* @param context supplies the factory creation context.
* @return std::vector<Configuration::NetworkFilterFactoryCb> the list of filter factories.
*/
virtual std::vector<Configuration::NetworkFilterFactoryCb>
createNetworkFilterFactoryList(const Protobuf::RepeatedPtrField<envoy::api::v2::Filter>& filters,
Configuration::FactoryContext& context) PURE;
virtual std::vector<Configuration::NetworkFilterFactoryCb> createNetworkFilterFactoryList(
const Protobuf::RepeatedPtrField<envoy::api::v2::listener::Filter>& filters,
Configuration::FactoryContext& context) PURE;

/**
* Creates a list of listener filter factories.
Expand All @@ -47,14 +46,15 @@ class ListenerComponentFactory {
* @return std::vector<Configuration::ListenerFilterFactoryCb> the list of filter factories.
*/
virtual std::vector<Configuration::ListenerFilterFactoryCb> createListenerFilterFactoryList(
const Protobuf::RepeatedPtrField<envoy::api::v2::ListenerFilter>& filters,
const Protobuf::RepeatedPtrField<envoy::api::v2::listener::ListenerFilter>& filters,
Configuration::FactoryContext& context) PURE;

/**
* @return DrainManagerPtr a new drain manager.
* @param drain_type supplies the type of draining to do for the owning listener.
*/
virtual DrainManagerPtr createDrainManager(envoy::api::v2::Listener::DrainType drain_type) PURE;
virtual DrainManagerPtr
createDrainManager(envoy::api::v2::listener::Listener::DrainType drain_type) PURE;

/**
* @return uint64_t a listener tag usable for connection handler tracking.
Expand Down Expand Up @@ -84,7 +84,8 @@ class ListenerManager {
* a duplicate of the existing listener. This routine will throw an EnvoyException if
* there is a fundamental error preventing the listener from being added or updated.
*/
virtual bool addOrUpdateListener(const envoy::api::v2::Listener& config, bool modifiable) PURE;
virtual bool addOrUpdateListener(const envoy::api::v2::listener::Listener& config,
bool modifiable) PURE;

/**
* @return std::vector<std::reference_wrapper<Network::ListenerConfig>> a list of the currently
Expand Down
4 changes: 2 additions & 2 deletions include/envoy/upstream/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ envoy_cc_library(
hdrs = ["cluster_manager.h"],
external_deps = [
"envoy_bootstrap",
"envoy_cds",
"envoy_cluster",
],
deps = [
":load_balancer_interface",
Expand Down Expand Up @@ -64,7 +64,7 @@ envoy_cc_library(
envoy_cc_library(
name = "load_balancer_type_interface",
hdrs = ["load_balancer_type.h"],
external_deps = ["envoy_cds"],
external_deps = ["envoy_cluster"],
deps = [
"//source/common/protobuf",
],
Expand Down
Loading