Skip to content
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

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

0xFelix
Copy link
Member

@0xFelix 0xFelix commented Feb 14, 2024

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:

Enhancement: Make importer datasource communication explicit

@kubevirt-bot kubevirt-bot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels Feb 14, 2024
@0xFelix
Copy link
Member Author

0xFelix commented Feb 14, 2024

/cc @awels Does this approach look good to you?

@0xFelix 0xFelix force-pushed the termination-message branch 4 times, most recently from 569d089 to b51995a Compare February 15, 2024 15:33
@0xFelix 0xFelix changed the title [WIP] feat: Add extended termination message to importer [WIP] feat: Make importer datasource communication explicit Feb 15, 2024
@0xFelix 0xFelix force-pushed the termination-message branch 4 times, most recently from 1c8370d to 5ead439 Compare February 15, 2024 16:13
@0xFelix 0xFelix changed the title [WIP] feat: Make importer datasource communication explicit feat: Make importer datasource communication explicit Feb 15, 2024
@kubevirt-bot kubevirt-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 15, 2024
@0xFelix 0xFelix force-pushed the termination-message branch 2 times, most recently from ba2f480 to 0fa3b25 Compare February 16, 2024 14:11
@0xFelix
Copy link
Member Author

0xFelix commented Feb 16, 2024

/test pull-containerized-data-importer-e2e-ceph

@0xFelix
Copy link
Member Author

0xFelix commented Feb 16, 2024

/test pull-containerized-data-importer-non-csi-hpp

@0xFelix
Copy link
Member Author

0xFelix commented Feb 19, 2024

/retest-required

@0xFelix 0xFelix force-pushed the termination-message branch 3 times, most recently from ad4d1cf to b793dbe Compare February 20, 2024 15:26
@awels
Copy link
Member

awels commented Feb 20, 2024

Sorry haven't had a chance to really look at this. I will try to do so later today.

Copy link
Member

@awels awels left a 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() {
Copy link
Member

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?

Copy link
Member Author

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.


termMsg, err := parseTerminationMessage(pod)
if err != nil {
log.V(3).Info("Ignoring failure to parse termination message")
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

@0xFelix
Copy link
Member Author

0xFelix commented Feb 22, 2024

@awels Addressed your comments.

@0xFelix
Copy link
Member Author

0xFelix commented Feb 28, 2024

@awels Ping

Copy link
Collaborator

@alromeros alromeros left a 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 {
Copy link
Collaborator

@alromeros alromeros Mar 8, 2024

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.

Copy link
Member Author

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\"}",
Copy link
Collaborator

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?

Copy link
Member Author

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.

Copy link
Collaborator

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>
@0xFelix
Copy link
Member Author

0xFelix commented Mar 12, 2024

/test pull-containerized-data-importer-e2e-hpp-previous

Copy link
Collaborator

@akalenyu akalenyu left a 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

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Mar 12, 2024
@0xFelix
Copy link
Member Author

0xFelix commented Mar 12, 2024

/test pull-containerized-data-importer-e2e-ceph

@mhenriks
Copy link
Member

Very cool

/approve

@kubevirt-bot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 13, 2024
@kubevirt-bot kubevirt-bot merged commit cd7ee9e into kubevirt:main Mar 13, 2024
18 checks passed
@kubevirt-bot kubevirt-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants