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

Ensure only one VR per PVC #213

Merged
merged 1 commit into from
Aug 25, 2022
Merged

Conversation

Madhu-1
Copy link
Member

@Madhu-1 Madhu-1 commented Aug 23, 2022

VolumeReplication should ensure there is only one VR per PVC, as otherwise, it can lead to orchestrating the
PVC is based on multiple VRs to an inconsistent state. With this Patch only one VR will operate on a single PVC.

Signed-off-by: Madhu Rajanna [email protected]

controllers/replication.storage/pvc.go Outdated Show resolved Hide resolved
controllers/replication.storage/pvc.go Outdated Show resolved Hide resolved
VolumeReplication should ensure there
is only one VR per PVC, as otherwise
it can lead to orchestrating the
PVC based on multiple VRs to an
inconsistent state. With this Patch only
one VR will operator on a single PVC.

Signed-off-by: Madhu Rajanna <[email protected]>
@Madhu-1 Madhu-1 force-pushed the block-multiple-vr branch from 1e05d97 to 1fe592d Compare August 25, 2022 06:27
@Madhu-1 Madhu-1 requested a review from Rakshith-R August 25, 2022 06:28
Copy link
Member

@Rakshith-R Rakshith-R left a comment

Choose a reason for hiding this comment

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

LGTM !

@mergify mergify bot merged commit 04ce7d3 into csi-addons:main Aug 25, 2022
Madhu-1 added a commit to Madhu-1/kubernetes-csi-addons that referenced this pull request Aug 25, 2022
As part of csi-addons#213 support was added to have
one VR per PVC, once the VR is deleted we
need to remove the annotation so new VR
can be created for the same PVC. This PR
adds the missing piece.

Signed-off-by: Madhu Rajanna <[email protected]>
Madhu-1 added a commit to Madhu-1/kubernetes-csi-addons that referenced this pull request Aug 25, 2022
As part of csi-addons#213 support was added to have
one VR per PVC, once the VR is deleted we
need to remove the annotation so new VR
can be created for the same PVC. This PR
adds the missing piece.

Signed-off-by: Madhu Rajanna <[email protected]>
Madhu-1 added a commit to Madhu-1/kubernetes-csi-addons that referenced this pull request Aug 25, 2022
As part of csi-addons#213 support was added to have
one VR per PVC, once the VR is deleted we
need to remove the annotation so new VR
can be created for the same PVC. This PR
adds the missing piece.

Signed-off-by: Madhu Rajanna <[email protected]>
mergify bot pushed a commit that referenced this pull request Aug 25, 2022
As part of #213 support was added to have
one VR per PVC, once the VR is deleted we
need to remove the annotation so new VR
can be created for the same PVC. This PR
adds the missing piece.

Signed-off-by: Madhu Rajanna <[email protected]>
ownerName := pvc.ObjectMeta.Annotations[replicationv1alpha1.VolumeReplicationNameAnnotation]
if ownerName == "" {
pvc.ObjectMeta.Annotations[replicationv1alpha1.VolumeReplicationNameAnnotation] = req.Name
err := r.Update(ctx, pvc)

Choose a reason for hiding this comment

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

2 separate VR reconciles could update the annotation at the same time. (2 go routines etc.). This may need some rudimentary locking such that there is only one updater (fetch and update sequence) for a given PVC.

This should be quite rare, but something to keep track of.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree but am thinking if 2 VR acts on the same PVC to add annotation, either one will fail and one will pass and should be fine. what do you think? as its a quite rare condition we can see how to fix it.

openshift-cherrypick-robot referenced this pull request in openshift-cherrypick-robot/kubernetes-csi-addons Aug 30, 2022
As part of red-hat-storage#213 support was added to have
one VR per PVC, once the VR is deleted we
need to remove the annotation so new VR
can be created for the same PVC. This PR
adds the missing piece.

Signed-off-by: Madhu Rajanna <[email protected]>
Madhu-1 pushed a commit to Madhu-1/kubernetes-csi-addons that referenced this pull request Nov 27, 2024
Syncing latest changes from main for kubernetes-csi-addons
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants