Skip to content

Commit b4f2da4

Browse files
author
Monokaix
committed
Add warning msg when TLS verification disabled
Signed-off-by: Monokaix <[email protected]>
1 parent df30fcd commit b4f2da4

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

pkg/scheduler/metrics/source/metrics_client_elasticsearch.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"time"
2727

2828
"github.com/elastic/go-elasticsearch/v7"
29+
"k8s.io/klog/v2"
2930
)
3031

3132
const (
@@ -65,6 +66,10 @@ func NewElasticsearchMetricsClient(conf map[string]string) (*ElasticsearchMetric
6566
}
6667
var err error
6768
insecureSkipVerify := conf["tls.insecureSkipVerify"] == "true"
69+
if insecureSkipVerify {
70+
klog.Warningf("WARNING: TLS certificate verification is disabled which is insecure. This should not be used in production environments")
71+
}
72+
6873
e.es, err = elasticsearch.NewClient(elasticsearch.Config{
6974
Addresses: []string{address},
7075
Username: conf["elasticsearch.username"],

pkg/scheduler/metrics/source/metrics_client_prometheus.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ func (p *PrometheusMetricsClient) NodeMetricsAvg(ctx context.Context, nodeName s
6161
var client api.Client
6262
var err error
6363
insecureSkipVerify := p.conf["tls.insecureSkipVerify"] == "true"
64+
if insecureSkipVerify {
65+
klog.Warningf("WARNING: TLS certificate verification is disabled which is insecure. This should not be used in production environments")
66+
}
67+
6468
tr := &http.Transport{
6569
TLSClientConfig: &tls.Config{
6670
InsecureSkipVerify: insecureSkipVerify,

0 commit comments

Comments
 (0)