Skip to content

Commit 2a392bf

Browse files
committed
Fetching kubelet address:port from kubelet configuration
1 parent c53ce48 commit 2a392bf

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

test/e2e_node/util.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ import (
5858
"github.com/onsi/gomega"
5959
)
6060

61-
// TODO(random-liu): Get this automatically from kubelet flag.
62-
var kubeletAddress = flag.String("kubelet-address", "http://127.0.0.1:10255", "Host and port of the kubelet")
63-
6461
var startServices = flag.Bool("start-services", true, "If true, start local node services")
6562
var stopServices = flag.Bool("stop-services", true, "If true, stop local node services after running tests")
6663
var busyboxImage = imageutils.GetE2EImage(imageutils.BusyBox)
@@ -75,7 +72,11 @@ const (
7572
)
7673

7774
func getNodeSummary() (*kubeletstatsv1alpha1.Summary, error) {
78-
req, err := http.NewRequest("GET", *kubeletAddress+"/stats/summary", nil)
75+
kubeletConfig, err := getCurrentKubeletConfig()
76+
if err != nil {
77+
return nil, fmt.Errorf("failed to get current kubelet config")
78+
}
79+
req, err := http.NewRequest("GET", fmt.Sprintf("http://%s:%d/stats/summary", kubeletConfig.Address, kubeletConfig.ReadOnlyPort), nil)
7980
if err != nil {
8081
return nil, fmt.Errorf("failed to build http request: %v", err)
8182
}

0 commit comments

Comments
 (0)