-
Notifications
You must be signed in to change notification settings - Fork 264
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
Add new DV reason: ImagePullFailed #3194
Conversation
0174c9a
to
82814e2
Compare
/test pull-containerized-data-importer-e2e-ceph-wffc |
82814e2
to
4151089
Compare
4151089
to
b66b34d
Compare
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.
Looks like most of this PR is not actually related to returning the error message, but in moving the StreamDataToFile function. Other than that some minor comments.
cmd/cdi-importer/importer.go
Outdated
|
||
ipfErr := &importer.ErrImagePullFailed{} | ||
isImagePullFailure := errors.As(err, &ipfErr) | ||
if isImagePullFailure { |
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 do
if errors.As(err, &ipfErr) {
err = ipfErr
}
Also if the As
is true, isn't err already the right type? I am not entirely I understand what is going on here.
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.
We don't need the boolean here. leftover from another implementation during the development. Will fix.
The As
function does not change err
but only populate ipfErr
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.
In 2nd thought, I don't need this code at all. I was trying to write a new field in the TerminationMessage
object, but this is not working anyway for other reasons.
I'm now relaying on the error text, that is still there.
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.
removed this code
tests/import_test.go
Outdated
|
||
}, | ||
Entry("insecure registry", "registry:5000/myimage:latest"), | ||
Entry("non exists image", "quay.io/capk/ubuntu-2004-container-disk:wrong"), |
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.
Should not be a real issue, but maybe reference the internal registry here with an invalid image. This now assumes you have access to the internet, which may not always be valid.
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.
Any other idea?
b66b34d
to
62789f5
Compare
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.
Thanks!
Had some minor comments but what's more interesting to me is why we can't use the termination message API in case of failures.
Is there something missing in it's implementation? I won't ofcourse block over this
the termination message API (object) is only available for pod that was terminated with no error. For error cases, the pod write unstructed text, and I didn't want to change this behavior because it's way out of the scope of this PR. |
Eventually, yes. But this is not the "why". I moved the function because I wanted to call the Updated PR description to include this info. |
e2eac1e
to
83f3144
Compare
/retest |
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.
Looks good! thanks
Correct me if I'm wrong but this PR does not handle pullMethod: node
(this is fine),
which I thought is quite common on OpenShift. Are you okay with that?
83f3144
to
1560113
Compare
When the image pull fails, the DataVolume Running condition, will have the Reason field of `ImagePullFailed`, to allow better error handling in code taht uses it. Signed-off-by: Nahshon Unna-Tsameret <nunnatsa@redhat.com>
1560113
to
243eb0b
Compare
^^^ fixed new linter warning |
/retest |
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.
/approve
|
||
}, | ||
Entry("pull method = pod", "myregistry/myorg/myimage:wrongtag", cdiv1.RegistryPullPod), | ||
Entry("pull method = node", "myregistry/myorg/myimage:wrongtag", cdiv1.RegistryPullNode), |
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.
👍
/test pull-containerized-data-importer-e2e-upg |
/lgtm |
@awels: once the present PR merges, I will cherry-pick it on top of release-v1.59 in a new PR and assign it to you. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: akalenyu, awels The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/test pull-containerized-data-importer-e2e-upg |
@awels: new pull request created: #3210 In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What this PR does / why we need it
When the image pull fails, the DataVolume Running condition, will have the Reason field of
ImagePullFailed
, to allow better error handling in code that uses it.Also, moved the
StreamDataToFile
function from theutil
package to theimporter
package, and made to non-exported. This is done to allow calling the newNewErrImagePullFailed
function from withinstreamDataToFile
, and to avoid import cycle. In addition, thestreamDataToFile
is only used in theimporter
package and so it's better to define it there.Release note