Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be available on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 1812075 - If Storageclass is set with empty string, it does not use default storageclass, but fails to bind
Summary: If Storageclass is set with empty string, it does not use default storageclas...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Storage
Version: 4.3.0
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: aos-storage-staff@redhat.com
QA Contact: Liang Xia
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-03-10 13:40 UTC by robin.walter
Modified: 2020-03-10 14:35 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-10 14:08:15 UTC
Target Upstream Version:


Attachments (Terms of Use)
PVC event (80.50 KB, image/png)
2020-03-10 13:40 UTC, robin.walter
no flags Details

Description robin.walter 2020-03-10 13:40:07 UTC
Created attachment 1668958 [details]
PVC event

Description of problem:

In an IPI deployment of OCP4.3 with the 'standard' storageclass set as default, PVCs are not bound, if their definition contains a storageclass attribute set to an empty string.
This problem also hinders the OCS deployment via Operator, because the operator creates PVCs with a storageclass set to ''.


How reproducible:

Steps to Reproduce:
1. create simple PVC yaml file

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: hr-test
spec:
  accessModes:
  - ReadWriteOnce
  storageClassName: ''
  resources:
    requests:
      storage: 55Mi
2. use oc create 
3. PVC does not bind to default storage class

Actual results:
PVC fails to bind

Expected results:
PVC gets bound to the default storageclass (in this cluster 'standard')


Additional info:
[ansible@ocp-bastion-01 gcp]$ oc get sc
NAME                          PROVISIONER                             AGE
ocs-storagecluster-ceph-rbd   openshift-storage.rbd.csi.ceph.com      28h
ocs-storagecluster-cephfs     openshift-storage.cephfs.csi.ceph.com   28h
openshift-storage.noobaa.io   openshift-storage.noobaa.io/obc         27h
standard (default)            kubernetes.io/gce-pd                    29h

[ansible@ocp-bastion-01 gcp]$ oc describe pvc hr-test 
Name:          hr-test
Namespace:     hr-mysql-persistent
StorageClass:  
Status:        Pending
Volume:        
Labels:        <none>
Annotations:   <none>
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:      
Access Modes:  
VolumeMode:    Filesystem
Mounted By:    <none>
Events:
  Type    Reason         Age                   From                         Message
  ----    ------         ----                  ----                         -------
  Normal  FailedBinding  3m5s (x104 over 28m)  persistentvolume-controller  no persistent volumes available for this claim and no storage class is set

Comment 1 Jan Safranek 2020-03-10 14:08:15 UTC
> PVCs are not bound, if their definition contains a storageclass attribute set to an empty string.

This is expected behavior. Set pvc.spec.storageClassname=nil to get the default storage class. Use pvc.spec.storageClassname="" to bind to manually provisioned PVs with storageClassName="". It is actually the only way to bind to "class-less" PVs, so we need to keep this behavior. You can see message "no persistent volumes available for this claim and no storage class is set".

> the operator creates PVCs with a storageclass set to ''

What operator is it? It must be fixed.

Comment 2 robin.walter 2020-03-10 14:35:51 UTC
OK, thanks for your quick answer. The described example was simply for quick reproduction

>>What operator is it? It must be fixed.
The Openshift Container Storage Operator on GCP (latest version 4.2) is setting its storageclasses for automatically created PVSs (e.g. ceph-mon-a) to ''. Thus the operator deployment fails if you do not change the PVCs manually to use the default storage class.


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