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

Add initial OEP for lso cleanup #700

Merged
merged 2 commits into from
Mar 26, 2021

Conversation

gnufied
Copy link
Member

@gnufied gnufied commented Mar 18, 2021

cc @openshift/sig-storage


### Goals

* Do not allow deletion of `LocalVolumeSet` object if it has bound PVCs.
Copy link
Contributor

Choose a reason for hiding this comment

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

Seeing it written like this: why do we allow deletion of LocalVolumes then? Please add a note that LocalVolumes can't be deleted already.

Copy link
Member 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 52 to 54
a. If there are no bound PVs that are created by this LSO CR.
b. None of the existing PVs(that match LSO CR) should have reclaim policy of `Retain.`
c. If there are unbound PVs with reclaimPolicy of `Delete` then finalizer should not be removed until all such PVs are deleted.
Copy link
Contributor

Choose a reason for hiding this comment

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

I admit that the conditions here (and below) are hard to read and put together.
In a. it allows deletion when there are unbound PVs and in b. and c. it does not allow to delete those.

In addition, why should ReclaimPolicy matter? Unound PV was not used, so there is no data to retain on them.

Perhaps it would be better to use PV phase:

  • LSO removes the finalizer on LV/LVS only when all PVs associated with it are deleted.
  • LSO automatically deletes Pending and Available PVS for LV/LVS with a deletion timestamp, as we expect there is no data on them. See below how LSO deletes them avoiding potential races with PV controller.
  • Released PVs with Delete policy are deleted according to the policy.
  • Bound PVs or Released PVs with Retain policy actively block LSO from removing the finalizer. An event is sent to tell users which PV blocks the deletion.
    • For Bound PVs, user should delete the corresponding PVC to get the PV Released.
    • For Released PVs with reclaim policy "Retain", user should back up any important data from the volume and delete the PV.

Copy link
Member Author

Choose a reason for hiding this comment

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

I reworded this section.

c. If there are unbound PVs with reclaimPolicy of `Delete` then finalizer should not be removed until all such PVs are deleted.

2. If `LocalVolume` or `LocalVolumeSet` object can not be deleted because of #1.a or #1.b - then appropriate event should be logged and user should be informed. LSO is not going to perform any cleanup of bound PVs or PVs with `Retain` reclaim policy.
3. Before we can remove finalizer from LSO managed CRs, we should ensure deletion of created unbound PVs. To do that:
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be probably more separated from the points above, maybe a sub-chapter / paragraph how to safely remove a PV without races?

Copy link
Member Author

Choose a reason for hiding this comment

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

divided this into sections.


## Drawbacks

One drawback is - if user wants to keep one or more PVs around (in case they have data on it) and still delete the `LocalVolume` or `LocalVolumeSet` object - this design will not allow such flow. Also this change would result in data being wiped off from previously created PVs, which could surprise some users.
Copy link
Contributor

Choose a reason for hiding this comment

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

User can use Retain policy on PV and force-remove the LocalVolume.

Copy link
Member Author

Choose a reason for hiding this comment

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

added

@jsafrane
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 25, 2021
@jsafrane
Copy link
Contributor

/approve

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jsafrane

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 Mar 26, 2021
@openshift-merge-robot openshift-merge-robot merged commit 037fe0e into openshift:master Mar 26, 2021
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.

4 participants