-
Notifications
You must be signed in to change notification settings - Fork 376
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
Centralize VolumeGroupSnapshot members resource creation in the snapshot-controller #1171
Conversation
Skipping CI for Draft Pull Request. |
Hi @leonardoce, can you please split this into 2 separate PRs, one depending on the other? Thanks! |
Hi! Yes. This PR is composed by 2 commits, with the first being the dependent PR. Do you want me to remove it? Without that it won't compile. |
@leonardoce Never mind! You are right. They are already separate PRs. |
Can you add a release note? |
/assign @jsafrane |
6cff7f8
to
09d37ae
Compare
aaba439
to
e0b5871
Compare
Since #1169 is merged, I rebased over the latest master and marked it as ready for review. |
Can you reword the release notes as follows? |
I did it @xing-yang. Thank you! |
groupSnapshotContent.Name, err) | ||
} | ||
|
||
pvs, err := ctrl.client.CoreV1().PersistentVolumes().List(context.TODO(), metav1.ListOptions{}) |
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.
All API server calls are expensive. List
is a very expensive one. The controller should have a PV lister + indexer on spec.csi.driver + "^" + spec.csi.volumeHandle
for fast lookups.
And use the lister to get PVs in the other parts of the controller.
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.
Agree with you. In this PR, I'm just moving the existing logic. Should we address it here, in your opinion?
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.
@jsafrane Can this be addressed in a followup PR? This way it will be easier to review.
I added this issue in the doc: https://docs.google.com/document/d/1jjliw0tFhCPnT9ixlYpj61k5u8_-awf1qSCWrkunshQ/edit?tab=t.0
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 added the informer and the indexer in a separate commit, so we can decide whether to include it in this PR or in a separate one.
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.
Xing asked me to put that on a separate PR. I'm on it.
|
||
pv := utils.GetPersistentVolumeFromHandle(pvs, groupSnapshotContent.Spec.Driver, volumeHandle) | ||
if pv == nil { | ||
klog.Errorf( |
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 an interesting case. A snapshot exists, but its PV has been deleted. How useful is to have a VolumeSnapshot / VolumeSnapshotContent for it, if the user cannot possibly guess from which PVC the snapshot is?
My gut feeling would be to record also the source PVC + PV name in VolumeSnapshotHandlePairList
to be able to reconstruct the VolumeSnapshotContent / VolumeSnapshot with a link to the PV / PVC
This should be discussed in the KEP to keep track of the decision.
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.
We retrieve PV here to populate groupSnapshotContent.Status.PVVolumeSnapshotContentList and set volumeSnapshotContent.Spec.SourceVolumeMode.
- The SourceVolumeMode will have an impact on applications that rely on changing volume mode when creating PVC from VolumeSnapshot. Without it being set, it falls back to the default behavior (for backward compatibility) which is not to check it.
- Regarding PVVolumeSnapshotContentList, we have an action item to see if we can get rid of it after making all other changes.
I'm not sure if it is worth it to add source PVC and PV name in VolumeSnapshotHandlePairList. That sounds like the wrong place to store this info. We can discuss more about it.
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.
Let me open an issue and we'll get back to this one later.
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.
Issue opened: #1183
e0b5871
to
414ce46
Compare
91cff49
to
6208785
Compare
…hot-controller Previously, the csi-snapshotter was responsible for creating individual VolumeSnapshots and VolumeSnapshotContents for each member when dynamically provisioning a VolumeGroupSnapshot. This commit relocates this logic to the snapshot-controller, bringing all resource creation processes under a single authority.
6208785
to
86b7ce1
Compare
I rebased it on the latest |
/lgtm |
The amount of issues and subsequent PRs worries me a bit, but I can see it's moving towards a better controller. |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jsafrane, leonardoce 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 type of PR is this?
What this PR does / why we need it:
Previously, the csi-snapshotter was responsible for creating individual
VolumeSnapshots and VolumeSnapshotContents for each member when
dynamically provisioning a VolumeGroupSnapshot.
This commit relocates this logic to the snapshot-controller, bringing
all resource creation processes under a single authority.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: