Skip to content

Commit

Permalink
dynamic resource allocation: add timeouts for communiction with plugin (
Browse files Browse the repository at this point in the history
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
  • Loading branch information
saza-ku authored Mar 13, 2023
1 parent 185cd95 commit d34b027
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/kubelet/cm/dra/plugin/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"fmt"
"io"
"net"
"time"

"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
Expand Down Expand Up @@ -131,6 +132,9 @@ func (r *draPluginClient) NodePrepareResource(
ResourceHandle: resourceHandle,
}

ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
defer cancel()

return nodeClient.NodePrepareResource(ctx, req)
}

Expand Down Expand Up @@ -165,6 +169,9 @@ func (r *draPluginClient) NodeUnprepareResource(
CdiDevices: cdiDevices,
}

ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
defer cancel()

return nodeClient.NodeUnprepareResource(ctx, req)
}

Expand Down

0 comments on commit d34b027

Please sign in to comment.