Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[telemetrygen] Fix case where root CAs should inherit from host environment #31250

Merged
merged 4 commits into from
Feb 21, 2024
Merged
Changes from 1 commit
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
22 changes: 17 additions & 5 deletions cmd/telemetrygen/internal/common/tls_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,15 @@ func GetTLSCredentialsForGRPCExporter(caFile string, cAuth ClientAuth) (credenti
return nil, err
}

creds := credentials.NewTLS(&tls.Config{
RootCAs: pool,
})
var creds credentials.TransportCredentials

if caFile != "" {
creds = credentials.NewTLS(&tls.Config{
RootCAs: pool,
})
} else {
creds = credentials.NewTLS(&tls.Config{})
}

// Configuration for mTLS
if cAuth.Enabled {
Expand All @@ -60,8 +66,14 @@ func GetTLSCredentialsForHTTPExporter(caFile string, cAuth ClientAuth) (*tls.Con
return nil, err
}

tlsCfg := tls.Config{
RootCAs: pool,
var tlsCfg tls.Config

if caFile != "" {
tlsCfg = tls.Config{
RootCAs: pool,
}
} else {
tlsCfg = tls.Config{}
}

// Configuration for mTLS
Expand Down
Loading