crc-org / snc

Single Node Cluster creation scripts for OpenShift 4.x as used by CodeReady Containers
https://crc.dev
Apache License 2.0
100 stars 51 forks source link

Change reclaim policy of default storage class to Retain #847

Closed anjannath closed 7 months ago

anjannath commented 8 months ago

this restore to the original behavior we had for persistent volumes when they were manually created and had reclaimPolicy as Recycle

with this pvs dynamically created by the hostpath-provisioner won't be deleted allowing users to recover any data after deleting a pod/pv

fixes #835

anjannath commented 8 months ago

/hold

need to test the bundles from CI

openshift-ci[bot] commented 8 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gbraad

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: - ~~[OWNERS](https://github.com/crc-org/snc/blob/master/OWNERS)~~ [gbraad] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
anjannath commented 8 months ago

/test e2e-snc

openshift-ci[bot] commented 8 months ago

@anjannath: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-snc e21245106cd3f2f1d58ee24163403fd1736bd5df link true /test e2e-snc

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
praveenkumar commented 7 months ago

@anjannath let me know once bundle testing succeed.

anjannath commented 7 months ago

Tested the ocp bundle from this PR and now pvs are created with Reclaim policy set to Retain:

%  main git:(main) oc get pvc
NAME       STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS                   AGE
test-pvc   Bound    pvc-34eb1bb5-3c40-4149-a8f2-e898fe98c543   30Gi       RWX            crc-csi-hostpath-provisioner   5s

% main git:(main) oc get pv
NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                                                 STORAGECLASS                   REASON   AGE
pvc-1c419fcf-08cb-4384-9691-9b3c81ccac3e   30Gi       RWX            Retain           Bound    openshift-image-registry/crc-image-registry-storage   crc-csi-hostpath-provisioner            21h
pvc-34eb1bb5-3c40-4149-a8f2-e898fe98c543   30Gi       RWX            Retain           Bound    default/test-pvc                                      crc-csi-hostpath-provisioner            8s

After deleting pod and pvc, the pv stays around:

% main git:(main) oc get pods
NAME      READY   STATUS    RESTARTS   AGE
testpod   1/1     Running   0          55s

% main git:(main) oc delete pod testpod
pod "testpod" deleted

% main git:(main) oc get pv
NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                                                 STORAGECLASS                   REASON   AGE
pvc-1c419fcf-08cb-4384-9691-9b3c81ccac3e   30Gi       RWX            Retain           Bound    openshift-image-registry/crc-image-registry-storage   crc-csi-hostpath-provisioner            21h
pvc-f12af845-da7a-4615-bde0-17a33461ef90   30Gi       RWX            Retain           Bound    default/test-pvc                                      crc-csi-hostpath-provisioner            62s

% main git:(main) oc get pvc
NAME       STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS                   AGE
test-pvc   Bound    pvc-f12af845-da7a-4615-bde0-17a33461ef90   30Gi       RWX            crc-csi-hostpath-provisioner   71s

% main git:(main) oc delete pvc test-pvc
persistentvolumeclaim "test-pvc" deleted

% main git:(main) oc get pv
NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS     CLAIM                                                 STORAGECLASS                   REASON   AGE
pvc-1c419fcf-08cb-4384-9691-9b3c81ccac3e   30Gi       RWX            Retain           Bound      openshift-image-registry/crc-image-registry-storage   crc-csi-hostpath-provisioner            21h
pvc-f12af845-da7a-4615-bde0-17a33461ef90   30Gi       RWX            Retain           Released   default/test-pvc                                      crc-csi-hostpath-provisioner            79s
praveenkumar commented 7 months ago

you need to remove on-hold in that case.

/cherry-pick release-4.15

openshift-cherrypick-robot commented 7 months ago

@praveenkumar: once the present PR merges, I will cherry-pick it on top of release-4.15 in a new PR and assign it to you.

In response to [this](https://github.com/crc-org/snc/pull/847#issuecomment-1929306960): >you need to remove `on-hold` in that case. > >/cherry-pick release-4.15 Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
anjannath commented 7 months ago

/unhold

openshift-cherrypick-robot commented 7 months ago

@praveenkumar: new pull request created: #852

In response to [this](https://github.com/crc-org/snc/pull/847#issuecomment-1929306960): >you need to remove `on-hold` in that case. > >/cherry-pick release-4.15 Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.