Description of problem: On v3.10 clusters installed lately, the dynamic storage based PVs are set to "Retain" by default instead of "Delete" (as it used to be). The v3.10 documentation still says that it should be "Delete" by default, so either this is a bug in OCP v3.10, or the docs need to be updated to reflect the correct behavior. We also need instructions for how to change the default (i.e.: from "Retain" to "Delete"). Version-Release number of selected component (if applicable): v3.10.14 How reproducible: Steps to Reproduce: 1. Install OpenShift Container Platform v3.10 with a dynamic storage backend 2. Create a PVC backed by the dynamic PV and observe that the RECLAIM POLICY is set to "Retain" and not "Delete" for the PV 3. Actual results: Expected results: Master Log: Node Log (of failed PODs): PV Dump: > oc get pv NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE pvc-3e5232f7-a051-11e8-a561-fa163e2847e3 24Gi RWO Retain Bound openshift-infra/metrics-cassandra-1 standard 13d PVC Dump: > oc get pvc -n openshift-infra NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE metrics-cassandra-1 Bound pvc-3e5232f7-a051-11e8-a561-fa163e2847e3 24Gi RWO standard 13d StorageClass Dump (if StorageClass used by PV/PVC): > oc get storageclass standard -o yaml apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: annotations: storageclass.beta.kubernetes.io/is-default-class: "true" creationTimestamp: 2018-08-15T06:02:50Z name: standard resourceVersion: "2041" selfLink: /apis/storage.k8s.io/v1/storageclasses/standard uid: d7223c87-a050-11e8-a561-fa163e2847e3 parameters: fstype: xfs provisioner: kubernetes.io/cinder reclaimPolicy: "" volumeBindingMode: Immediate Additional info:
Comparing the storageclass with a v3.9 storageclass, it looks like the reclaimPolicy: is set to "Delete" in v3.9 while the v3.10 is empty.
the 3.11 version of this bug is at https://bugzilla.redhat.com/show_bug.cgi?id=1608537, these patches need to be cherry-picked https://github.com/openshift/openshift-ansible/pull/9752 https://github.com/openshift/openshift-ansible/pull/9781 cherry-picks: https://github.com/openshift/openshift-ansible/pull/9759 https://github.com/openshift/openshift-ansible/pull/9810
Tested on v3.10.44, the problem persists. Having the reclaimPolicy set to "", the PV is provisioned with "Retain" reclaimPolicy. # oc get storageclass -o yaml apiVersion: v1 items: - apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: annotations: storageclass.beta.kubernetes.io/is-default-class: "true" creationTimestamp: 2018-09-07T01:58:40Z name: standard namespace: "" resourceVersion: "2031" selfLink: /apis/storage.k8s.io/v1/storageclasses/standard uid: 8aa409ea-b241-11e8-8a48-42010af0006f parameters: type: pd-standard provisioner: kubernetes.io/gce-pd reclaimPolicy: "" volumeBindingMode: Immediate kind: List metadata: resourceVersion: "" selfLink: "" apiVersion: v1 kind: PersistentVolume metadata: annotations: kubernetes.io/createdby: gce-pd-dynamic-provisioner pv.kubernetes.io/bound-by-controller: "yes" pv.kubernetes.io/provisioned-by: kubernetes.io/gce-pd creationTimestamp: 2018-09-07T02:17:03Z finalizers: - kubernetes.io/pv-protection labels: failure-domain.beta.kubernetes.io/region: us-central1 failure-domain.beta.kubernetes.io/zone: us-central1-a name: pvc-196d4a7c-b244-11e8-8a48-42010af0006f resourceVersion: "5766" selfLink: /api/v1/persistentvolumes/pvc-196d4a7c-b244-11e8-8a48-42010af0006f uid: 1c16be39-b244-11e8-8a48-42010af0006f spec: accessModes: - ReadWriteOnce capacity: storage: 6G claimRef: apiVersion: v1 kind: PersistentVolumeClaim name: gcec namespace: jhou resourceVersion: "5754" uid: 196d4a7c-b244-11e8-8a48-42010af0006f gcePersistentDisk: fsType: ext4 pdName: kubernetes-dynamic-pvc-196d4a7c-b244-11e8-8a48-42010af0006f persistentVolumeReclaimPolicy: Retain storageClassName: standard status: phase: Bound
Verified on v3.10.45. Without setting a value for reclaimPolicy, the reclaim policy is 'Delete'. Setup a new cluster with ansible, the created storageclass has 'Delete' reclaim policy.
Passed on v3.10.45 [root@ip-172-18-7-127 ~]# oc get sc -o yaml apiVersion: v1 items: - apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: annotations: storageclass.beta.kubernetes.io/is-default-class: "true" creationTimestamp: 2018-09-11T06:09:10Z name: gp2 namespace: "" resourceVersion: "1935" selfLink: /apis/storage.k8s.io/v1/storageclasses/gp2 uid: 32dd07a9-b589-11e8-acf4-0e7d41ec4926 parameters: encrypted: "false" kmsKeyId: "" type: gp2 provisioner: kubernetes.io/aws-ebs reclaimPolicy: Delete volumeBindingMode: Immediate kind: List metadata: resourceVersion: "" selfLink: "" Create dynamic pvc, persistentVolumeReclaimPolicy is Delete
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2018:2660