Bug 1308588

Summary: Volume leak in dynamic provisioning when claim is deleted quickly
Product: OKD Reporter: Jan Safranek <jsafrane>
Component: StorageAssignee: Jan Safranek <jsafrane>
Status: CLOSED CURRENTRELEASE QA Contact: Chao Yang <chaoyang>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 3.xCC: aos-bugs, bchilds, chaoyang, jkrieger
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-12 17:16:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Jan Safranek 2016-02-15 14:52:33 UTC
When Kubernetes provisions a persistent volume for a claim and the claim is deleted roughly at the same time, the created volume is not deleted and stays both in Kubernetes and in external cloud.

The volume is not bound, it stays in Available state and has no ClaimRef associated.

Version-Release number of selected component (if applicable):
3.1

How reproducible:
often, ~50%

Steps to Reproduce:
1. prepare pvc.json with a claim for dynamic provisioning:
{
  "kind": "PersistentVolumeClaim",
  "apiVersion": "v1",
  "metadata": {
    "name": "claim2",
    "annotations": {
        "volume.alpha.kubernetes.io/storage-class": "foo"
    }
  },
  "spec": {
    "accessModes": [
      "ReadWriteOnce"
    ],
    "resources": {
      "requests": {
        "storage": "3Gi"
      }
    }
  }
}

2. create and quickly delete the claim:
   $ cluster/kubectl.sh create -f pvc.json ; cluster/kubectl.sh delete pvc claim2


Actual results:
Kubernetes create a PV and leaves it in Available state:
$ cluster/kubectl.sh get pv
NAME           CAPACITY   ACCESSMODES   STATUS      CLAIM     REASON    AGE
pv-aws-l9orj   3Gi        RWO           Available                       3m


Expected results:
Kubernetes delete the volume

Comment 1 Jan Safranek 2016-02-15 15:51:34 UTC
PR: https://github.com/kubernetes/kubernetes/pull/21268

Comment 3 Jan Safranek 2016-02-19 16:26:12 UTC
Origin PR: https://github.com/openshift/origin/pull/7459

Comment 4 Jan Safranek 2016-02-24 08:34:53 UTC
Merged to OpenShift

Comment 5 Chao Yang 2016-02-26 03:07:58 UTC
Test is passed on 
oc v1.1.3-282-gc423082
kubernetes v1.2.0-alpha.7-703-gbc4550d