-
Notifications
You must be signed in to change notification settings - Fork 267
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
feat: Make importer datasource communication explicit #3101
Conversation
/cc @awels Does this approach look good to you? |
569d089
to
b51995a
Compare
1c8370d
to
5ead439
Compare
ba2f480
to
0fa3b25
Compare
/test pull-containerized-data-importer-e2e-ceph |
/test pull-containerized-data-importer-non-csi-hpp |
/retest-required |
ad4d1cf
to
b793dbe
Compare
Sorry haven't had a chance to really look at this. I will try to do so later today. |
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 pretty good a few questions.
) | ||
|
||
var _ = Describe("TerminationMessage", func() { | ||
It("Should fail if serialized data is longer than 4096 bytes", func() { |
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.
Testing any of the happy paths?
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.
Added a test for the happy path.
pkg/controller/import-controller.go
Outdated
|
||
termMsg, err := parseTerminationMessage(pod) | ||
if err != nil { | ||
log.V(3).Info("Ignoring failure to parse termination message") |
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.
Maybe at least print the actual reason the parsing failed?
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.
ACK
b793dbe
to
be52686
Compare
@awels Addressed your comments. |
be52686
to
8462345
Compare
@awels Ping |
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.
I think this is a great idea, thanks for opening the PR. It looks good to me but as discussed in #3116 I think we should first merge the importer bugfix and adapt the behavior here.
} | ||
|
||
// TerminationMessage contains data to be serialized and used as the termination message of the importer. | ||
type TerminationMessage struct { |
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 is a great idea, it could come in handy to transfer unexpected but non-error import info such as some odd content types. We had an attempt to improve the import behavior when importing text/html but the solution was a bit lackluster: #2909. Just a comment though, that would be out of scope for the PR.
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.
Yes, exactly what I'm doing in #3103
@@ -1013,7 +1013,7 @@ var _ = Describe("[vendor:cnv-qe@redhat.com][level:component]DataVolume tests", | |||
runningCondition: &cdiv1.DataVolumeCondition{ | |||
Type: cdiv1.DataVolumeRunning, | |||
Status: v1.ConditionFalse, | |||
Message: "Import Complete; VDDK: {\"Version\":\"1.2.3\",\"Host\":\"esx.test\"}", |
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.
Probably missing something trivial, why are we dropping this from the expected output, shouldn't the version and host get propagated correctly?
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.
After importing the importer Pod writes the extended termination message to its termination log. Once the import controller sees it and was sucessfully able to parse the message, the value written to the message annotation will be just Import Complete
instead of the full serialized JSON string. The import controller will still set the appropriate annotations for VDDK version and host.
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.
I see. @mrnold hey! do you happen to know if anyone was treating this message as an API on the CDI consuming side?
Make the communication of datasources in the importer explicit by adding a GetTerminationMessage method to the DataSourceInterface. Then use this method to communicate additional information to the import controller once the importer pod has terminated, instead of writing additional data to the termination message in the Close method of datasources. Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
8462345
to
c88d3ba
Compare
/test pull-containerized-data-importer-e2e-hpp-previous |
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! thank you
/test pull-containerized-data-importer-e2e-ceph |
Very cool /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mhenriks 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 |
What this PR does / why we need it:
Make the communication of datasources in the importer explicit by adding
a GetTerminationMessage method to the DataSourceInterface.
Then use this method to communicate additional information to the import
controller once the importer pod has terminated, instead of writing
additional data to the termination message in the Close method of
datasources.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #
Special notes for your reviewer:
Release note: