Skip to content

Commit

Permalink
Provide a client method to bypass server side timeout on upload
Browse files Browse the repository at this point in the history
  • Loading branch information
smarterclayton committed Jul 26, 2018
1 parent f370159 commit 6dc1369
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/image/controller/imagestream_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ func handleImageStream(
ImportPolicy: imageapi.TagImportPolicy{Insecure: insecure},
}
}
result, err := client.ImageStreamImports(stream.Namespace).Create(isi)
result, err := client.ImageStreamImports(stream.Namespace).CreateWithoutTimeout(isi)
if err != nil {
if apierrs.IsNotFound(err) && isStatusErrorKind(err, "imageStream") {
return result, ErrNotImportable
Expand Down

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

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package internalversion

import (
"time"

image "github.com/openshift/origin/pkg/image/apis/image"
)

type ImageStreamImportExpansion interface {
CreateWithoutTimeout(*image.ImageStreamImport) (*image.ImageStreamImport, error)
}

// CreateWithoutTimeout imports the provided images and won't time out after 30 seconds. Use this when you must
// import a large number of images.
func (c *imageStreamImports) CreateWithoutTimeout(imageStreamImport *image.ImageStreamImport) (result *image.ImageStreamImport, err error) {
result = &image.ImageStreamImport{}
err = c.client.Post().
Namespace(c.ns).
Resource("imagestreamimports").
Body(imageStreamImport).
// this instructs the api server to allow our request to take up to an hour - chosen as a high boundary
Timeout(time.Hour).
Do().
Into(result)
return
}

0 comments on commit 6dc1369

Please sign in to comment.