Bug 1464036 - [DOCS] Could not use label selector to pvc and pv when there is default storageclass
Summary: [DOCS] Could not use label selector to pvc and pv when there is default stora...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Documentation
Version: 3.6.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Gaurav Nelson
QA Contact: Jianwei Hou
Vikram Goyal
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-06-22 10:18 UTC by Chao Yang
Modified: 2017-07-19 00:00 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-07-19 00:00:53 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Chao Yang 2017-06-22 10:18:47 UTC
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 17:52:07 UTC
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 17:53:12 UTC
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-23 03:45:48 UTC
We need to document this behavior.

Comment 4 Gaurav Nelson 2017-07-13 01:52:40 UTC
Changes are in PR https://github.com/openshift/openshift-docs/pull/4749

Comment 5 openshift-github-bot 2017-07-13 02:42:48 UTC
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.