From 50cb3268b6677ec7f381d957bfd926275572d320 Mon Sep 17 00:00:00 2001 From: Ed Bartosh Date: Mon, 13 Mar 2023 23:51:53 +0200 Subject: [PATCH] DRA: add constant PluginClientTimeout --- pkg/kubelet/cm/dra/plugin/client.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/kubelet/cm/dra/plugin/client.go b/pkg/kubelet/cm/dra/plugin/client.go index 74ece2c6ef8b8..c6bc30271aa89 100644 --- a/pkg/kubelet/cm/dra/plugin/client.go +++ b/pkg/kubelet/cm/dra/plugin/client.go @@ -32,6 +32,8 @@ import ( drapbv1 "k8s.io/kubelet/pkg/apis/dra/v1alpha1" ) +const PluginClientTimeout = 10 * time.Second + type Client interface { NodePrepareResource( ctx context.Context, @@ -132,7 +134,7 @@ func (r *draPluginClient) NodePrepareResource( ResourceHandle: resourceHandle, } - ctx, cancel := context.WithTimeout(ctx, 10*time.Second) + ctx, cancel := context.WithTimeout(ctx, PluginClientTimeout) defer cancel() return nodeClient.NodePrepareResource(ctx, req) @@ -169,7 +171,7 @@ func (r *draPluginClient) NodeUnprepareResource( CdiDevices: cdiDevices, } - ctx, cancel := context.WithTimeout(ctx, 10*time.Second) + ctx, cancel := context.WithTimeout(ctx, PluginClientTimeout) defer cancel() return nodeClient.NodeUnprepareResource(ctx, req)