Skip to content

Commit d34b027

Browse files
authored
dynamic resource allocation: add timeouts for communiction with plugin (kubernetes#114844)
* add timeouts for communication with dra plugin * move timeout constant to k8s.io/kubernetes/pkg/kubelet/cm/util * move settings of timeout to pkg/kubelet/plugin/dra/plugin/client.go * remove timeout constant
1 parent 185cd95 commit d34b027

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/kubelet/cm/dra/plugin/client.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"fmt"
2323
"io"
2424
"net"
25+
"time"
2526

2627
"google.golang.org/grpc"
2728
"google.golang.org/grpc/credentials/insecure"
@@ -131,6 +132,9 @@ func (r *draPluginClient) NodePrepareResource(
131132
ResourceHandle: resourceHandle,
132133
}
133134

135+
ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
136+
defer cancel()
137+
134138
return nodeClient.NodePrepareResource(ctx, req)
135139
}
136140

@@ -165,6 +169,9 @@ func (r *draPluginClient) NodeUnprepareResource(
165169
CdiDevices: cdiDevices,
166170
}
167171

172+
ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
173+
defer cancel()
174+
168175
return nodeClient.NodeUnprepareResource(ctx, req)
169176
}
170177

0 commit comments

Comments
 (0)