@@ -21,12 +21,12 @@ import (
2121 "github.com/asaskevich/govalidator"
2222 esV8 "github.com/elastic/go-elasticsearch/v8"
2323 "github.com/olivere/elastic"
24+ "go.opentelemetry.io/collector/config/configtls"
2425 "go.uber.org/zap"
2526 "go.uber.org/zap/zapcore"
2627 "go.uber.org/zap/zapgrpc"
2728
2829 "github.com/jaegertracing/jaeger/pkg/bearertoken"
29- "github.com/jaegertracing/jaeger/pkg/config/tlscfg"
3030 "github.com/jaegertracing/jaeger/pkg/es"
3131 eswrapper "github.com/jaegertracing/jaeger/pkg/es/wrapper"
3232 "github.com/jaegertracing/jaeger/pkg/metrics"
@@ -70,35 +70,34 @@ func (p IndexPrefix) Apply(indexName string) string {
7070
7171// Configuration describes the configuration properties needed to connect to an ElasticSearch cluster
7272type Configuration struct {
73- Servers []string `mapstructure:"server_urls" valid:"required,url"`
74- RemoteReadClusters []string `mapstructure:"remote_read_clusters"`
75- Username string `mapstructure:"username"`
76- Password string `mapstructure:"password" json:"-"`
77- TokenFilePath string `mapstructure:"token_file"`
78- PasswordFilePath string `mapstructure:"password_file"`
79- AllowTokenFromContext bool `mapstructure:"-"`
80- Sniffer bool `mapstructure:"sniffer"` // https://github.com/olivere/elastic/wiki/Sniffing
81- SnifferTLSEnabled bool `mapstructure:"sniffer_tls_enabled"`
82- MaxDocCount int `mapstructure:"-"` // Defines maximum number of results to fetch from storage per query
83- MaxSpanAge time.Duration `mapstructure:"-"` // configures the maximum lookback on span reads
84- Timeout time.Duration `mapstructure:"-"`
85- BulkSize int `mapstructure:"-"`
86- BulkWorkers int `mapstructure:"-"`
87- BulkActions int `mapstructure:"-"`
88- BulkFlushInterval time.Duration `mapstructure:"-"`
89- Indices Indices `mapstructure:"indices"`
90- ServiceCacheTTL time.Duration `mapstructure:"service_cache_ttl"`
91- AdaptiveSamplingLookback time.Duration `mapstructure:"-"`
92- Tags TagsAsFields `mapstructure:"tags_as_fields"`
93- Enabled bool `mapstructure:"-"`
94- // TODO: migration to OTEL's TLS configuration
95- TLS tlscfg.Options `mapstructure:"tls"`
96- UseReadWriteAliases bool `mapstructure:"use_aliases"`
97- CreateIndexTemplates bool `mapstructure:"create_mappings"`
98- UseILM bool `mapstructure:"use_ilm"`
99- Version uint `mapstructure:"version"`
100- LogLevel string `mapstructure:"log_level"`
101- SendGetBodyAs string `mapstructure:"send_get_body_as"`
73+ Servers []string `mapstructure:"server_urls" valid:"required,url"`
74+ RemoteReadClusters []string `mapstructure:"remote_read_clusters"`
75+ Username string `mapstructure:"username"`
76+ Password string `mapstructure:"password" json:"-"`
77+ TokenFilePath string `mapstructure:"token_file"`
78+ PasswordFilePath string `mapstructure:"password_file"`
79+ AllowTokenFromContext bool `mapstructure:"-"`
80+ Sniffer bool `mapstructure:"sniffer"` // https://github.com/olivere/elastic/wiki/Sniffing
81+ SnifferTLSEnabled bool `mapstructure:"sniffer_tls_enabled"`
82+ MaxDocCount int `mapstructure:"-"` // Defines maximum number of results to fetch from storage per query
83+ MaxSpanAge time.Duration `mapstructure:"-"` // configures the maximum lookback on span reads
84+ Timeout time.Duration `mapstructure:"-"`
85+ BulkSize int `mapstructure:"-"`
86+ BulkWorkers int `mapstructure:"-"`
87+ BulkActions int `mapstructure:"-"`
88+ BulkFlushInterval time.Duration `mapstructure:"-"`
89+ Indices Indices `mapstructure:"indices"`
90+ ServiceCacheTTL time.Duration `mapstructure:"service_cache_ttl"`
91+ AdaptiveSamplingLookback time.Duration `mapstructure:"-"`
92+ Tags TagsAsFields `mapstructure:"tags_as_fields"`
93+ Enabled bool `mapstructure:"-"`
94+ TLS configtls.ClientConfig `mapstructure:"tls"`
95+ UseReadWriteAliases bool `mapstructure:"use_aliases"`
96+ CreateIndexTemplates bool `mapstructure:"create_mappings"`
97+ UseILM bool `mapstructure:"use_ilm"`
98+ Version uint `mapstructure:"version"`
99+ LogLevel string `mapstructure:"log_level"`
100+ SendGetBodyAs string `mapstructure:"send_get_body_as"`
102101}
103102
104103// TagsAsFields holds configuration for tag schema.
@@ -440,8 +439,8 @@ func addLoggerOptions(options []elastic.ClientOptionFunc, logLevel string, logge
440439
441440// GetHTTPRoundTripper returns configured http.RoundTripper
442441func GetHTTPRoundTripper (c * Configuration , logger * zap.Logger ) (http.RoundTripper , error ) {
443- if c .TLS .Enabled {
444- ctlsConfig , err := c .TLS .Config ( logger )
442+ if ! c .TLS .Insecure {
443+ ctlsConfig , err := c .TLS .LoadTLSConfig ( context . Background () )
445444 if err != nil {
446445 return nil , err
447446 }
@@ -454,10 +453,10 @@ func GetHTTPRoundTripper(c *Configuration, logger *zap.Logger) (http.RoundTrippe
454453 httpTransport := & http.Transport {
455454 Proxy : http .ProxyFromEnvironment ,
456455 // #nosec G402
457- TLSClientConfig : & tls.Config {InsecureSkipVerify : c .TLS .SkipHostVerify },
456+ TLSClientConfig : & tls.Config {InsecureSkipVerify : c .TLS .InsecureSkipVerify },
458457 }
459- if c .TLS .CAPath != "" {
460- ctlsConfig , err := c .TLS .Config ( logger )
458+ if c .TLS .CAFile != "" {
459+ ctlsConfig , err := c .TLS .LoadTLSConfig ( context . Background () )
461460 if err != nil {
462461 return nil , err
463462 }
0 commit comments