-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
proto: move extension-specific linking validation into extensions (#6657
) A couple of the proto descriptors validated during startup are specific to extensions that may be compiled out. This change only validates their presence when the extensions are used. This fixes some spurious validation failures in certain minimal build configurations. Risk Level: Low Testing: Ran test suite, ran server. Docs Changes: N/A Release Notes: N/A Signed-off-by: Mike Schore <mike.schore@gmail.com>
- Loading branch information
Showing
10 changed files
with
100 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
source/extensions/access_loggers/http_grpc/grpc_access_log_proto_descriptors.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include "extensions/access_loggers/http_grpc/grpc_access_log_proto_descriptors.h" | ||
|
||
#include "envoy/service/accesslog/v2/als.pb.h" | ||
|
||
#include "common/common/fmt.h" | ||
#include "common/protobuf/protobuf.h" | ||
|
||
namespace Envoy { | ||
namespace Extensions { | ||
namespace AccessLoggers { | ||
namespace HttpGrpc { | ||
|
||
bool validateProtoDescriptors() { | ||
const auto method = "envoy.service.accesslog.v2.AccessLogService.StreamAccessLogs"; | ||
|
||
return Protobuf::DescriptorPool::generated_pool()->FindMethodByName(method) != nullptr; | ||
}; | ||
} // namespace HttpGrpc | ||
} // namespace AccessLoggers | ||
} // namespace Extensions | ||
} // namespace Envoy |
14 changes: 14 additions & 0 deletions
14
source/extensions/access_loggers/http_grpc/grpc_access_log_proto_descriptors.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#pragma once | ||
|
||
namespace Envoy { | ||
namespace Extensions { | ||
namespace AccessLoggers { | ||
namespace HttpGrpc { | ||
|
||
// This function validates that the method descriptors for gRPC services and type descriptors that | ||
// are referenced in Any messages are available in the descriptor pool. | ||
bool validateProtoDescriptors(); | ||
} // namespace HttpGrpc | ||
} // namespace AccessLoggers | ||
} // namespace Extensions | ||
} // namespace Envoy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
source/extensions/stat_sinks/metrics_service/grpc_metrics_proto_descriptors.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include "extensions/stat_sinks/metrics_service/grpc_metrics_proto_descriptors.h" | ||
|
||
#include "envoy/service/metrics/v2/metrics_service.pb.h" | ||
|
||
#include "common/common/fmt.h" | ||
#include "common/protobuf/protobuf.h" | ||
|
||
namespace Envoy { | ||
namespace Extensions { | ||
namespace StatSinks { | ||
namespace MetricsService { | ||
|
||
bool validateProtoDescriptors() { | ||
const auto method = "envoy.service.metrics.v2.MetricsService.StreamMetrics"; | ||
|
||
return Protobuf::DescriptorPool::generated_pool()->FindMethodByName(method) != nullptr; | ||
}; | ||
} // namespace MetricsService | ||
} // namespace StatSinks | ||
} // namespace Extensions | ||
} // namespace Envoy |
14 changes: 14 additions & 0 deletions
14
source/extensions/stat_sinks/metrics_service/grpc_metrics_proto_descriptors.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#pragma once | ||
|
||
namespace Envoy { | ||
namespace Extensions { | ||
namespace StatSinks { | ||
namespace MetricsService { | ||
|
||
// This function validates that the method descriptors for gRPC services and type descriptors that | ||
// are referenced in Any messages are available in the descriptor pool. | ||
bool validateProtoDescriptors(); | ||
} // namespace MetricsService | ||
} // namespace StatSinks | ||
} // namespace Extensions | ||
} // namespace Envoy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters