Skip to content

Commit

Permalink
fix tracer ssl credential (istio#151)
Browse files Browse the repository at this point in the history
Signed-off-by: Pengyuan Bian <bianpengyuan@google.com>
  • Loading branch information
bianpengyuan authored Feb 16, 2020
1 parent 3eb2101 commit 02901d0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion source/extensions/tracers/opencensus/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ OpenCensusTracerFactory::OpenCensusTracerFactory() : FactoryBase(TracerNames::ge

Tracing::HttpTracerPtr OpenCensusTracerFactory::createHttpTracerTyped(
const envoy::config::trace::v2::OpenCensusConfig& proto_config, Server::Instance& server) {
Tracing::DriverPtr driver = std::make_unique<Driver>(proto_config, server.localInfo());
Tracing::DriverPtr driver =
std::make_unique<Driver>(proto_config, server.localInfo(), server.api());
return std::make_unique<Tracing::HttpTracerImpl>(std::move(driver), server.localInfo());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ void Span::setSampled(bool sampled) { span_.AddAnnotation("setSampled", {{"sampl
} // namespace

Driver::Driver(const envoy::config::trace::v2::OpenCensusConfig& oc_config,
const LocalInfo::LocalInfo& localinfo)
const LocalInfo::LocalInfo& localinfo, Api::Api& api)
: oc_config_(oc_config), local_info_(localinfo) {
if (oc_config.has_trace_config()) {
applyTraceConfig(oc_config.trace_config());
Expand Down Expand Up @@ -264,7 +264,8 @@ Driver::Driver(const envoy::config::trace::v2::OpenCensusConfig& oc_config,
sts_options.scope = "https://www.googleapis.com/auth/cloud-platform";
auto call_creds = grpc::experimental::StsCredentials(sts_options);
auto ssl_creds_options = grpc::SslCredentialsOptions();
ssl_creds_options.pem_root_certs = "/etc/ssl/certs/ca-certificates.crt";
ssl_creds_options.pem_root_certs =
api.fileSystem().fileReadToEnd("/etc/ssl/certs/ca-certificates.crt");
auto channel_creds = grpc::SslCredentials(ssl_creds_options);
auto channel =
::grpc::CreateChannel("cloudtrace.googleapis.com",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include "envoy/api/api.h"
#include "envoy/config/trace/v2/trace.pb.validate.h"
#include "envoy/local_info/local_info.h"
#include "envoy/tracing/http_tracer.h"
Expand All @@ -17,7 +18,7 @@ namespace OpenCensus {
class Driver : public Tracing::Driver, Logger::Loggable<Logger::Id::tracing> {
public:
Driver(const envoy::config::trace::v2::OpenCensusConfig& oc_config,
const LocalInfo::LocalInfo& localinfo);
const LocalInfo::LocalInfo& localinfo, Api::Api& api);

/**
* Implements the abstract Driver's startSpan operation.
Expand Down
1 change: 0 additions & 1 deletion test/extensions/filters/common/expr/context_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ TEST(Context, ResponseAttributes) {
EXPECT_EQ(148, value.value().Int64OrDie());
}


{
auto value = empty_response[CelValue::CreateString(TotalSize)];
EXPECT_TRUE(value.has_value());
Expand Down

0 comments on commit 02901d0

Please sign in to comment.