-
Notifications
You must be signed in to change notification settings - Fork 35
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
Delete kahu snapshots and CSI snapshots while deleting the volume backup #148
base: main
Are you sure you want to change the base?
Conversation
@@ -271,6 +318,14 @@ func (ctrl *controller) handleCSISnapshot(snapshot *kahuapi.VolumeSnapshot) erro | |||
return err | |||
} | |||
|
|||
func (ctrl *controller) deleteCSISnapshot(snapshot *kahuapi.VolumeSnapshot) error { | |||
err := ctrl.csiSnapshotHandler.Run(snapshot.Name, func() error { | |||
ctrl.logger.Infof("Volume Snapshot %s came till before delete func *****", snapshot.Name) |
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.
remove this log
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.
removed
controllers/snapshot/csi/handler.go
Outdated
@@ -76,8 +78,33 @@ func NewSnapshotter(ctx context.Context, | |||
}, nil | |||
} | |||
|
|||
func (s *snapshoter) Delete(snapshot *kahuapi.VolumeSnapshot) error { | |||
//delete snapshot for each volumes | |||
// create CSI object |
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.
comment is not proper
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.
updated
controllers/snapshot/csi/handler.go
Outdated
func (s *snapshoter) Handle(snapshot *kahuapi.VolumeSnapshot) error { | ||
// create snapshot for each snapshot volumes | ||
s.logger.Infof(" applying volume snapshot in handle ") |
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.
Comment not useful
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.
removed
controllers/snapshot/controller.go
Outdated
@@ -181,23 +210,41 @@ func (ctrl *controller) processQueue(key string) error { | |||
return nil | |||
} | |||
|
|||
if newSnapshot.DeletionTimestamp != nil { | |||
err := ctrl.deleteCSISnapshot(snapshot) |
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.
move to a delete function
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.
have updated with a new func
What type of PR is this?
kind bug fix
What this PR does / why we need it:
When a backup of pod with volumes is created ,kahu snapshots and CSI snapshots are created
When the backup is deleted the snapshots that were created are not getting removed
This PR makes sures that all the snapshots created while backup are deleted
Which issue(s) this PR fixes:
Fixes #147
Test Report Added?:
Test Report:
Special notes for your reviewer: