Skip to content

Commit b2d17cd

Browse files
author
Grant Griffiths
committed
setAnnVolumeSnapshotBeingCreated patch impl
Signed-off-by: Grant Griffiths <[email protected]>
1 parent e1f82e4 commit b2d17cd

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pkg/sidecar-controller/snapshot_controller.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,12 +587,19 @@ func (ctrl *csiSnapshotSideCarController) setAnnVolumeSnapshotBeingCreated(conte
587587
contentClone := content.DeepCopy()
588588
metav1.SetMetaDataAnnotation(&contentClone.ObjectMeta, utils.AnnVolumeSnapshotBeingCreated, "yes")
589589

590-
updatedContent, err := ctrl.clientset.SnapshotV1().VolumeSnapshotContents().Update(context.TODO(), contentClone, metav1.UpdateOptions{})
590+
var patches []utils.PatchOp
591+
patches = append(patches, utils.PatchOp{
592+
Op: "replace",
593+
Path: "/metadata/annotations",
594+
Value: contentClone.ObjectMeta.GetAnnotations(),
595+
})
596+
597+
patchedContent, err := utils.PatchVolumeSnapshotContent(contentClone, patches, ctrl.clientset)
591598
if err != nil {
592599
return content, newControllerUpdateError(content.Name, err.Error())
593600
}
594601
// update content if update is successful
595-
content = updatedContent
602+
content = patchedContent
596603

597604
_, err = ctrl.storeContentUpdate(content)
598605
if err != nil {

0 commit comments

Comments
 (0)