Skip to content

[confighttp,configgrpc] Rename TLSSetting to TLS #13115

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

Merged
merged 2 commits into from
Jun 3, 2025
Merged
Show file tree
Hide file tree
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
25 changes: 25 additions & 0 deletions .chloggen/mx-psi_tlssetting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: confighttp,configgrpc

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "Rename `ClientConfig.TLSSetting` and `ServerConfig.TLSSetting` to `ClientConfig.TLS` and `ServerConfig.TLS`."

# One or more tracking issues or pull requests related to the change
issues: [13115]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [api]
6 changes: 3 additions & 3 deletions config/configgrpc/client_middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func TestClientMiddlewareOrdering(t *testing.T) {
// Create client config with middleware extensions
clientConfig := ClientConfig{
Endpoint: addr,
TLSSetting: configtls.ClientConfig{
TLS: configtls.ClientConfig{
Insecure: true,
},
Middlewares: []configmiddleware.Config{
Expand Down Expand Up @@ -158,7 +158,7 @@ func TestClientMiddlewareToClientErrors(t *testing.T) {
},
config: ClientConfig{
Endpoint: "localhost:1234",
TLSSetting: configtls.ClientConfig{
TLS: configtls.ClientConfig{
Insecure: true,
},
Middlewares: []configmiddleware.Config{
Expand All @@ -178,7 +178,7 @@ func TestClientMiddlewareToClientErrors(t *testing.T) {
},
config: ClientConfig{
Endpoint: "localhost:1234",
TLSSetting: configtls.ClientConfig{
TLS: configtls.ClientConfig{
Insecure: true,
},
Middlewares: []configmiddleware.Config{
Expand Down
14 changes: 7 additions & 7 deletions config/configgrpc/configgrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ type ClientConfig struct {
// The compression key for supported compression types within collector.
Compression configcompression.Type `mapstructure:"compression,omitempty"`

// TLSSetting struct exposes TLS client configuration.
TLSSetting configtls.ClientConfig `mapstructure:"tls,omitempty"`
// TLS struct exposes TLS client configuration.
TLS configtls.ClientConfig `mapstructure:"tls,omitempty"`

// The keepalive parameters for gRPC client. See grpc.WithKeepaliveParams.
// (https://godoc.org/google.golang.org/grpc#WithKeepaliveParams).
Expand Down Expand Up @@ -114,7 +114,7 @@ type ClientConfig struct {
// NewDefaultClientConfig returns a new instance of ClientConfig with default values.
func NewDefaultClientConfig() *ClientConfig {
return &ClientConfig{
TLSSetting: configtls.NewDefaultClientConfig(),
TLS: configtls.NewDefaultClientConfig(),
Keepalive: NewDefaultKeepaliveClientConfig(),
BalancerName: BalancerName(),
}
Expand Down Expand Up @@ -176,7 +176,7 @@ type ServerConfig struct {

// Configures the protocol to use TLS.
// The default value is nil, which will cause the protocol to not use TLS.
TLSSetting *configtls.ServerConfig `mapstructure:"tls,omitempty"`
TLS *configtls.ServerConfig `mapstructure:"tls,omitempty"`

// MaxRecvMsgSizeMiB sets the maximum size (in MiB) of messages accepted by the server.
MaxRecvMsgSizeMiB int `mapstructure:"max_recv_msg_size_mib,omitempty"`
Expand Down Expand Up @@ -306,7 +306,7 @@ func (gcs *ClientConfig) getGrpcDialOptions(
opts = append(opts, grpc.WithDefaultCallOptions(grpc.UseCompressor(cp)))
}

tlsCfg, err := gcs.TLSSetting.LoadTLSConfig(ctx)
tlsCfg, err := gcs.TLS.LoadTLSConfig(ctx)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -451,8 +451,8 @@ func (gss *ServerConfig) getGrpcServerOptions(
) ([]grpc.ServerOption, error) {
var opts []grpc.ServerOption

if gss.TLSSetting != nil {
tlsCfg, err := gss.TLSSetting.LoadTLSConfig(context.Background())
if gss.TLS != nil {
tlsCfg, err := gss.TLS.LoadTLSConfig(context.Background())
if err != nil {
return nil, err
}
Expand Down
52 changes: 26 additions & 26 deletions config/configgrpc/configgrpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestNewDefaultKeepaliveClientConfig(t *testing.T) {

func TestNewDefaultClientConfig(t *testing.T) {
expected := &ClientConfig{
TLSSetting: configtls.NewDefaultClientConfig(),
TLS: configtls.NewDefaultClientConfig(),
Keepalive: NewDefaultKeepaliveClientConfig(),
BalancerName: BalancerName(),
}
Expand Down Expand Up @@ -113,22 +113,22 @@ var (

func TestDefaultGrpcClientSettings(t *testing.T) {
gcs := &ClientConfig{
TLSSetting: configtls.ClientConfig{
TLS: configtls.ClientConfig{
Insecure: true,
},
}
opts, err := gcs.getGrpcDialOptions(context.Background(), componenttest.NewNopHost(), componenttest.NewNopTelemetrySettings(), []ToClientConnOption{})
require.NoError(t, err)
/* Expecting 2 DialOptions:
* - WithTransportCredentials (TLSSetting)
* - WithTransportCredentials (TLS)
* - WithStatsHandler (always, for self-telemetry)
*/
assert.Len(t, opts, 2)
}

func TestGrpcClientExtraOption(t *testing.T) {
gcs := &ClientConfig{
TLSSetting: configtls.ClientConfig{
TLS: configtls.ClientConfig{
Insecure: true,
},
}
Expand All @@ -141,7 +141,7 @@ func TestGrpcClientExtraOption(t *testing.T) {
)
require.NoError(t, err)
/* Expecting 3 DialOptions:
* - WithTransportCredentials (TLSSetting)
* - WithTransportCredentials (TLS)
* - WithStatsHandler (always, for self-telemetry)
* - extraOpt
*/
Expand All @@ -163,7 +163,7 @@ func TestAllGrpcClientSettings(t *testing.T) {
},
Endpoint: "localhost:1234",
Compression: configcompression.TypeGzip,
TLSSetting: configtls.ClientConfig{
TLS: configtls.ClientConfig{
Insecure: false,
},
Keepalive: &KeepaliveClientConfig{
Expand Down Expand Up @@ -192,7 +192,7 @@ func TestAllGrpcClientSettings(t *testing.T) {
},
Endpoint: "localhost:1234",
Compression: configcompression.TypeSnappy,
TLSSetting: configtls.ClientConfig{
TLS: configtls.ClientConfig{
Insecure: false,
},
Keepalive: &KeepaliveClientConfig{
Expand Down Expand Up @@ -221,7 +221,7 @@ func TestAllGrpcClientSettings(t *testing.T) {
},
Endpoint: "localhost:1234",
Compression: configcompression.TypeZstd,
TLSSetting: configtls.ClientConfig{
TLS: configtls.ClientConfig{
Insecure: false,
},
Keepalive: &KeepaliveClientConfig{
Expand Down Expand Up @@ -249,7 +249,7 @@ func TestAllGrpcClientSettings(t *testing.T) {
require.NoError(t, err)
/* Expecting 11 DialOptions:
* - WithDefaultCallOptions (Compression)
* - WithTransportCredentials (TLSSetting)
* - WithTransportCredentials (TLS)
* - WithDefaultServiceConfig (BalancerName)
* - WithAuthority (Authority)
* - WithStatsHandler (always, for self-telemetry)
Expand Down Expand Up @@ -277,7 +277,7 @@ func TestHeaders(t *testing.T) {
// Create client and send request to server with headers
resp, errResp := sendTestRequest(t, ClientConfig{
Endpoint: addr,
TLSSetting: configtls.ClientConfig{
TLS: configtls.ClientConfig{
Insecure: true,
},
Headers: map[string]configopaque.String{
Expand Down Expand Up @@ -380,7 +380,7 @@ func TestAllGrpcServerSettingsExceptAuth(t *testing.T) {
Endpoint: "localhost:1234",
Transport: confignet.TransportTypeTCP,
},
TLSSetting: &configtls.ServerConfig{
TLS: &configtls.ServerConfig{
Config: configtls.Config{},
ClientCAFile: "",
},
Expand Down Expand Up @@ -434,7 +434,7 @@ func TestGrpcClientConfigInvalidBalancer(t *testing.T) {
},
Endpoint: "localhost:1234",
Compression: "gzip",
TLSSetting: configtls.ClientConfig{
TLS: configtls.ClientConfig{
Insecure: false,
},
Keepalive: &KeepaliveClientConfig{
Expand Down Expand Up @@ -462,7 +462,7 @@ func TestGRPCClientSettingsError(t *testing.T) {
Headers: nil,
Endpoint: "",
Compression: "",
TLSSetting: configtls.ClientConfig{
TLS: configtls.ClientConfig{
Config: configtls.Config{
CAFile: "/doesnt/exist",
},
Expand All @@ -478,7 +478,7 @@ func TestGRPCClientSettingsError(t *testing.T) {
Headers: nil,
Endpoint: "",
Compression: "",
TLSSetting: configtls.ClientConfig{
TLS: configtls.ClientConfig{
Config: configtls.Config{
CertFile: "/doesnt/exist",
},
Expand Down Expand Up @@ -508,7 +508,7 @@ func TestGRPCClientSettingsError(t *testing.T) {
err: "unsupported compression type \"zlib\"",
settings: ClientConfig{
Endpoint: "localhost:1234",
TLSSetting: configtls.ClientConfig{
TLS: configtls.ClientConfig{
Insecure: true,
},
Compression: "zlib",
Expand All @@ -519,7 +519,7 @@ func TestGRPCClientSettingsError(t *testing.T) {
err: "unsupported compression type \"deflate\"",
settings: ClientConfig{
Endpoint: "localhost:1234",
TLSSetting: configtls.ClientConfig{
TLS: configtls.ClientConfig{
Insecure: true,
},
Compression: "deflate",
Expand All @@ -530,7 +530,7 @@ func TestGRPCClientSettingsError(t *testing.T) {
err: "unsupported compression type \"bad\"",
settings: ClientConfig{
Endpoint: "localhost:1234",
TLSSetting: configtls.ClientConfig{
TLS: configtls.ClientConfig{
Insecure: true,
},
Compression: "bad",
Expand All @@ -553,7 +553,7 @@ func TestUseSecure(t *testing.T) {
Headers: nil,
Endpoint: "",
Compression: "",
TLSSetting: configtls.ClientConfig{},
TLS: configtls.ClientConfig{},
Keepalive: nil,
}
dialOpts, err := gcs.getGrpcDialOptions(context.Background(), componenttest.NewNopHost(), componenttest.NewNopTelemetrySettings(), []ToClientConnOption{})
Expand All @@ -573,7 +573,7 @@ func TestGRPCServerSettingsError(t *testing.T) {
Endpoint: "127.0.0.1:1234",
Transport: confignet.TransportTypeTCP,
},
TLSSetting: &configtls.ServerConfig{
TLS: &configtls.ServerConfig{
Config: configtls.Config{
CAFile: "/doesnt/exist",
},
Expand All @@ -587,7 +587,7 @@ func TestGRPCServerSettingsError(t *testing.T) {
Endpoint: "127.0.0.1:1234",
Transport: confignet.TransportTypeTCP,
},
TLSSetting: &configtls.ServerConfig{
TLS: &configtls.ServerConfig{
Config: configtls.Config{
CertFile: "/doesnt/exist",
},
Expand All @@ -601,7 +601,7 @@ func TestGRPCServerSettingsError(t *testing.T) {
Endpoint: "127.0.0.1:1234",
Transport: confignet.TransportTypeTCP,
},
TLSSetting: &configtls.ServerConfig{
TLS: &configtls.ServerConfig{
ClientCAFile: "/doesnt/exist",
},
},
Expand Down Expand Up @@ -738,13 +738,13 @@ func TestHttpReception(t *testing.T) {
Endpoint: "localhost:0",
Transport: confignet.TransportTypeTCP,
},
TLSSetting: test.tlsServerCreds,
TLS: test.tlsServerCreds,
})
defer s.Stop()

resp, errResp := sendTestRequest(t, ClientConfig{
Endpoint: addr,
TLSSetting: *test.tlsClientCreds,
Endpoint: addr,
TLS: *test.tlsClientCreds,
})
if test.hasError {
require.Error(t, errResp)
Expand Down Expand Up @@ -772,7 +772,7 @@ func TestReceiveOnUnixDomainSocket(t *testing.T) {

resp, errResp := sendTestRequest(t, ClientConfig{
Endpoint: "unix://" + addr,
TLSSetting: configtls.ClientConfig{
TLS: configtls.ClientConfig{
Insecure: true,
},
})
Expand Down Expand Up @@ -955,7 +955,7 @@ func TestClientInfoInterceptors(t *testing.T) {
{
resp, errResp := sendTestRequest(t, ClientConfig{
Endpoint: addr,
TLSSetting: configtls.ClientConfig{
TLS: configtls.ClientConfig{
Insecure: true,
},
})
Expand Down
2 changes: 1 addition & 1 deletion config/configgrpc/server_middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func TestGrpcServerUnaryInterceptor(t *testing.T) {
// Send a request to trigger the interceptors
resp, errResp := sendTestRequest(t, ClientConfig{
Endpoint: addr,
TLSSetting: configtls.ClientConfig{
TLS: configtls.ClientConfig{
Insecure: true,
},
})
Expand Down
16 changes: 8 additions & 8 deletions config/confighttp/confighttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ type ClientConfig struct {
// ProxyURL setting for the collector
ProxyURL string `mapstructure:"proxy_url,omitempty"`

// TLSSetting struct exposes TLS client configuration.
TLSSetting configtls.ClientConfig `mapstructure:"tls,omitempty"`
// TLS struct exposes TLS client configuration.
TLS configtls.ClientConfig `mapstructure:"tls,omitempty"`

// ReadBufferSize for HTTP client. See http.Transport.ReadBufferSize.
// Default is 0.
Expand Down Expand Up @@ -164,7 +164,7 @@ type ToClientOption interface {

// ToClient creates an HTTP client.
func (hcs *ClientConfig) ToClient(ctx context.Context, host component.Host, settings component.TelemetrySettings, _ ...ToClientOption) (*http.Client, error) {
tlsCfg, err := hcs.TLSSetting.LoadTLSConfig(ctx)
tlsCfg, err := hcs.TLS.LoadTLSConfig(ctx)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -314,8 +314,8 @@ type ServerConfig struct {
// Endpoint configures the listening address for the server.
Endpoint string `mapstructure:"endpoint,omitempty"`

// TLSSetting struct exposes TLS client configuration.
TLSSetting *configtls.ServerConfig `mapstructure:"tls"`
// TLS struct exposes TLS client configuration.
TLS *configtls.ServerConfig `mapstructure:"tls"`

// CORS configures the server for HTTP cross-origin resource sharing (CORS).
CORS *CORSConfig `mapstructure:"cors"`
Expand Down Expand Up @@ -379,7 +379,7 @@ func NewDefaultServerConfig() ServerConfig {
tlsDefaultServerConfig := configtls.NewDefaultServerConfig()
return ServerConfig{
ResponseHeaders: map[string]configopaque.String{},
TLSSetting: &tlsDefaultServerConfig,
TLS: &tlsDefaultServerConfig,
CORS: NewDefaultCORSConfig(),
WriteTimeout: 30 * time.Second,
ReadHeaderTimeout: 1 * time.Minute,
Expand All @@ -405,9 +405,9 @@ func (hss *ServerConfig) ToListener(ctx context.Context) (net.Listener, error) {
return nil, err
}

if hss.TLSSetting != nil {
if hss.TLS != nil {
var tlsCfg *tls.Config
tlsCfg, err = hss.TLSSetting.LoadTLSConfig(ctx)
tlsCfg, err = hss.TLS.LoadTLSConfig(ctx)
if err != nil {
return nil, err
}
Expand Down
Loading
Loading