@@ -18,6 +18,7 @@ import (
18
18
"bufio"
19
19
"bytes"
20
20
"context"
21
+ "crypto/tls"
21
22
"flag"
22
23
"fmt"
23
24
"io"
@@ -65,6 +66,7 @@ type xpuManagerSidecar struct {
65
66
xpumPort uint64
66
67
laneCount uint64
67
68
allowSubdevicelessLinks bool
69
+ useHTTPS bool
68
70
}
69
71
70
72
func (e * invalidEntryErr ) Error () string {
@@ -76,6 +78,14 @@ func (xms *xpuManagerSidecar) getMetricsDataFromXPUM() []byte {
76
78
Timeout : 5 * time .Second ,
77
79
}
78
80
81
+ if xms .useHTTPS {
82
+ customTransport := http .DefaultTransport .(* http.Transport ).Clone ()
83
+ //#nosec
84
+ customTransport .TLSClientConfig = & tls.Config {InsecureSkipVerify : true }
85
+
86
+ client .Transport = customTransport
87
+ }
88
+
79
89
ctx := context .Background ()
80
90
81
91
req , err := http .NewRequestWithContext (ctx , http .MethodGet , xms .url , http .NoBody )
@@ -369,6 +379,7 @@ func main() {
369
379
flag .Uint64Var (& xms .laneCount , "lane-count" , 4 , "minimum lane count for xelink" )
370
380
flag .StringVar (& xms .labelNamespace , "label-namespace" , "gpu.intel.com" , "namespace for the labels" )
371
381
flag .BoolVar (& xms .allowSubdevicelessLinks , "allow-subdeviceless-links" , false , "allow xelinks that are not tied to subdevices (=1 tile GPUs)" )
382
+ flag .BoolVar (& xms .useHTTPS , "use-https" , false , "Use HTTPS protocol to connect to xpumanager" )
372
383
klog .InitFlags (nil )
373
384
374
385
flag .Parse ()
@@ -377,7 +388,12 @@ func main() {
377
388
klog .Fatal ("zero interval won't work, set it to at least 1" )
378
389
}
379
390
380
- xms .url = fmt .Sprintf ("http://127.0.0.1:%d/metrics" , xms .xpumPort )
391
+ protocol := "http"
392
+ if xms .useHTTPS {
393
+ protocol = "https"
394
+ }
395
+
396
+ xms .url = fmt .Sprintf ("%s://127.0.0.1:%d/metrics" , protocol , xms .xpumPort )
381
397
382
398
keepIterating := true
383
399
0 commit comments