-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide a client method to bypass server side timeout on upload #20419
Merged
smarterclayton
merged 3 commits into
openshift:master
from
smarterclayton:timeout_of_import
Jul 28, 2018
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...ed/internalclientset/typed/image/internalversion/fake/fake_imagestreamimport_expansion.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
pkg/image/generated/internalclientset/typed/image/internalversion/generated_expansion.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
...ge/generated/internalclientset/typed/image/internalversion/imagestreamimport_expansion.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not just make this an argument to the function? especially since the function name is currently a lie.
also where's the generator code change that yields this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we don't want end users setting arbitrary timeouts. We define what "no timeout" means behind the interface. End clients don't get to set it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no generator code change. This is an expansion, which are side car methods that you write and get slotted in to the interfaces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An expansion that we will have to carry over when we move the image controllers to external :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smarterclayton if there is just one place where we actually use this expansion, can't we just call the client directly with Timeout in that place? (instead of having one-time-use expansion)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the client doesn't expose the timeout field that i saw, so no.