Skip to content

Commit 532f2fe

Browse files
tkatilauniemimu
authored andcommitted
gpu/rm: add error check in kubelet flow
Signed-off-by: Tuomas Katila <[email protected]>
1 parent 5411b0a commit 532f2fe

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

cmd/gpu_plugin/rm/gpu_plugin_resource_manager.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,14 @@ func (rm *resourceManager) listPodsFromKubelet() (*v1.PodList, error) {
279279
// https://github.com/cyberark/kubeletctl
280280

281281
kubeletURL := "https://" + rm.hostIP + ":10250/pods"
282-
req, _ := http.NewRequestWithContext(context.Background(), "GET", kubeletURL, nil)
282+
283+
req, err := http.NewRequestWithContext(context.Background(), "GET", kubeletURL, nil)
284+
if err != nil {
285+
klog.Warning("Failure creating new request: ", err)
286+
287+
return &podList, err
288+
}
289+
283290
req.Header.Set("Authorization", "Bearer "+string(token))
284291

285292
tr := &http.Transport{

0 commit comments

Comments
 (0)