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

[chore] update core #32394

Merged
merged 6 commits into from
Apr 16, 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
Next Next commit
update LoadTLSConfigContext -> LoadTLSConfig
Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
  • Loading branch information
codeboten committed Apr 16, 2024
commit 95a60ac453e1b808722db9a5cba903c0985b3c74
2 changes: 1 addition & 1 deletion cmd/opampsupervisor/supervisor/supervisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ func (s *Supervisor) Capabilities() protobufs.AgentCapabilities {
func (s *Supervisor) startOpAMP() error {
s.opampClient = client.NewWebSocket(newLoggerFromZap(s.logger))

tlsConfig, err := s.config.Server.TLSSetting.LoadTLSConfigContext(context.Background())
tlsConfig, err := s.config.Server.TLSSetting.LoadTLSConfig(context.Background())
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion exporter/elasticsearchexporter/elasticsearch_bulk.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (*clientLogger) ResponseBodyEnabled() bool {
}

func newElasticsearchClient(logger *zap.Logger, config *Config) (*esClientCurrent, error) {
tlsCfg, err := config.ClientConfig.LoadTLSConfigContext(context.Background())
tlsCfg, err := config.ClientConfig.LoadTLSConfig(context.Background())
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion exporter/prometheusexporter/prometheus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func TestPrometheusExporter_WithTLS(t *testing.T) {
},
ServerName: "localhost",
}
tls, err := tlscs.LoadTLSConfigContext(context.Background())
tls, err := tlscs.LoadTLSConfig(context.Background())
assert.NoError(t, err)
httpClient := &http.Client{
Transport: &http.Transport{
Expand Down
2 changes: 1 addition & 1 deletion exporter/signalfxexporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (se *signalfxExporter) start(ctx context.Context, host component.Host) (err
sendOTLPHistograms: se.config.SendOTLPHistograms,
}

apiTLSCfg, err := se.config.APITLSSettings.LoadTLSConfigContext(ctx)
apiTLSCfg, err := se.config.APITLSSettings.LoadTLSConfig(ctx)
if err != nil {
return fmt.Errorf("could not load API TLS config: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion exporter/signalfxexporter/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1522,7 +1522,7 @@ func TestTLSAPIConnection(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
observedZapCore, observedLogs := observer.New(zap.DebugLevel)
logger := zap.New(observedZapCore)
apiTLSCfg, err := tt.config.APITLSSettings.LoadTLSConfigContext(context.Background())
apiTLSCfg, err := tt.config.APITLSSettings.LoadTLSConfig(context.Background())
require.NoError(t, err)
serverURL, err := url.Parse(tt.config.APIURL)
assert.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion exporter/syslogexporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func initExporter(cfg *Config, createSettings exporter.CreateSettings) (*sysloge
var loadedTLSConfig *tls.Config
if cfg.Network == "tcp" {
var err error
loadedTLSConfig, err = cfg.TLSSetting.LoadTLSConfigContext(context.Background())
loadedTLSConfig, err = cfg.TLSSetting.LoadTLSConfig(context.Background())
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion extension/oauth2clientauthextension/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var errFailedToGetSecurityToken = fmt.Errorf("failed to get security token from
func newClientAuthenticator(cfg *Config, logger *zap.Logger) (*clientAuthenticator, error) {
transport := http.DefaultTransport.(*http.Transport).Clone()

tlsCfg, err := cfg.TLSSetting.LoadTLSConfigContext(context.Background())
tlsCfg, err := cfg.TLSSetting.LoadTLSConfig(context.Background())
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions extension/oauth2clientauthextension/extension_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func TestOAuthClientSettings(t *testing.T) {
// test tls settings
transport := rc.client.Transport.(*http.Transport)
tlsClientConfig := transport.TLSClientConfig
tlsTestSettingConfig, err := test.settings.TLSSetting.LoadTLSConfigContext(context.Background())
tlsTestSettingConfig, err := test.settings.TLSSetting.LoadTLSConfig(context.Background())
assert.NoError(t, err)
assert.Equal(t, tlsClientConfig.Certificates, tlsTestSettingConfig.Certificates)
})
Expand Down Expand Up @@ -190,7 +190,7 @@ func TestOAuthClientSettingsCredsConfig(t *testing.T) {
// test tls settings
transport := rc.client.Transport.(*http.Transport)
tlsClientConfig := transport.TLSClientConfig
tlsTestSettingConfig, err := test.settings.TLSSetting.LoadTLSConfigContext(context.Background())
tlsTestSettingConfig, err := test.settings.TLSSetting.LoadTLSConfig(context.Background())
assert.NoError(t, err)
assert.Equal(t, tlsClientConfig.Certificates, tlsTestSettingConfig.Certificates)
})
Expand Down
2 changes: 1 addition & 1 deletion extension/opampextension/opamp_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (o *opampAgent) Start(ctx context.Context, _ component.Host) error {
header.Set(k, string(v))
}

tls, err := o.cfg.Server.GetTLSSetting().LoadTLSConfigContext(ctx)
tls, err := o.cfg.Server.GetTLSSetting().LoadTLSConfig(ctx)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/kafka/authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func configureSASL(config SASLConfig, saramaConfig *sarama.Config) error {
}

func configureTLS(config configtls.ClientConfig, saramaConfig *sarama.Config) error {
tlsConfig, err := config.LoadTLSConfigContext(context.Background())
tlsConfig, err := config.LoadTLSConfig(context.Background())
if err != nil {
return fmt.Errorf("error loading tls config: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/kafka/authentication_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestAuthentication(t *testing.T) {
saramaTLSCfg := &sarama.Config{}
saramaTLSCfg.Net.TLS.Enable = true
tlsClient := configtls.ClientConfig{}
tlscfg, err := tlsClient.LoadTLSConfigContext(context.Background())
tlscfg, err := tlsClient.LoadTLSConfig(context.Background())
require.NoError(t, err)
saramaTLSCfg.Net.TLS.Config = tlscfg

Expand Down
2 changes: 1 addition & 1 deletion pkg/stanza/operator/input/tcp/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func (c Config) Build(logger *zap.SugaredLogger) (operator.Operator, error) {
}

if c.TLS != nil {
tcpInput.tls, err = c.TLS.LoadTLSConfigContext(context.Background())
tcpInput.tls, err = c.TLS.LoadTLSConfig(context.Background())
if err != nil {
return nil, err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func NewDetector(set processor.CreateSettings, dcfg internal.DetectorConfig) (in
return nil, err
}

tlsCfg, err := userCfg.TLSSettings.LoadTLSConfigContext(context.Background())
tlsCfg, err := userCfg.TLSSettings.LoadTLSConfig(context.Background())
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion receiver/aerospikereceiver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (c *Config) Validate() error {
}

if c.TLS != nil {
_, err := c.TLS.LoadTLSConfigContext(context.Background())
_, err := c.TLS.LoadTLSConfig(context.Background())
if err != nil {
allErrs = multierr.Append(allErrs, fmt.Errorf("%w: %s", errFailedTLSLoad, err.Error()))
}
Expand Down
2 changes: 1 addition & 1 deletion receiver/aerospikereceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func newAerospikeReceiver(params receiver.CreateSettings, cfg *Config, consumer
var err error
var tlsCfg *tls.Config
if cfg.TLS != nil {
tlsCfg, err = cfg.TLS.LoadTLSConfigContext(context.Background())
tlsCfg, err = cfg.TLS.LoadTLSConfig(context.Background())
if err != nil {
return nil, fmt.Errorf("%w: %s", errFailedTLSLoad, err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion receiver/cloudflarereceiver/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func newLogsReceiver(params rcvr.CreateSettings, cfg *Config, consumer consumer.
}

if recv.cfg.TLS != nil {
tlsConfig, err := recv.cfg.TLS.LoadTLSConfigContext(context.Background())
tlsConfig, err := recv.cfg.TLS.LoadTLSConfig(context.Background())
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion receiver/mongodbatlasreceiver/alerts.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func newAlertsReceiver(params rcvr.CreateSettings, baseConfig *Config, consumer
if cfg.TLS != nil {
var err error

tlsConfig, err = cfg.TLS.LoadTLSConfigContext(context.Background())
tlsConfig, err = cfg.TLS.LoadTLSConfig(context.Background())
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions receiver/mongodbreceiver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (c *Config) Validate() error {
err = multierr.Append(err, errors.New("password provided without user"))
}

if _, tlsErr := c.LoadTLSConfigContext(context.Background()); tlsErr != nil {
if _, tlsErr := c.LoadTLSConfig(context.Background()); tlsErr != nil {
err = multierr.Append(err, fmt.Errorf("error loading tls configuration: %w", tlsErr))
}

Expand All @@ -66,7 +66,7 @@ func (c *Config) ClientOptions() *options.ClientOptions {
clientOptions.SetConnectTimeout(c.Timeout)
}

tlsConfig, err := c.LoadTLSConfigContext(context.Background())
tlsConfig, err := c.LoadTLSConfig(context.Background())
if err == nil && tlsConfig != nil {
clientOptions.SetTLSConfig(tlsConfig)
}
Expand Down
2 changes: 1 addition & 1 deletion receiver/mysqlreceiver/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ type ReplicaStatusStats struct {
var _ client = (*mySQLClient)(nil)

func newMySQLClient(conf *Config) (client, error) {
tls, err := conf.TLS.LoadTLSConfigContext(context.Background())
tls, err := conf.TLS.LoadTLSConfig(context.Background())
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion receiver/redisreceiver/redis_scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func newRedisScraper(cfg *Config, settings receiver.CreateSettings) (scraperhelp
}

var err error
if opts.TLSConfig, err = cfg.TLS.LoadTLSConfigContext(context.Background()); err != nil {
if opts.TLSConfig, err = cfg.TLS.LoadTLSConfig(context.Background()); err != nil {
return nil, err
}
return newRedisScraperWithClient(newRedisClient(opts), settings, cfg)
Expand Down
2 changes: 1 addition & 1 deletion receiver/saphanareceiver/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (c *sapHanaClient) Connect(ctx context.Context) error {
return fmt.Errorf("error generating DSN for SAP HANA connection: %w", err)
}

tls, err := c.receiverConfig.ClientConfig.LoadTLSConfigContext(ctx)
tls, err := c.receiverConfig.ClientConfig.LoadTLSConfig(ctx)
if err != nil {
return fmt.Errorf("error generating TLS config for SAP HANA connection: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion receiver/sapmreceiver/trace_receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func sendSapm(
},
ServerName: "localhost",
}
tls, errTLS := tlscs.LoadTLSConfigContext(context.Background())
tls, errTLS := tlscs.LoadTLSConfig(context.Background())
if errTLS != nil {
return nil, fmt.Errorf("failed to send request to receiver %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion receiver/signalfxreceiver/receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ func Test_sfxReceiver_TLS(t *testing.T) {
},
ServerName: "localhost",
}
tls, errTLS := tlscs.LoadTLSConfigContext(context.Background())
tls, errTLS := tlscs.LoadTLSConfig(context.Background())
assert.NoError(t, errTLS)
client := &http.Client{
Transport: &http.Transport{
Expand Down
2 changes: 1 addition & 1 deletion receiver/simpleprometheusreceiver/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func getPrometheusConfig(cfg *Config) (*prometheusreceiver.Config, error) {

scheme := "http"

tlsConfig, err := cfg.TLSSetting.LoadTLSConfigContext(context.Background())
tlsConfig, err := cfg.TLSSetting.LoadTLSConfig(context.Background())
if err != nil {
return nil, fmt.Errorf("tls config is not valid: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion receiver/solacereceiver/messaging_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func newAMQPMessagingServiceFactory(cfg *Config, logger *zap.Logger) (messagingS

// Use the default load config for TLS. Note that in the case where "insecure" is true and no
// ca file is provided, tlsConfig will be nil representing a plaintext connection.
loadedTLSConfig, err := cfg.TLS.LoadTLSConfigContext(context.Background())
loadedTLSConfig, err := cfg.TLS.LoadTLSConfig(context.Background())
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion receiver/splunkhecreceiver/receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ func Test_splunkhecReceiver_TLS(t *testing.T) {
},
ServerName: "localhost",
}
tls, errTLS := tlscs.LoadTLSConfigContext(context.Background())
tls, errTLS := tlscs.LoadTLSConfig(context.Background())
assert.NoError(t, errTLS)
client := &http.Client{
Transport: &http.Transport{
Expand Down
2 changes: 1 addition & 1 deletion receiver/vcenterreceiver/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (vc *vcenterClient) EnsureConnection(ctx context.Context) error {
if err != nil {
return fmt.Errorf("unable to connect to vSphere SDK on listed endpoint: %w", err)
}
tlsCfg, err := vc.cfg.LoadTLSConfigContext(ctx)
tlsCfg, err := vc.cfg.LoadTLSConfig(ctx)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion receiver/vcenterreceiver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (c *Config) Validate() error {
err = multierr.Append(err, errors.New("password not provided and is required"))
}

if _, tlsErr := c.LoadTLSConfigContext(context.Background()); err != nil {
if _, tlsErr := c.LoadTLSConfig(context.Background()); err != nil {
err = multierr.Append(err, fmt.Errorf("error loading tls configuration: %w", tlsErr))
}

Expand Down