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

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

vineela1999
Copy link
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:

@@ -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)
Copy link
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
Contributor Author

Choose a reason for hiding this comment

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

removed

@@ -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
Copy link
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
Contributor Author

Choose a reason for hiding this comment

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

updated

func (s *snapshoter) Handle(snapshot *kahuapi.VolumeSnapshot) error {
// create snapshot for each snapshot volumes
s.logger.Infof(" applying volume snapshot in handle ")
Copy link
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
Contributor Author

Choose a reason for hiding this comment

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

removed

@@ -181,23 +210,41 @@ func (ctrl *controller) processQueue(key string) error {
return nil
}

if newSnapshot.DeletionTimestamp != nil {
err := ctrl.deleteCSISnapshot(snapshot)
Copy link
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
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