-
Notifications
You must be signed in to change notification settings - Fork 214
Revert "pkg/cvo/updatepayload.go: timeout payload retrieval" #881
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
Merged
openshift-merge-robot
merged 1 commit into
openshift:master
from
petr-muller:revert-846-bug-2090680
Jan 6, 2023
Merged
Changes from all commits
Commits
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 hidden or 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 |
|---|---|---|
|
|
@@ -89,12 +89,22 @@ func (r *payloadRetriever) RetrievePayload(ctx context.Context, update configv1. | |
| if index := strings.LastIndex(update.Image, "@"); index != -1 { | ||
| releaseDigest = update.Image[index+1:] | ||
| } | ||
| verifyCtx := ctx | ||
|
|
||
| // if 'force' specified, ensure call to verify payload signature times out well before parent context | ||
| // to allow time to perform forced update | ||
| if update.Force { | ||
| timeout := time.Minute * 2 | ||
| if deadline, deadlineSet := ctx.Deadline(); deadlineSet { | ||
| timeout = time.Until(deadline) / 2 | ||
| } | ||
| klog.V(2).Infof("Forced update so reducing payload signature verification timeout to %s", timeout) | ||
| var cancel context.CancelFunc | ||
| verifyCtx, cancel = context.WithTimeout(ctx, timeout) | ||
| defer cancel() | ||
| } | ||
|
|
||
| // set up a new context with reasonable timeout for signature and payload retrieval | ||
| retrieveCtx, cancel := context.WithTimeout(ctx, time.Minute*4) | ||
| defer cancel() | ||
|
|
||
| if err := r.verifier.Verify(retrieveCtx, releaseDigest); err != nil { | ||
| if err := r.verifier.Verify(verifyCtx, releaseDigest); err != nil { | ||
| vErr := &payload.UpdateError{ | ||
| Reason: "ImageVerificationFailed", | ||
| Message: fmt.Sprintf("The update cannot be verified: %v", err), | ||
|
|
@@ -112,7 +122,7 @@ func (r *payloadRetriever) RetrievePayload(ctx context.Context, update configv1. | |
|
|
||
| // download the payload to the directory | ||
| var err error | ||
| info.Directory, err = r.targetUpdatePayloadDir(retrieveCtx, update) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is bugged. It couples the lookup timeout to the payload retrieval timeout, causing guaranteed failures when verifies timeout. This prevents force from working without signatures. Before reintroducing, you should write a test. |
||
| info.Directory, err = r.targetUpdatePayloadDir(ctx, update) | ||
| if err != nil { | ||
| return PayloadInfo{}, &payload.UpdateError{ | ||
| Reason: "UpdatePayloadRetrievalFailed", | ||
|
|
||
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.
This comment looks exactly like what I blindly suggested to Trevor :)