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

Fix DIC returned reconcile.Result for ImageStream #2823

Merged
merged 1 commit into from
Jul 28, 2023

Conversation

arnongilboa
Copy link
Collaborator

What this PR does / why we need it:

Regression introduced in #2700

Which issue(s) this PR fixes:
Fixes bz #2226982

Special notes for your reviewer:

Release note:

Fix DataImportCron ImageStream polling per schedule

@kubevirt-bot kubevirt-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. size/S labels Jul 27, 2023
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.

Not insisting just a thought

res, err := r.pollImageStreamDigest(ctx, dataImportCron)
// We use the poll returned reconcile.Result for RequeueAfter if needed
// res is the func returned result, so it must not be block-scoped
res, err = r.pollImageStreamDigest(ctx, dataImportCron)
Copy link
Collaborator

Choose a reason for hiding this comment

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

My concern is that this is so delicate we may step on it again in the future,
maybe we should decide whether requeue happens more explicitly?

BTW the reasoning for this was to get a uniform way of assigning errors in this module (= to :=) IIRC
instead of mixing them up

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Rewrited the code a bit. I think it's enough.

regression introduced in kubevirt#2700

Signed-off-by: Arnon Gilboa <agilboa@redhat.com>
@akalenyu
Copy link
Collaborator

/approve

@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: akalenyu

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 Jul 27, 2023
if isImageStreamSource(dataImportCron) && dataImportCron.Spec.Schedule != "" {
res, err := r.pollImageStreamDigest(ctx, dataImportCron)
// We use the poll returned reconcile.Result for RequeueAfter if needed
pollRes, err := r.pollImageStreamDigest(ctx, dataImportCron)
Copy link
Member

Choose a reason for hiding this comment

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

Would it be simpler to do

res, err = r.pollImageStreamDigest(ctx, dataImportCron)
if err != nil {
  return res, err
}

Note the subtle change from := to = which essentially assigns res to the result of pollImageStreamDigest. Which is logically the same as all the code here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This was the original solution but my concern was that we'd trip over this again
#2823 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

Apparently this was the original solution, but not explicit enough with regards to how res and err are assigned. I have no issues with either approach honestly.

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Jul 27, 2023
@arnongilboa
Copy link
Collaborator Author

/cherrypick release-v1.57

@kubevirt-bot
Copy link
Contributor

@arnongilboa: once the present PR merges, I will cherry-pick it on top of release-v1.57 in a new PR and assign it to you.

In response to this:

/cherrypick release-v1.57

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.

@arnongilboa
Copy link
Collaborator Author

/retest

2 similar comments
@arnongilboa
Copy link
Collaborator Author

/retest

@arnongilboa
Copy link
Collaborator Author

/retest

@kubevirt-bot kubevirt-bot merged commit 96de865 into kubevirt:main Jul 28, 2023
17 checks passed
@kubevirt-bot
Copy link
Contributor

@arnongilboa: new pull request created: #2826

In response to this:

/cherrypick release-v1.57

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.

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/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants