Bug 1464036 - [DOCS] Could not use label selector to pvc and pv when there is default storageclass
[DOCS] Could not use label selector to pvc and pv when there is default stora...
Status: CLOSED CURRENTRELEASE
Product: OpenShift Container Platform
Classification: Red Hat
Component: Documentation (Show other bugs)
3.6.0
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Gaurav Nelson
Jianwei Hou
Vikram Goyal
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-06-22 06:18 EDT by chaoyang
Modified: 2017-07-18 20:00 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-07-18 20:00:53 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description chaoyang 2017-06-22 06:18:47 EDT
Description of problem:
Could not use label selector to pvc and pv when there is default storageclass
Version-Release number of selected component (if applicable):
oc v3.6.121
kubernetes v1.6.1+5115d708d7
features: Basic-Auth GSSAPI Kerberos SPNEGO

How reproducible:
Always

Steps to Reproduce:
1.Check default storageclas
[root@ip-172-18-9-120 ~]# oc get storageclass
NAME            TYPE
gp2 (default)   kubernetes.io/aws-ebs 

2.Create a pv with labels
kind: PersistentVolume
apiVersion: v1
metadata:
  name: ebs1
  labels:
    type: local
spec:
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteOnce
  claimRef:
    name: ebs1
  awsElasticBlockStore:
    volumeID: "aws://us-east-1d/vol-069b4699ba83241a0"
    fsType: "ext4"

3.Create a pvc
{
    "apiVersion": "v1",
    "kind": "PersistentVolumeClaim",
    "metadata": {
        "name": "ebs1"
    },
    "spec": {
        "accessModes": [ "ReadWriteOnce" ],
        "resources": {
            "requests": {
                "storage": "1Gi"
            }
        },
       "selector": {
           "matchLabels": {
             "type": "local"
           }
        },
      "persistentVolumeReclaimPolicy": "Retain"
   }
}

[root@ip-172-18-9-120 ~]# oc get pvc
NAME      STATUS    VOLUME    CAPACITY   ACCESSMODES   STORAGECLASS   AGE
ebs1      Pending                                      gp2            3s
[root@ip-172-18-9-120 ~]# oc describe pvc
Name:		ebs1
Namespace:	default
StorageClass:	gp2
Status:		Pending
Volume:		
Labels:		<none>
Annotations:	volume.beta.kubernetes.io/storage-provisioner=kubernetes.io/aws-ebs
Capacity:	
Access Modes:	
Events:
  FirstSeen	LastSeen	Count	From				SubObjectPath	Type		Reason			Message
  ---------	--------	-----	----				-------------	--------	------			-------
  15s		14s		2	persistent-volume-controller			Warning		ProvisioningFailed	Failed to provision volume with StorageClass "gp2": claim.Spec.Selector is not supported for dynamic provisioning on AWS

Actual results:
PV and pvc is not bond

Expected results:
PV and pvc should bond, there should be a method to avoid default storageclass
Master Log:

Node Log (of failed PODs):

PV Dump:

PVC Dump:

StorageClass Dump (if StorageClass used by PV/PVC):

Additional info:
Comment 1 Bradley Childs 2017-06-22 13:52:07 EDT
This is currently expected behavior.  Labels, selectors and storage-class are mutually exclusive by design currently.

There is RFE to change this behavior in 3.8 (the title is a little off, but the feature is here):

https://trello.com/c/lbxSAqUb/406-list-allowed-selectors-in-storageclass-list-allowed-keys13

Closing this bug for now.
Comment 2 Matthew Wong 2017-06-22 13:53:12 EDT
When a default storage class is configured, the PVC must explicitly ask for storage class "" via annotation or storageclassname field in order to get bound to PV with blank storage class. This is documented upstream but maybe missing from openshift docs.
Comment 3 Liang Xia 2017-06-22 23:45:48 EDT
We need to document this behavior.
Comment 4 Gaurav Nelson 2017-07-12 21:52:40 EDT
Changes are in PR https://github.com/openshift/openshift-docs/pull/4749
Comment 5 openshift-github-bot 2017-07-12 22:42:48 EDT
Commit pushed to master at https://github.com/openshift/openshift-docs

https://github.com/openshift/openshift-docs/commit/d287bf46653b4c0fe46d291fde5dfc31bb136b74
Merge pull request #4749 from gaurav-nelson/Bug1464036-fixes

BZ#1464036-added information about getting a pv with blank storage class

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