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

Update DataSource LastTransitionTime when populated PVC is updated #2381

Merged
merged 2 commits into from Aug 5, 2022

Conversation

arnongilboa
Copy link
Collaborator

@arnongilboa arnongilboa commented Aug 4, 2022

Signed-off-by: Arnon Gilboa agilboa@redhat.com

What this PR does / why we need it:
The DataSourceReady condition LastTransitionTime does not show a timestamp of the last source PVC update. It only shows a timestamp for its initial population, although the PVC name is updated.

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:

Update DataSource LastTransitionTime when populated source PVC is updated

…ated

Signed-off-by: Arnon Gilboa <agilboa@redhat.com>
@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 Aug 4, 2022
@arnongilboa arnongilboa changed the title Update DataSource LastTransitionTime when populated source PVC is updated Update DataSource LastTransitionTime when populated PVC is updated Aug 4, 2022
@awels
Copy link
Member

awels commented Aug 4, 2022

So it looks like there is no good way of detecting that the current PVC has changed, which in turn leads us to doing what you did. Would it make sense to add a currentSourcePVC that contains the DataVolumeSourcePVC of the current source. Then if the spec changes, we can detect this change because the status doesn't match the spec, we can then clear out the ready condition and everything else takes care of itself.

@arnongilboa
Copy link
Collaborator Author

So it looks like there is no good way of detecting that the current PVC has changed, which in turn leads us to doing what you did. Would it make sense to add a currentSourcePVC that contains the DataVolumeSourcePVC of the current source. Then if the spec changes, we can detect this change because the status doesn't match the spec, we can then clear out the ready condition and everything else takes care of itself.

so why not add a mutating webhook to reset the Ready condition whenever source PVC is updated?

@mhenriks
Copy link
Member

mhenriks commented Aug 4, 2022

I think a new status field is a better solution. If the resource never transitioned from not ready to ready, the transition time should not change.

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

I think a new status field is a better solution. If the resource never transitioned from not ready to ready, the transition time should not change.

added

@arnongilboa
Copy link
Collaborator Author

/retest

1 similar comment
@arnongilboa
Copy link
Collaborator Author

/retest

@awels
Copy link
Member

awels commented Aug 5, 2022

/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Aug 5, 2022
@awels
Copy link
Member

awels commented Aug 5, 2022

/approve

@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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 /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 Aug 5, 2022
@kubevirt-bot kubevirt-bot merged commit b85cd73 into kubevirt:main Aug 5, 2022
@@ -443,6 +443,8 @@ type DataSourceSource struct {

// DataSourceStatus provides the most recently observed status of the DataSource
type DataSourceStatus struct {
// Source is the current source of the data referenced by the DataSource
Source DataSourceSource `json:"source"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Making this field required in the JSON, breaks API backward compatibility. Can you consider marking it as omitempty?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, sorry I missed it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

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

5 participants