Skip to content

Conversation

@raghavendra-talur
Copy link
Contributor

In summary, this PR adds delete functions for the resources which were missed in the previous iteration of uninstall code.

It looks like the delete functions are counterpart to the ensure functions already found in the reconciler.go. In a future PR we should attempt to refactor the code such that the developer is prompted to add the delete function when they add the ensure function.

@raghavendra-talur
Copy link
Contributor Author

cc @iamniting

@jarrpa @obnoxxx Please review. This fixes the problem of cephObjectStoreUsers and cephBlockPools not being deleted as during uninstall.

Comment on lines 385 to 409
if errors.IsNotFound(err) {
reqLogger.Info("Uninstall: CephFilesystem not found", "CephFilesystem Name", cephFilesystem.Name)
return nil
}
Copy link
Member

Choose a reason for hiding this comment

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

Are we sure we want to return from here itself? Don't we want to check the further ones? It is also possible if the first one gets deleted we won't check for further ones as of now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Comment on lines 402 to 426
if errors.IsNotFound(err) {
reqLogger.Info("Uninstall: CephFilesystem is deleted", "CephFilesystem Name", cephFilesystem.Name)
return nil
}
Copy link
Member

Choose a reason for hiding this comment

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

same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

}

// deleteCephBlockPools deletes the CephBlockPools owned by the StorageCluster
func (r *ReconcileStorageCluster) deleteCephBlockPools(sc *ocsv1.StorageCluster, reqLogger logr.Logger) error {
Copy link
Member

Choose a reason for hiding this comment

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

Same as first commit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

}

// deleteCephObjectStoreUsers deletes the CephObjectStoreUsers owned by the StorageCluster
func (r *ReconcileStorageCluster) deleteCephObjectStoreUsers(sc *ocsv1.StorageCluster, reqLogger logr.Logger) error {
Copy link
Member

Choose a reason for hiding this comment

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

same here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


err = r.client.Delete(context.TODO(), sc)
if err != nil {
reqLogger.Error(err, fmt.Sprintf("Uninstall: Ignoring error deleting the SnapshotClass %s", existing.Name))
Copy link
Member

Choose a reason for hiding this comment

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

Why are we ignoring this err

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just keeping it same as the storageclass behavior. Considering the failure of this deletion as non fatal.

}

// deleteCephObjectStores deletes the CephObjectStores owned by the StorageCluster
func (r *ReconcileStorageCluster) deleteCephObjectStores(sc *ocsv1.StorageCluster, reqLogger logr.Logger) error {
Copy link
Member

Choose a reason for hiding this comment

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

same here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Member

@jarrpa jarrpa left a comment

Choose a reason for hiding this comment

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

The reorder commit should be integrated into the other commits, that is make sure they are in the correct order when you first add them.

return err
}

err = r.deleteCephObjectStores(sc, reqLogger)
Copy link
Member

Choose a reason for hiding this comment

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

Are you intentionally removing the call to this 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.

Sorry for the distraction @jarrpa . I am debugging something with this PR. It is not ready yet. I will mark it WIP.

@raghavendra-talur raghavendra-talur changed the title StorageCluster: add delete functions for remaining resources as part of uninstall procedure [WIP] StorageCluster: add delete functions for remaining resources as part of uninstall procedure Sep 25, 2020
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 25, 2020
@raghavendra-talur raghavendra-talur force-pushed the rtalur-more-uninstall-funcs branch 2 times, most recently from cd76ed8 to 119b3d3 Compare September 28, 2020 21:09
Signed-off-by: Raghavendra Talur <raghavendra.talur@gmail.com>
Signed-off-by: Raghavendra Talur <raghavendra.talur@gmail.com>
Signed-off-by: Raghavendra Talur <raghavendra.talur@gmail.com>
Signed-off-by: Raghavendra Talur <raghavendra.talur@gmail.com>
Signed-off-by: Raghavendra Talur <raghavendra.talur@gmail.com>
@raghavendra-talur raghavendra-talur force-pushed the rtalur-more-uninstall-funcs branch from 119b3d3 to 40dbef6 Compare September 28, 2020 21:09
@raghavendra-talur raghavendra-talur changed the title [WIP] StorageCluster: add delete functions for remaining resources as part of uninstall procedure StorageCluster: add delete functions for remaining resources as part of uninstall procedure Sep 28, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 28, 2020
@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 28, 2020
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jarrpa

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 28, 2020
@jarrpa
Copy link
Member

jarrpa commented Sep 28, 2020

All of these functions share a lot of code... I'd like to see a generic function that operates on runtime.Objects, but that can be a later enhancement.

@openshift-merge-robot openshift-merge-robot merged commit 301dffa into red-hat-storage:master Sep 28, 2020
@raghavendra-talur
Copy link
Contributor Author

/cherrypick release-4.6

@openshift-cherrypick-robot

@raghavendra-talur: new pull request created: #793

In response to this:

/cherrypick release-4.6

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@raghavendra-talur raghavendra-talur deleted the rtalur-more-uninstall-funcs branch February 4, 2021 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants