LCOV - code coverage report
Current view: top level - source/server/config_validation - cluster_manager.h (source / functions) Hit Total Coverage
Test: coverage.dat Lines: 0 4 0.0 %
Date: 2024-01-05 06:35:25 Functions: 0 2 0.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include "envoy/config/bootstrap/v3/bootstrap.pb.h"
       4             : #include "envoy/config/core/v3/config_source.pb.h"
       5             : #include "envoy/secret/secret_manager.h"
       6             : #include "envoy/server/options.h"
       7             : #include "envoy/upstream/cluster_manager.h"
       8             : 
       9             : #include "source/common/http/context_impl.h"
      10             : #include "source/common/upstream/cluster_manager_impl.h"
      11             : 
      12             : namespace Envoy {
      13             : namespace Upstream {
      14             : 
      15             : /**
      16             :  * Config-validation-only implementation of ClusterManagerFactory, which creates
      17             :  * ValidationClusterManagers. It also creates, but never returns, CdsApiImpls.
      18             :  */
      19             : class ValidationClusterManagerFactory : public ProdClusterManagerFactory {
      20             : public:
      21             :   using ProdClusterManagerFactory::ProdClusterManagerFactory;
      22             : 
      23             :   explicit ValidationClusterManagerFactory(
      24             :       Server::Configuration::ServerFactoryContext& server_context, Stats::Store& stats,
      25             :       ThreadLocal::Instance& tls, Http::Context& http_context,
      26             :       LazyCreateDnsResolver dns_resolver_fn, Ssl::ContextManager& ssl_context_manager,
      27             :       Secret::SecretManager& secret_manager, Quic::QuicStatNames& quic_stat_names,
      28             :       Server::Instance& server)
      29             :       : ProdClusterManagerFactory(server_context, stats, tls, http_context, dns_resolver_fn,
      30           0 :                                   ssl_context_manager, secret_manager, quic_stat_names, server) {}
      31             : 
      32             :   ClusterManagerPtr
      33             :   clusterManagerFromProto(const envoy::config::bootstrap::v3::Bootstrap& bootstrap) override;
      34             : 
      35             :   // Delegates to ProdClusterManagerFactory::createCds, but discards the result and returns nullptr
      36             :   // unconditionally.
      37             :   CdsApiPtr createCds(const envoy::config::core::v3::ConfigSource& cds_config,
      38             :                       const xds::core::v3::ResourceLocator* cds_resources_locator,
      39             :                       ClusterManager& cm) override;
      40             : };
      41             : 
      42             : /**
      43             :  * Config-validation-only implementation of ClusterManager, which opens no upstream connections.
      44             :  */
      45             : class ValidationClusterManager : public ClusterManagerImpl {
      46             : public:
      47             :   using ClusterManagerImpl::ClusterManagerImpl;
      48             : 
      49           0 :   ThreadLocalCluster* getThreadLocalCluster(absl::string_view) override {
      50             :     // A thread local cluster is never guaranteed to exist (because it is not created until warmed)
      51             :     // so all calling code must have error handling for this case. Returning nullptr here prevents
      52             :     // any calling code creating real outbound networking during validation.
      53           0 :     return nullptr;
      54           0 :   }
      55             : 
      56             :   // Gives access to the protected constructor.
      57             :   friend ValidationClusterManagerFactory;
      58             : };
      59             : 
      60             : } // namespace Upstream
      61             : } // namespace Envoy

Generated by: LCOV version 1.15