Skip to content

Commit

Permalink
DRA: add constant PluginClientTimeout
Browse files Browse the repository at this point in the history
  • Loading branch information
bart0sh committed Mar 13, 2023
1 parent d34b027 commit 50cb326
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/kubelet/cm/dra/plugin/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 50cb326

Please sign in to comment.