Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1364940 - Creation PV with invalid reclaim policy should fail
Summary: Creation PV with invalid reclaim policy should fail
Keywords:
Status: VERIFIED
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Storage
Version: unspecified
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
: ---
Assignee: Bradley Childs
QA Contact: Liang Xia
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-08-08 09:14 UTC by Liang Xia
Modified: 2019-03-29 17:54 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:


Attachments (Terms of Use)

Description Liang Xia 2016-08-08 09:14:10 UTC
Description of problem:
Creating PV with invalid reclaim policy, the PV created successfully.
When recycling is trigger by deleting the PVC/pod, it failed with error
invalid reclaim policy.

This is bad user experience. We should prevent PV from creating when invalid reclaim policy provided.

Version-Release number of selected component (if applicable):
openshift v1.3.0-alpha.3+aaea4d9
kubernetes v1.3.0+507d3a7
etcd 2.3.0+git

How reproducible:
Always

Steps to Reproduce:
1.Create a PV with invalid reclaim policy(pv content file list below).
2.Create a PVC.
3.Check PV/PVC status

Actual results:
PV/PVC can bound.

Expected results:
Failed to create PV since reclaim policy is invalid.

Additional info:
# cat nfs-pv-invalid.json 
{
  "apiVersion": "v1",
  "kind": "PersistentVolume",
  "metadata": {
    "name": "nfs"
  },
  "spec": {
    "capacity": {
        "storage": "5Gi"
    },
    "accessModes": [ "ReadWriteOnce" ],
    "nfs": {
        "path": "/test",
        "server": "IP-of-my-server"
    },
    "persistentVolumeReclaimPolicy": "invalid"
  }
}

Comment 1 Scott Creeley 2016-08-09 19:45:47 UTC
PR: https://github.com/kubernetes/kubernetes/pull/30304

Comment 2 Liang Xia 2016-08-23 08:44:21 UTC
The problem here is that OCP 3.2 supports default reclaim policy, but OCP 3.3 does not support that.

If the user creates PV with reclaim policy default in OCP 3.3, then he/she will met the problem as described in #comment 0

Comment 3 Bradley Childs 2017-03-16 00:59:15 UTC
PR for this merged and fixed against 3.5

Comment 4 Liang Xia 2017-09-27 07:44:33 UTC
This should have been fixed for a long time.

# openshift version
openshift v3.6.173.0.5
kubernetes v1.6.1+5115d708d7
etcd 3.2.1

# oc create -f pv-template.json 
The PersistentVolume "nfs" is invalid: spec.persistentVolumeReclaimPolicy: Unsupported value: "Invalid": supported values: Delete, Recycle, Retain

Comment 5 Liang Xia 2017-10-24 07:55:08 UTC
Also tried on OCP 3.5, verified this has been fixed.

# openshift version
openshift v3.5.5.31.36
kubernetes v1.5.2+43a9be4
etcd 3.1.0

# oc create -f pv.json 
The PersistentVolume "nfs" is invalid: spec.persistentVolumeReclaimPolicy: Unsupported value: "Invalid": supported values: Delete, Recycle, Retain

# cat pv.json 
{
  "apiVersion": "v1",
  "kind": "PersistentVolume",
  "metadata": {
    "name": "nfs"
  },
  "spec": {
    "capacity": {
        "storage": "5Gi"
    },
    "accessModes": [ "ReadWriteMany" ],
    "nfs": {
        "path": "/",
        "server": "10.10.10.10"
    },
    "persistentVolumeReclaimPolicy": "Invalid"
  }
}

Comment 6 Liang Xia 2018-10-22 06:21:15 UTC
According to above two comments, this has been fixed.


Note You need to log in before you can comment on or make changes to this bug.