Skip to content

Delete kahu snapshots and CSI snapshots while deleting the volume backup#148

Open
vineela1999 wants to merge 2 commits into
soda-cdm:mainfrom
vineela1999:snapshot
Open

Delete kahu snapshots and CSI snapshots while deleting the volume backup#148
vineela1999 wants to merge 2 commits into
soda-cdm:mainfrom
vineela1999:snapshot

Conversation

@vineela1999

Copy link
Copy Markdown
Contributor

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespace from that line:

/kind new feature

kind bug fix

/kind cleanup
/kind revert change
/kind design
/kind documentation
/kind enhancement

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?:

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespace from that line:
/kind TESTED
/kind NOT-TESTED

Test Report:

Special notes for your reviewer:


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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

remove this log

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed

Comment thread controllers/snapshot/csi/handler.go Outdated

func (s *snapshoter) Delete(snapshot *kahuapi.VolumeSnapshot) error {
//delete snapshot for each volumes
// create CSI object

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

comment is not proper

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated

Comment thread 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 ")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Comment not useful

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed

Comment thread controllers/snapshot/controller.go Outdated
}

if newSnapshot.DeletionTimestamp != nil {
err := ctrl.deleteCSISnapshot(snapshot)

Copy link
Copy Markdown
Collaborator

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

Copy link
Copy Markdown
Contributor Author

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

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.

Snapshot objects are not properly cleaned up during backup delete

2 participants