From 9cb314e7d27bfdbcbba3e38f7d4ff86e26f018c4 Mon Sep 17 00:00:00 2001 From: okankoAMZ <107267850+okankoAMZ@users.noreply.github.com> Date: Fri, 1 Mar 2024 17:15:17 -0500 Subject: [PATCH] Adding default TLS to dcgmscraper (#178) --- .../internal/gpu/dcgmscraper.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/receiver/awscontainerinsightreceiver/internal/gpu/dcgmscraper.go b/receiver/awscontainerinsightreceiver/internal/gpu/dcgmscraper.go index fc0d332357a4..db7bdc184425 100644 --- a/receiver/awscontainerinsightreceiver/internal/gpu/dcgmscraper.go +++ b/receiver/awscontainerinsightreceiver/internal/gpu/dcgmscraper.go @@ -9,6 +9,7 @@ import ( "fmt" "time" + configutil "github.com/prometheus/common/config" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/config" "github.com/prometheus/prometheus/discovery" @@ -25,7 +26,7 @@ import ( ) const ( - caFile = "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt" + caFile = "/etc/amazon-cloudwatch-observability-agent-cert/tls-ca.crt" collectionInterval = 60 * time.Second jobName = "containerInsightsDCGMExporterScraper" scraperMetricsPath = "/metrics" @@ -103,10 +104,16 @@ func NewDcgmScraper(opts DcgmScraperOpts) (*DcgmScraper, error) { func getScraperConfig(hostInfoProvider hostInfoProvider) *config.ScrapeConfig { return &config.ScrapeConfig{ + HTTPClientConfig: configutil.HTTPClientConfig{ + TLSConfig: configutil.TLSConfig{ + CAFile: caFile, + InsecureSkipVerify: false, + }, + }, ScrapeInterval: model.Duration(collectionInterval), ScrapeTimeout: model.Duration(collectionInterval), JobName: jobName, - Scheme: "http", + Scheme: "https", MetricsPath: scraperMetricsPath, ServiceDiscoveryConfigs: discovery.Configs{ &kubernetes.SDConfig{