Skip to content

Commit

Permalink
Remove use of deprecated configtls structs
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerHelmuth committed Mar 18, 2024
1 parent 5bf424d commit 8ce705f
Show file tree
Hide file tree
Showing 143 changed files with 361 additions and 361 deletions.
2 changes: 1 addition & 1 deletion cmd/configschema/comments_test.go
Expand Up @@ -35,7 +35,7 @@ func TestExternalType(t *testing.T) {
}

func TestSubPackage(t *testing.T) {
s := configtls.TLSClientSetting{}
s := configtls.ClientConfig{}
v := reflect.ValueOf(s)
_, err := commentsForStruct(v, testDR())
require.NoError(t, err)
Expand Down
14 changes: 7 additions & 7 deletions cmd/configschema/common_test.go
Expand Up @@ -22,13 +22,13 @@ type testStruct struct {
Four bool `mapstructure:"four"`
// embedded, package qualified comment
time.Duration `mapstructure:"duration"`
Squashed testPerson `mapstructure:",squash"`
PersonPtr *testPerson `mapstructure:"person_ptr"`
PersonStruct testPerson `mapstructure:"person_struct"`
Persons []testPerson `mapstructure:"persons"`
PersonPtrs []*testPerson `mapstructure:"person_ptrs"`
Ignored string `mapstructure:"-"`
TLS configtls.TLSClientSetting `mapstructure:"tls"`
Squashed testPerson `mapstructure:",squash"`
PersonPtr *testPerson `mapstructure:"person_ptr"`
PersonStruct testPerson `mapstructure:"person_struct"`
Persons []testPerson `mapstructure:"persons"`
PersonPtrs []*testPerson `mapstructure:"person_ptrs"`
Ignored string `mapstructure:"-"`
TLS configtls.ClientConfig `mapstructure:"tls"`
}

func testDR() DirResolver {
Expand Down
4 changes: 2 additions & 2 deletions cmd/configschema/docsgen/docsgen/template.go
Expand Up @@ -28,14 +28,14 @@ func join(s string) string {
return strings.ReplaceAll(s, "\n", " ")
}

// mkAnchor takes a name and a type (e.g. "configtls.TLSClientSetting") and
// mkAnchor takes a name and a type (e.g. "configtls.ClientConfig") and
// returns a string suitable for use as a markdown anchor.
func mkAnchor(name, typ string) string {
if isDuration(typ) {
return "time-Duration"
}
idx := strings.IndexRune(typ, '.')
// strip "configtls." from e.g. "configtls.TLSClientSetting"
// strip "configtls." from e.g. "configtls.ClientConfig"
typeStripped := typ[idx+1:]
concat := fmt.Sprintf("%s-%s", name, typeStripped)
asterisksRemoved := strings.ReplaceAll(concat, "*", "")
Expand Down
4 changes: 2 additions & 2 deletions cmd/configschema/docsgen/docsgen/testdata/otlp-receiver.json
Expand Up @@ -37,7 +37,7 @@
},
{
"Name": "tls_settings",
"Type": "*configtls.TLSServerSetting",
"Type": "*configtls.ServerConfig",
"Kind": "ptr",
"Default": null,
"Doc": "Configures the protocol to use TLS.\nThe default value is nil, which will cause the protocol to not use TLS.\n",
Expand Down Expand Up @@ -276,7 +276,7 @@
},
{
"Name": "tls_settings",
"Type": "*configtls.TLSServerSetting",
"Type": "*configtls.ServerConfig",
"Kind": "ptr",
"Default": null,
"Doc": "TLSSetting struct exposes TLS client configuration.\n",
Expand Down
2 changes: 1 addition & 1 deletion cmd/opampsupervisor/examples/supervisor_darwin.yaml
Expand Up @@ -4,7 +4,7 @@ server:
# Disable verification to test locally.
# Don't do this in production.
insecure_skip_verify: true
# For more TLS settings see config/configtls.TLSClientSetting
# For more TLS settings see config/configtls.ClientConfig

capabilities:
reports_effective_config: true
Expand Down
2 changes: 1 addition & 1 deletion cmd/opampsupervisor/examples/supervisor_linux.yaml
Expand Up @@ -4,7 +4,7 @@ server:
# Disable verification to test locally.
# Don't do this in production.
insecure_skip_verify: true
# For more TLS settings see config/configtls.TLSClientSetting
# For more TLS settings see config/configtls.ClientConfig

capabilities:
reports_effective_config: true
Expand Down
2 changes: 1 addition & 1 deletion cmd/opampsupervisor/examples/supervisor_windows.yaml
Expand Up @@ -4,7 +4,7 @@ server:
# Disable verification to test locally.
# Don't do this in production.
insecure_skip_verify: true
# For more TLS settings see config/configtls.TLSClientSetting
# For more TLS settings see config/configtls.ClientConfig

capabilities:
reports_effective_config: true
Expand Down
2 changes: 1 addition & 1 deletion cmd/opampsupervisor/supervisor/config/config.go
Expand Up @@ -25,7 +25,7 @@ type Capabilities struct {

type OpAMPServer struct {
Endpoint string
TLSSetting configtls.TLSClientSetting `mapstructure:"tls,omitempty"`
TLSSetting configtls.ClientConfig `mapstructure:"tls,omitempty"`
}

type Agent struct {
Expand Down
10 changes: 5 additions & 5 deletions exporter/alertmanagerexporter/alertmanager_exporter_test.go
Expand Up @@ -347,7 +347,7 @@ func TestClientConfig(t *testing.T) {
config: &Config{
ClientConfig: confighttp.ClientConfig{
Endpoint: endpoint,
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.ClientConfig{
Insecure: false,
},
},
Expand All @@ -370,8 +370,8 @@ func TestClientConfig(t *testing.T) {
config: &Config{
ClientConfig: confighttp.ClientConfig{
Endpoint: endpoint,
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
TLSSetting: configtls.ClientConfig{
TLSSetting: configtls.Config{
CAFile: "testdata/test_cert.pem",
},
},
Expand All @@ -383,8 +383,8 @@ func TestClientConfig(t *testing.T) {
config: &Config{
ClientConfig: confighttp.ClientConfig{
Endpoint: endpoint,
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
TLSSetting: configtls.ClientConfig{
TLSSetting: configtls.Config{
CAFile: "nosuchfile",
},
},
Expand Down
4 changes: 2 additions & 2 deletions exporter/alertmanagerexporter/config_test.go
Expand Up @@ -69,8 +69,8 @@ func TestLoadConfig(t *testing.T) {
"another": "somevalue",
},
Endpoint: "a.new.alertmanager.target:9093",
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
TLSSetting: configtls.ClientConfig{
TLSSetting: configtls.Config{
CAFile: "/var/lib/mycert.pem",
},
},
Expand Down
16 changes: 8 additions & 8 deletions exporter/coralogixexporter/config_test.go
Expand Up @@ -60,8 +60,8 @@ func TestLoadConfig(t *testing.T) {
Traces: configgrpc.ClientConfig{
Endpoint: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
Compression: configcompression.TypeGzip,
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{},
TLSSetting: configtls.ClientConfig{
TLSSetting: configtls.Config{},
Insecure: false,
InsecureSkipVerify: false,
ServerName: "",
Expand All @@ -73,8 +73,8 @@ func TestLoadConfig(t *testing.T) {
},
ClientConfig: configgrpc.ClientConfig{
Endpoint: "https://",
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{},
TLSSetting: configtls.ClientConfig{
TLSSetting: configtls.Config{},
Insecure: false,
InsecureSkipVerify: false,
ServerName: "",
Expand Down Expand Up @@ -115,8 +115,8 @@ func TestLoadConfig(t *testing.T) {
Traces: configgrpc.ClientConfig{
Endpoint: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
Compression: configcompression.TypeGzip,
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{},
TLSSetting: configtls.ClientConfig{
TLSSetting: configtls.Config{},
Insecure: false,
InsecureSkipVerify: false,
ServerName: "",
Expand All @@ -130,8 +130,8 @@ func TestLoadConfig(t *testing.T) {
SubSystemAttributes: []string{"service.name", "k8s.deployment.name", "k8s.statefulset.name", "k8s.daemonset.name", "k8s.cronjob.name", "k8s.job.name", "k8s.container.name"},
ClientConfig: configgrpc.ClientConfig{
Endpoint: "https://",
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{},
TLSSetting: configtls.ClientConfig{
TLSSetting: configtls.Config{},
Insecure: false,
InsecureSkipVerify: false,
ServerName: "",
Expand Down
8 changes: 4 additions & 4 deletions exporter/coralogixexporter/factory_test.go
Expand Up @@ -92,7 +92,7 @@ func TestCreateTracesExporter(t *testing.T) {
config: &Config{
Traces: configgrpc.ClientConfig{
Endpoint: endpoint,
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.ClientConfig{
Insecure: false,
},
},
Expand Down Expand Up @@ -172,8 +172,8 @@ func TestCreateTracesExporter(t *testing.T) {
config: &Config{
Traces: configgrpc.ClientConfig{
Endpoint: endpoint,
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
TLSSetting: configtls.ClientConfig{
TLSSetting: configtls.Config{
CAFile: "nosuchfile",
},
},
Expand All @@ -186,7 +186,7 @@ func TestCreateTracesExporter(t *testing.T) {
config: &Config{
Domain: "localhost",
DomainSettings: configgrpc.ClientConfig{
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.ClientConfig{
Insecure: false,
},
},
Expand Down
4 changes: 2 additions & 2 deletions exporter/dynatraceexporter/metrics_exporter_test.go
Expand Up @@ -689,8 +689,8 @@ func Test_exporter_start_InvalidClientConfig(t *testing.T) {
cfg := &config.Config{
ClientConfig: confighttp.ClientConfig{
Endpoint: "localhost:9090",
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
TLSSetting: configtls.ClientConfig{
TLSSetting: configtls.Config{
CAFile: "/non/existent",
},
},
Expand Down
2 changes: 1 addition & 1 deletion exporter/elasticsearchexporter/config.go
Expand Up @@ -90,7 +90,7 @@ type ClientConfig struct {
// will be send with each HTTP request.
Headers map[string]string `mapstructure:"headers,omitempty"`

configtls.TLSClientSetting `mapstructure:"tls,omitempty"`
configtls.ClientConfig `mapstructure:"tls,omitempty"`
}

// AuthenticationSettings defines user authentication related settings.
Expand Down
2 changes: 1 addition & 1 deletion exporter/elasticsearchexporter/elasticsearch_bulk.go
Expand Up @@ -65,7 +65,7 @@ func (*clientLogger) ResponseBodyEnabled() bool {
}

func newElasticsearchClient(logger *zap.Logger, config *Config) (*esClientCurrent, error) {
tlsCfg, err := config.TLSClientSetting.LoadTLSConfig()
tlsCfg, err := config.ClientConfig.LoadTLSConfig()
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions exporter/instanaexporter/config_test.go
Expand Up @@ -29,8 +29,8 @@ func TestConfigValidate(t *testing.T) {

t.Run("Valid configuration with ca_file", func(t *testing.T) {
c := &Config{Endpoint: "https://example.com/", AgentKey: "key1", ClientConfig: confighttp.ClientConfig{
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
TLSSetting: configtls.ClientConfig{
TLSSetting: configtls.Config{
CAFile: "ca.crt",
},
},
Expand Down
8 changes: 4 additions & 4 deletions exporter/instanaexporter/exporter_test.go
Expand Up @@ -84,8 +84,8 @@ func TestSelfSignedBackend(t *testing.T) {
AgentKey: "key11",
ClientConfig: confighttp.ClientConfig{
Endpoint: server.URL,
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
TLSSetting: configtls.ClientConfig{
TLSSetting: configtls.Config{
CAFile: caFile,
},
},
Expand All @@ -110,8 +110,8 @@ func TestSelfSignedBackendCAFileNotFound(t *testing.T) {
AgentKey: "key11",
ClientConfig: confighttp.ClientConfig{
Endpoint: "",
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
TLSSetting: configtls.ClientConfig{
TLSSetting: configtls.Config{
CAFile: "ca_file_not_found.pem",
},
},
Expand Down
4 changes: 2 additions & 2 deletions exporter/instanaexporter/factory_test.go
Expand Up @@ -79,8 +79,8 @@ func TestLoadConfig(t *testing.T) {
Timeout: 30 * time.Second,
Headers: map[string]configopaque.String{},
WriteBufferSize: 512 * 1024,
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
TLSSetting: configtls.ClientConfig{
TLSSetting: configtls.Config{
CAFile: "ca.crt",
},
},
Expand Down
4 changes: 2 additions & 2 deletions exporter/kafkaexporter/kafka_exporter_test.go
Expand Up @@ -87,8 +87,8 @@ func TestNewExporter_err_auth_type(t *testing.T) {
c := Config{
ProtocolVersion: "2.0.0",
Authentication: kafka.Authentication{
TLS: &configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
TLS: &configtls.ClientConfig{
TLSSetting: configtls.Config{
CAFile: "/doesnotexist",
},
},
Expand Down
4 changes: 2 additions & 2 deletions exporter/lokiexporter/config_test.go
Expand Up @@ -41,8 +41,8 @@ func TestLoadConfigNewExporter(t *testing.T) {
"X-Custom-Header": "loki_rocks",
},
Endpoint: "https://loki:3100/loki/api/v1/push",
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
TLSSetting: configtls.ClientConfig{
TLSSetting: configtls.Config{
CAFile: "/var/lib/mycert.pem",
CertFile: "certfile",
KeyFile: "keyfile",
Expand Down
4 changes: 2 additions & 2 deletions exporter/opencensusexporter/config_test.go
Expand Up @@ -57,8 +57,8 @@ func TestLoadConfig(t *testing.T) {
},
Endpoint: "1.2.3.4:1234",
Compression: "gzip",
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
TLSSetting: configtls.ClientConfig{
TLSSetting: configtls.Config{
CAFile: "/var/lib/mycert.pem",
},
Insecure: false,
Expand Down
12 changes: 6 additions & 6 deletions exporter/opencensusexporter/factory_test.go
Expand Up @@ -49,7 +49,7 @@ func TestCreateTracesExporter(t *testing.T) {
config: &Config{
ClientConfig: configgrpc.ClientConfig{
Endpoint: endpoint,
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.ClientConfig{
Insecure: false,
},
},
Expand All @@ -62,7 +62,7 @@ func TestCreateTracesExporter(t *testing.T) {
config: &Config{
ClientConfig: configgrpc.ClientConfig{
Endpoint: endpoint,
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.ClientConfig{
Insecure: false,
},
},
Expand Down Expand Up @@ -123,8 +123,8 @@ func TestCreateTracesExporter(t *testing.T) {
config: &Config{
ClientConfig: configgrpc.ClientConfig{
Endpoint: endpoint,
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
TLSSetting: configtls.ClientConfig{
TLSSetting: configtls.Config{
CAFile: "testdata/test_cert.pem",
},
},
Expand All @@ -137,8 +137,8 @@ func TestCreateTracesExporter(t *testing.T) {
config: &Config{
ClientConfig: configgrpc.ClientConfig{
Endpoint: endpoint,
TLSSetting: configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
TLSSetting: configtls.ClientConfig{
TLSSetting: configtls.Config{
CAFile: "nosuchfile",
},
},
Expand Down

0 comments on commit 8ce705f

Please sign in to comment.