Skip to content

Commit

Permalink
Fix kubernetes-csi#89: Increase probe timeout
Browse files Browse the repository at this point in the history
The Probe timeout is set to 1 second, which is insufficient for most
plugins that want to do a thorough health check.

Change the timeout to the default of 1 minute, like we did in the
external-attacher.
  • Loading branch information
Akrog committed Jan 28, 2019
1 parent 1a79476 commit a2ee0c9
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 8 deletions.
76 changes: 75 additions & 1 deletion Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions cmd/csi-snapshotter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ func main() {
os.Exit(1)
}

// Check it's ready
if err = waitForDriverReady(csiConn, *connectionTimeout); err != nil {
glog.Error(err.Error())
os.Exit(1)
}

// Pass a context with a timeout
ctx, cancel := context.WithTimeout(context.Background(), csiTimeout)
defer cancel()
Expand All @@ -136,12 +142,6 @@ func main() {
}
glog.V(2).Infof("CSI driver name: %q", *snapshotter)

// Check it's ready
if err = waitForDriverReady(csiConn, *connectionTimeout); err != nil {
glog.Error(err.Error())
os.Exit(1)
}

// Find out if the driver supports create/delete snapshot.
supportsCreateSnapshot, err := csiConn.SupportsControllerCreateSnapshot(ctx)
if err != nil {
Expand Down Expand Up @@ -202,7 +202,7 @@ func waitForDriverReady(csiConn connection.CSIConnection, timeout time.Duration)
finish := now.Add(timeout)
var err error
for {
ctx, cancel := context.WithTimeout(context.Background(), csiTimeout)
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
err = csiConn.Probe(ctx)
if err == nil {
Expand Down

0 comments on commit a2ee0c9

Please sign in to comment.