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

LabelSelector should not be added while restoring pvc #11899

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

muxuelanKK
Copy link

@muxuelanKK muxuelanKK commented May 13, 2024

When old pvc had pv selector, new pvc should not include it.
image

@kubevirt-bot
Copy link
Contributor

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

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.

@kubevirt-bot kubevirt-bot added dco-signoff: no Indicates the PR's author has not DCO signed all their commits. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels May 13, 2024
@kubevirt-bot
Copy link
Contributor

Hi @muxuelanKK. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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.

@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign alicefr for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@muxuelanKK muxuelanKK force-pushed the dev01 branch 2 times, most recently from 44bc372 to 817c3ad Compare May 13, 2024 09:32
@kubevirt-bot kubevirt-bot added dco-signoff: yes Indicates the PR's author has DCO signed all their commits. and removed dco-signoff: no Indicates the PR's author has not DCO signed all their commits. labels May 13, 2024
@mhenriks
Copy link
Member

/test all

Copy link
Contributor

@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.

Thanks for the PR!

I think the labelselector is just one symptom of a broader issue where we just copy out the entire spec of the source PVC.
Maybe we should take look at only setting fields we care about instead of

Spec: sourcePVC.Spec,

@mhenriks
Copy link
Member

@muxuelanKK is this affecting the restore at all? Curious if/how PV label selectors could have any effect when creating a PVC with VolumeSnapshot datasource

@akalenyu I think this is the only field that could potentially be problematic. What do you think?

@akalenyu
Copy link
Contributor

akalenyu commented May 15, 2024

@muxuelanKK is this affecting the restore at all? Curious if/how PV label selectors could have any effect when creating a PVC with VolumeSnapshot datasource

@akalenyu I think this is the only field that could potentially be problematic. What do you think?

This

pvc.Spec.VolumeName = ""
is a bit clunky too, alongside datasource&datasourceref.
Maybe we could just set them all explicitly without copying, that would be nicer IMO

@muxuelanKK
Copy link
Author

@muxuelanKK is this affecting the restore at all? Curious if/how PV label selectors could have any effect when creating a PVC with VolumeSnapshot datasource
@akalenyu I think this is the only field that could potentially be problematic. What do you think?

This

pvc.Spec.VolumeName = ""

is a bit clunky too, alongside datasource&datasourceref.
Maybe we could just set them all explicitly without copying, that would be nicer IMO

Yes, hold on

Signed-off-by: muxuelan <muxuelan@cmss.chinamobile.com>
@muxuelanKK
Copy link
Author

@muxuelanKK is this affecting the restore at all? Curious if/how PV label selectors could have any effect when creating a PVC with VolumeSnapshot datasource
@akalenyu I think this is the only field that could potentially be problematic. What do you think?

This

pvc.Spec.VolumeName = ""

is a bit clunky too, alongside datasource&datasourceref.
Maybe we could just set them all explicitly without copying, that would be nicer IMO

Yes, hold on

done

@akalenyu
Copy link
Contributor

/lgtm
/ok-to-test

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label May 16, 2024
Copy link
Contributor

@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.

one note - may want to add a test in pkg/storage/snapshot/restore_test.go to make sure we don't regress over this in the future

Resources: sourcePVC.Spec.Resources,
StorageClassName: sourcePVC.Spec.StorageClassName,
VolumeMode: sourcePVC.Spec.VolumeMode,
},
Copy link
Member

Choose a reason for hiding this comment

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

Given this new pattern of explicitly setting the fields we care about I think it makes sense to set dataSource and dataSourceRef in in this block as well

Copy link
Member

Choose a reason for hiding this comment

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

@muxuelanKK you planning to come back to this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dco-signoff: yes Indicates the PR's author has DCO signed all their commits. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. lgtm Indicates that a PR is ready to be merged. sig/storage size/XS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants