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

[configtls] Rename config structs for consistency #9495

Merged
merged 2 commits into from
Feb 29, 2024
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/rename_configtls_structs.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: deprecation

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Rename TLSClientSetting, TLSServerSetting, and TLSSetting based on the naming convention used in other config packages.

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

# (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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please list all the renames here, e.g.:

Suggested change
subtext:
subtext: |
- TLSClientSetting -> ClientConfig


# 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]
4 changes: 2 additions & 2 deletions config/configgrpc/configgrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type ClientConfig struct {
Compression configcompression.Type `mapstructure:"compression"`

// TLSSetting struct exposes TLS client configuration.
TLSSetting configtls.TLSClientSetting `mapstructure:"tls"`
TLSSetting configtls.ClientConfig `mapstructure:"tls"`
arjunmahishi marked this conversation as resolved.
Show resolved Hide resolved

// The keepalive parameters for gRPC client. See grpc.WithKeepaliveParams.
// (https://godoc.org/google.golang.org/grpc#WithKeepaliveParams).
Expand Down Expand Up @@ -122,7 +122,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.TLSServerSetting `mapstructure:"tls"`
TLSSetting *configtls.ServerConfig `mapstructure:"tls"`

// MaxRecvMsgSizeMiB sets the maximum size (in MiB) of messages accepted by the server.
MaxRecvMsgSizeMiB uint64 `mapstructure:"max_recv_msg_size_mib"`
Expand Down
90 changes: 45 additions & 45 deletions config/configgrpc/configgrpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestDefaultGrpcClientSettings(t *testing.T) {
t.Cleanup(func() { require.NoError(t, tt.Shutdown(context.Background())) })

gcs := &ClientConfig{
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.ClientConfig{
Insecure: true,
},
}
Expand All @@ -90,7 +90,7 @@ func TestAllGrpcClientSettings(t *testing.T) {
},
Endpoint: "localhost:1234",
Compression: configcompression.TypeGzip,
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.ClientConfig{
Insecure: false,
},
Keepalive: &KeepaliveClientConfig{
Expand Down Expand Up @@ -119,7 +119,7 @@ func TestAllGrpcClientSettings(t *testing.T) {
},
Endpoint: "localhost:1234",
Compression: configcompression.TypeSnappy,
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.ClientConfig{
Insecure: false,
},
Keepalive: &KeepaliveClientConfig{
Expand Down Expand Up @@ -148,7 +148,7 @@ func TestAllGrpcClientSettings(t *testing.T) {
},
Endpoint: "localhost:1234",
Compression: configcompression.TypeZstd,
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.ClientConfig{
Insecure: false,
},
Keepalive: &KeepaliveClientConfig{
Expand Down Expand Up @@ -196,8 +196,8 @@ func TestAllGrpcServerSettingsExceptAuth(t *testing.T) {
Endpoint: "localhost:1234",
Transport: "tcp",
},
TLSSetting: &configtls.TLSServerSetting{
TLSSetting: configtls.TLSSetting{},
TLSSetting: &configtls.ServerConfig{
TLSSetting: configtls.Config{},
ClientCAFile: "",
},
MaxRecvMsgSizeMiB: 1,
Expand Down Expand Up @@ -258,8 +258,8 @@ func TestGRPCClientSettingsError(t *testing.T) {
Headers: nil,
Endpoint: "",
Compression: "",
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
TLSSetting: configtls.ClientConfig{
TLSSetting: configtls.Config{
CAFile: "/doesnt/exist",
},
Insecure: false,
Expand All @@ -274,8 +274,8 @@ func TestGRPCClientSettingsError(t *testing.T) {
Headers: nil,
Endpoint: "",
Compression: "",
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
TLSSetting: configtls.ClientConfig{
TLSSetting: configtls.Config{
CertFile: "/doesnt/exist",
},
Insecure: false,
Expand All @@ -292,7 +292,7 @@ func TestGRPCClientSettingsError(t *testing.T) {
},
Endpoint: "localhost:1234",
Compression: "gzip",
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.ClientConfig{
Insecure: false,
},
Keepalive: &KeepaliveClientConfig{
Expand Down Expand Up @@ -326,7 +326,7 @@ func TestGRPCClientSettingsError(t *testing.T) {
err: "unsupported compression type \"zlib\"",
settings: ClientConfig{
Endpoint: "localhost:1234",
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.ClientConfig{
Insecure: true,
},
Compression: "zlib",
Expand All @@ -337,7 +337,7 @@ func TestGRPCClientSettingsError(t *testing.T) {
err: "unsupported compression type \"deflate\"",
settings: ClientConfig{
Endpoint: "localhost:1234",
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.ClientConfig{
Insecure: true,
},
Compression: "deflate",
Expand All @@ -348,7 +348,7 @@ func TestGRPCClientSettingsError(t *testing.T) {
err: "unsupported compression type \"bad\"",
settings: ClientConfig{
Endpoint: "localhost:1234",
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.ClientConfig{
Insecure: true,
},
Compression: "bad",
Expand All @@ -374,7 +374,7 @@ func TestUseSecure(t *testing.T) {
Headers: nil,
Endpoint: "",
Compression: "",
TLSSetting: configtls.TLSClientSetting{},
TLSSetting: configtls.ClientConfig{},
Keepalive: nil,
}
dialOpts, err := gcs.toDialOptions(componenttest.NewNopHost(), tt.TelemetrySettings())
Expand Down Expand Up @@ -445,8 +445,8 @@ func TestGRPCServerSettingsError(t *testing.T) {
Endpoint: "127.0.0.1:1234",
Transport: "tcp",
},
TLSSetting: &configtls.TLSServerSetting{
TLSSetting: configtls.TLSSetting{
TLSSetting: &configtls.ServerConfig{
TLSSetting: configtls.Config{
CAFile: "/doesnt/exist",
},
},
Expand All @@ -459,8 +459,8 @@ func TestGRPCServerSettingsError(t *testing.T) {
Endpoint: "127.0.0.1:1234",
Transport: "tcp",
},
TLSSetting: &configtls.TLSServerSetting{
TLSSetting: configtls.TLSSetting{
TLSSetting: &configtls.ServerConfig{
TLSSetting: configtls.Config{
CertFile: "/doesnt/exist",
},
},
Expand All @@ -473,7 +473,7 @@ func TestGRPCServerSettingsError(t *testing.T) {
Endpoint: "127.0.0.1:1234",
Transport: "tcp",
},
TLSSetting: &configtls.TLSServerSetting{
TLSSetting: &configtls.ServerConfig{
ClientCAFile: "/doesnt/exist",
},
},
Expand Down Expand Up @@ -505,42 +505,42 @@ func TestHttpReception(t *testing.T) {

tests := []struct {
name string
tlsServerCreds *configtls.TLSServerSetting
tlsClientCreds *configtls.TLSClientSetting
tlsServerCreds *configtls.ServerConfig
tlsClientCreds *configtls.ClientConfig
hasError bool
}{
{
name: "noTLS",
tlsServerCreds: nil,
tlsClientCreds: &configtls.TLSClientSetting{
tlsClientCreds: &configtls.ClientConfig{
Insecure: true,
},
},
{
name: "TLS",
tlsServerCreds: &configtls.TLSServerSetting{
TLSSetting: configtls.TLSSetting{
tlsServerCreds: &configtls.ServerConfig{
TLSSetting: configtls.Config{
CAFile: filepath.Join("testdata", "ca.crt"),
CertFile: filepath.Join("testdata", "server.crt"),
KeyFile: filepath.Join("testdata", "server.key"),
},
},
tlsClientCreds: &configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
tlsClientCreds: &configtls.ClientConfig{
TLSSetting: configtls.Config{
CAFile: filepath.Join("testdata", "ca.crt"),
},
ServerName: "localhost",
},
},
{
name: "NoServerCertificates",
tlsServerCreds: &configtls.TLSServerSetting{
TLSSetting: configtls.TLSSetting{
tlsServerCreds: &configtls.ServerConfig{
TLSSetting: configtls.Config{
CAFile: filepath.Join("testdata", "ca.crt"),
},
},
tlsClientCreds: &configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
tlsClientCreds: &configtls.ClientConfig{
TLSSetting: configtls.Config{
CAFile: filepath.Join("testdata", "ca.crt"),
},
ServerName: "localhost",
Expand All @@ -549,16 +549,16 @@ func TestHttpReception(t *testing.T) {
},
{
name: "mTLS",
tlsServerCreds: &configtls.TLSServerSetting{
TLSSetting: configtls.TLSSetting{
tlsServerCreds: &configtls.ServerConfig{
TLSSetting: configtls.Config{
CAFile: filepath.Join("testdata", "ca.crt"),
CertFile: filepath.Join("testdata", "server.crt"),
KeyFile: filepath.Join("testdata", "server.key"),
},
ClientCAFile: filepath.Join("testdata", "ca.crt"),
},
tlsClientCreds: &configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
tlsClientCreds: &configtls.ClientConfig{
TLSSetting: configtls.Config{
CAFile: filepath.Join("testdata", "ca.crt"),
CertFile: filepath.Join("testdata", "client.crt"),
KeyFile: filepath.Join("testdata", "client.key"),
Expand All @@ -568,16 +568,16 @@ func TestHttpReception(t *testing.T) {
},
{
name: "NoClientCertificate",
tlsServerCreds: &configtls.TLSServerSetting{
TLSSetting: configtls.TLSSetting{
tlsServerCreds: &configtls.ServerConfig{
TLSSetting: configtls.Config{
CAFile: filepath.Join("testdata", "ca.crt"),
CertFile: filepath.Join("testdata", "server.crt"),
KeyFile: filepath.Join("testdata", "server.key"),
},
ClientCAFile: filepath.Join("testdata", "ca.crt"),
},
tlsClientCreds: &configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
tlsClientCreds: &configtls.ClientConfig{
TLSSetting: configtls.Config{
CAFile: filepath.Join("testdata", "ca.crt"),
},
ServerName: "localhost",
Expand All @@ -586,16 +586,16 @@ func TestHttpReception(t *testing.T) {
},
{
name: "WrongClientCA",
tlsServerCreds: &configtls.TLSServerSetting{
TLSSetting: configtls.TLSSetting{
tlsServerCreds: &configtls.ServerConfig{
TLSSetting: configtls.Config{
CAFile: filepath.Join("testdata", "ca.crt"),
CertFile: filepath.Join("testdata", "server.crt"),
KeyFile: filepath.Join("testdata", "server.key"),
},
ClientCAFile: filepath.Join("testdata", "server.crt"),
},
tlsClientCreds: &configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
tlsClientCreds: &configtls.ClientConfig{
TLSSetting: configtls.Config{
CAFile: filepath.Join("testdata", "ca.crt"),
CertFile: filepath.Join("testdata", "client.crt"),
KeyFile: filepath.Join("testdata", "client.key"),
Expand Down Expand Up @@ -675,7 +675,7 @@ func TestReceiveOnUnixDomainSocket(t *testing.T) {

gcs := &ClientConfig{
Endpoint: "unix://" + ln.Addr().String(),
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.ClientConfig{
Insecure: true,
},
}
Expand Down Expand Up @@ -877,7 +877,7 @@ func TestClientInfoInterceptors(t *testing.T) {
{
gcs := &ClientConfig{
Endpoint: l.Addr().String(),
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.ClientConfig{
Insecure: true,
},
}
Expand Down
4 changes: 2 additions & 2 deletions config/confighttp/confighttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type ClientConfig struct {
ProxyURL string `mapstructure:"proxy_url"`

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

// ReadBufferSize for HTTP client. See http.Transport.ReadBufferSize.
ReadBufferSize int `mapstructure:"read_buffer_size"`
Expand Down Expand Up @@ -256,7 +256,7 @@ type ServerConfig struct {
Endpoint string `mapstructure:"endpoint"`

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

// CORS configures the server for HTTP cross-origin resource sharing (CORS).
CORS *CORSConfig `mapstructure:"cors"`
Expand Down
Loading