Skip to content

Commit

Permalink
tls: cleaning up unused noboring code (#32912)
Browse files Browse the repository at this point in the history
#32748 was an attempt to move no-boring code to contrib.
Per investigation at that time, the noboring build was already broken, so cleaning up that code entirely.
If needed, #32748 can be reinstated instead.

This also cleans up some unneeded DNS code.

---------

Signed-off-by: Alyssa Wilk <[email protected]>
  • Loading branch information
alyssawilk authored Mar 20, 2024
1 parent 02f391b commit 412a936
Show file tree
Hide file tree
Showing 19 changed files with 12 additions and 227 deletions.
11 changes: 0 additions & 11 deletions envoy/ssl/context_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,5 @@ class ContextManager {

using ContextManagerPtr = std::unique_ptr<ContextManager>;

class ContextManagerFactory : public Config::UntypedFactory {
public:
~ContextManagerFactory() override = default;
virtual ContextManagerPtr
createContextManager(Server::Configuration::CommonFactoryContext& factory_context) PURE;

// There could be only one factory thus the name is static.
std::string name() const override { return "ssl_context_manager"; }
std::string category() const override { return "envoy.ssl_context_manager"; }
};

} // namespace Ssl
} // namespace Envoy
1 change: 1 addition & 0 deletions source/extensions/all_extensions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ _core_extensions = [
"envoy.network.dns_resolver.cares",
"envoy.network.dns_resolver.apple",
"envoy.load_balancing_policies.round_robin",
"envoy.transport_sockets.tls",
]

# Return all core extensions to be compiled into Envoy.
Expand Down
1 change: 1 addition & 0 deletions source/extensions/extensions_build_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ EXTENSIONS = {
"envoy.transport_sockets.tap": "//source/extensions/transport_sockets/tap:config",
"envoy.transport_sockets.starttls": "//source/extensions/transport_sockets/starttls:config",
"envoy.transport_sockets.tcp_stats": "//source/extensions/transport_sockets/tcp_stats:config",
"envoy.transport_sockets.tls": "//source/extensions/transport_sockets/tls:config",
"envoy.transport_sockets.internal_upstream": "//source/extensions/transport_sockets/internal_upstream:config",

#
Expand Down
9 changes: 0 additions & 9 deletions source/extensions/transport_sockets/tls/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,6 @@ ProtobufTypes::MessagePtr DownstreamSslSocketFactory::createEmptyConfigProto() {
LEGACY_REGISTER_FACTORY(DownstreamSslSocketFactory,
Server::Configuration::DownstreamTransportSocketConfigFactory, "tls");

Ssl::ContextManagerPtr SslContextManagerFactory::createContextManager(
Server::Configuration::CommonFactoryContext& factory_context) {
return std::make_unique<ContextManagerImpl>(factory_context);
}

static Envoy::Registry::RegisterInternalFactory<SslContextManagerFactory,
Ssl::ContextManagerFactory>
ssl_manager_registered;

} // namespace Tls
} // namespace TransportSockets
} // namespace Extensions
Expand Down
8 changes: 0 additions & 8 deletions source/extensions/transport_sockets/tls/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@ class DownstreamSslSocketFactory

DECLARE_FACTORY(DownstreamSslSocketFactory);

class SslContextManagerFactory : public Ssl::ContextManagerFactory {
public:
Ssl::ContextManagerPtr
createContextManager(Server::Configuration::CommonFactoryContext& factory_context) override;
};

DECLARE_FACTORY(SslContextManagerFactory);

} // namespace Tls
} // namespace TransportSockets
} // namespace Extensions
Expand Down
12 changes: 1 addition & 11 deletions source/server/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,6 @@ envoy_cc_library(
":listener_hooks_lib",
":listener_manager_factory_lib",
":regex_engine_lib",
":ssl_context_manager_lib",
":utils_lib",
":worker_lib",
"//envoy/event:dispatcher_interface",
Expand Down Expand Up @@ -463,6 +462,7 @@ envoy_cc_library(
"//source/common/signal:fatal_error_handler_lib",
"//source/common/singleton:manager_impl_lib",
"//source/common/stats:thread_local_store_lib",
"//source/common/tls:context_lib",
"//source/common/upstream:cluster_manager_lib",
"//source/common/upstream:health_discovery_service_lib",
"//source/common/version:version_lib",
Expand All @@ -484,16 +484,6 @@ envoy_cc_library(
],
)

envoy_cc_library(
name = "ssl_context_manager_lib",
srcs = ["ssl_context_manager.cc"],
hdrs = ["ssl_context_manager.h"],
deps = [
"//envoy/registry",
"//envoy/ssl:context_manager_interface",
],
)

envoy_cc_library(
name = "listener_hooks_lib",
hdrs = ["listener_hooks.h"],
Expand Down
13 changes: 1 addition & 12 deletions source/server/config_validation/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ envoy_cc_library(
hdrs = [
"connection.h",
"dispatcher.h",
"dns.h",
],
deps = [
"//envoy/event:dispatcher_interface",
Expand All @@ -60,16 +59,6 @@ envoy_cc_library(
],
)

envoy_cc_library(
name = "dns_lib",
srcs = ["dns.cc"],
hdrs = ["dns.h"],
deps = [
"//envoy/event:dispatcher_interface",
"//envoy/network:dns_interface",
],
)

envoy_cc_library(
name = "server_lib",
srcs = ["server.cc"],
Expand All @@ -79,7 +68,6 @@ envoy_cc_library(
":admin_lib",
":api_lib",
":cluster_manager_lib",
":dns_lib",
"//envoy/server:drain_manager_interface",
"//envoy/server:instance_interface",
"//envoy/ssl:context_manager_interface",
Expand All @@ -100,6 +88,7 @@ envoy_cc_library(
"//source/common/stats:stats_lib",
"//source/common/thread_local:thread_local_lib",
"//source/common/version:version_lib",
"//source/extensions/transport_sockets/tls:config",
"//source/server:configuration_lib",
"//source/server:hot_restart_nop_lib",
"//source/server:overload_manager_lib",
Expand Down
1 change: 0 additions & 1 deletion source/server/config_validation/dispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "envoy/event/dispatcher.h"

#include "source/common/event/dispatcher_impl.h"
#include "source/server/config_validation/dns.h"

namespace Envoy {
namespace Event {
Expand Down
13 changes: 0 additions & 13 deletions source/server/config_validation/dns.cc

This file was deleted.

23 changes: 0 additions & 23 deletions source/server/config_validation/dns.h

This file was deleted.

6 changes: 4 additions & 2 deletions source/server/config_validation/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
#include "source/common/local_info/local_info_impl.h"
#include "source/common/protobuf/utility.h"
#include "source/common/singleton/manager_impl.h"
#include "source/common/tls/context_manager_impl.h"
#include "source/common/version/version.h"
#include "source/server/admin/admin_factory_context.h"
#include "source/server/listener_manager_factory.h"
#include "source/server/overload_manager_impl.h"
#include "source/server/regex_engine.h"
#include "source/server/ssl_context_manager.h"
#include "source/server/utils.h"

namespace Envoy {
Expand Down Expand Up @@ -132,7 +132,9 @@ void ValidationInstance::initialize(const Options& options,
"Component factory should not return nullptr from createDrainManager()");

secret_manager_ = std::make_unique<Secret::SecretManagerImpl>(admin()->getConfigTracker());
ssl_context_manager_ = createContextManager("ssl_context_manager", server_contexts_);
ssl_context_manager_ =
std::make_unique<Extensions::TransportSockets::Tls::ContextManagerImpl>(server_contexts_);

cluster_manager_factory_ = std::make_unique<Upstream::ValidationClusterManagerFactory>(
server_contexts_, stats(), threadLocal(), http_context_,
[this]() -> Network::DnsResolverSharedPtr { return this->dnsResolver(); },
Expand Down
1 change: 0 additions & 1 deletion source/server/config_validation/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "source/server/config_validation/admin.h"
#include "source/server/config_validation/api.h"
#include "source/server/config_validation/cluster_manager.h"
#include "source/server/config_validation/dns.h"
#include "source/server/hot_restart_nop_impl.h"
#include "source/server/server.h"

Expand Down
5 changes: 3 additions & 2 deletions source/server/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@
#include "source/common/stats/stats_matcher_impl.h"
#include "source/common/stats/thread_local_store.h"
#include "source/common/stats/timespan_impl.h"
#include "source/common/tls/context_manager_impl.h"
#include "source/common/upstream/cluster_manager_impl.h"
#include "source/common/version/version.h"
#include "source/server/configuration_impl.h"
#include "source/server/listener_hooks.h"
#include "source/server/listener_manager_factory.h"
#include "source/server/regex_engine.h"
#include "source/server/ssl_context_manager.h"
#include "source/server/utils.h"

namespace Envoy {
Expand Down Expand Up @@ -749,7 +749,8 @@ absl::Status InstanceBase::initializeOrThrow(Network::Address::InstanceConstShar
}

// Once we have runtime we can initialize the SSL context manager.
ssl_context_manager_ = createContextManager("ssl_context_manager", server_contexts_);
ssl_context_manager_ =
std::make_unique<Extensions::TransportSockets::Tls::ContextManagerImpl>(server_contexts_);

cluster_manager_factory_ = std::make_unique<Upstream::ProdClusterManagerFactory>(
serverFactoryContext(), stats_store_, thread_local_, http_context_,
Expand Down
65 changes: 0 additions & 65 deletions source/server/ssl_context_manager.cc

This file was deleted.

14 changes: 0 additions & 14 deletions source/server/ssl_context_manager.h

This file was deleted.

1 change: 1 addition & 0 deletions test/integration/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ envoy_cc_test_binary(
"//source/exe:process_wide_lib",
"//source/exe:stripped_main_base_lib",
"//source/extensions/listener_managers/validation_listener_manager:validation_listener_manager_lib",
"//source/extensions/transport_sockets/tls:config",
],
)

Expand Down
13 changes: 0 additions & 13 deletions test/server/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -363,19 +363,6 @@ envoy_cc_test(
],
)

envoy_cc_test(
name = "ssl_context_manager_test",
srcs = ["ssl_context_manager_test.cc"],
deps = [
"//source/server:ssl_context_manager_lib",
"//test/mocks/server:server_factory_context_mocks",
"//test/mocks/ssl:ssl_mocks",
"//test/mocks/stats:stats_mocks",
"//test/test_common:simulated_time_system_lib",
"//test/test_common:utility_lib",
],
)

envoy_cc_test_library(
name = "utility_lib",
hdrs = ["utility.h"],
Expand Down
2 changes: 0 additions & 2 deletions test/server/config_validation/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ envoy_cc_test(
"//source/common/stats:stats_lib",
"//source/common/tls:context_lib",
"//source/server/config_validation:cluster_manager_lib",
"//source/server/config_validation:dns_lib",
"//test/mocks/access_log:access_log_mocks",
"//test/mocks/event:event_mocks",
"//test/mocks/http:http_mocks",
Expand Down Expand Up @@ -78,7 +77,6 @@ envoy_cc_test(
"//source/common/event:libevent_lib",
"//source/common/stats:isolated_store_lib",
"//source/server/config_validation:api_lib",
"//source/server/config_validation:dns_lib",
"//test/test_common:environment_lib",
"//test/test_common:network_utility_lib",
"//test/test_common:test_time_lib",
Expand Down
Loading

0 comments on commit 412a936

Please sign in to comment.