Bug 1402286

Summary: [GlusterFS Provisioner] Misleading error displayed when gidMin is 0
Product: [Red Hat Storage] Red Hat Gluster Storage Reporter: Jianwei Hou <jhou>
Component: CNS-deploymentAssignee: Humble Chirammal <hchiramm>
Status: CLOSED CURRENTRELEASE QA Contact: Prasanth <pprakash>
Severity: low Docs Contact:
Priority: medium    
Version: unspecifiedCC: akhakhar, annair, aos-bugs, bchilds, eparis, hchiramm, jarrpa, madam, mliyazud, mzywusko, pprakash, rcyriac, rhs-bugs, rreddy, rtalur
Target Milestone: ---   
Target Release: CNS 3.6   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-01-03 10:19:42 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:
Embargoed:
Bug Depends On:    
Bug Blocks: 1445448    

Description Jianwei Hou 2016-12-07 07:49:59 UTC
Description of problem:
Create a StorageClass for gluster provisioner, setting its gidMin to 0, gidMax to 1. When creating a PVC, the PV could not be provisioned. An error logged 'Failed to provision volume with StorageClass "sc1": StorageClass for provisioner "kubernetes.io/glusterfs" must have gidMax value >= gidMin'.

Version-Release number of selected component (if applicable):
openshift v3.4.0.33+71c05b2
kubernetes v1.4.0+776c994
etcd 3.1.0-rc.0

How reproducible:
Always

Steps to Reproduce:
1. Create a StorageClass, setting its gidMin to 0, gidMax to 1. 
apiVersion: storage.k8s.io/v1beta1
kind: StorageClass
metadata:
  name: sc1
provisioner: kubernetes.io/glusterfs
parameters:
  resturl: "<hidden>"
  restuser: "xxx"
  restuserkey: "xxx"
  gidMin: "0"
  gidMax: "1"
provisioner: kubernetes.io/glusterfs

2. Create a PVC that uses this StorageClass to provision volumes.
{
   "kind": "PersistentVolumeClaim",
   "apiVersion": "v1",
   "metadata": {
     "name": "c1",                                                                                                                                 
     "annotations": {
     "volume.beta.kubernetes.io/storage-class": "sc1"
     }
   },
   "spec": {
     "accessModes": [
       "ReadWriteOnce"
     ],
     "resources": {
       "requests": {
         "storage": "10Gi"
       }
     }
   }
}

3. oc describe pvc c1

Actual results:
After step 3:
oc describe pvc c1                
Name:		c1
Namespace:	jhou
StorageClass:	sc1
Status:		Pending
Volume:		
Labels:		<none>
Capacity:	
Access Modes:	
Events:
  FirstSeen	LastSeen	Count	From				SubobjectPath	Type		Reason			Message
  ---------	--------	-----	----				-------------	--------	------			-------
  5m		1s		25	{persistentvolume-controller }			Warning		ProvisioningFailed	Failed to provision volume with StorageClass "sc1": StorageClass for provisioner "kubernetes.io/glusterfs" must have gidMax value >= gidMin


Expected results:
Error description should be instructive, the gidMax is already greater than gidMin.

Additional info:

Comment 1 Jianwei Hou 2016-12-07 09:31:40 UTC
When gidMin is 0, it is set to defaultGidMin https://github.com/kubernetes/kubernetes/blob/master/pkg/volume/glusterfs/glusterfs.go#L914. This explains the issue, but even if it is set to defaultGidMin, the value is not reflected when retrieving the StorageClass.

# oc get storageclass sc1 -o yaml
apiVersion: storage.k8s.io/v1beta1
kind: StorageClass
metadata:
  creationTimestamp: 2016-12-07T07:37:58Z
  name: sc1
  resourceVersion: "6251"
  selfLink: /apis/storage.k8s.io/v1beta1/storageclasses/sc1
  uid: 135676bf-bc50-11e6-be56-0ede06b6a4a4
parameters:
  gidMax: "1"
  gidMin: "0"
  resturl: <hidden>
  restuser: xxx
  restuserkey: xxx
provisioner: kubernetes.io/glusterfs

Comment 2 Eric Paris 2016-12-07 19:08:00 UTC
do we have the ability to differentiate 0 vs unset? should we?

Comment 3 Humble Chirammal 2016-12-08 05:20:22 UTC
Kube PR # https://github.com/kubernetes/kubernetes/pull/38358

Comment 4 Michael Adam 2016-12-08 10:22:05 UTC
(In reply to Eric Paris from comment #2)
> do we have the ability to differentiate 0 vs unset? should we?

exactly the PR i had been working on... hang on a sec

Comment 5 Michael Adam 2016-12-08 10:49:27 UTC
This is the alternative approach I had in the queue.
Unfortunately I was not able to post it earlier:

https://github.com/kubernetes/kubernetes/pull/38378

The approach is:

  Instead of silently adapting the explicit configuration
  from the SC, fail with error if an out-of-range
  value is provided.

Comment 7 Humble Chirammal 2017-07-25 07:39:40 UTC
This is fixed and available in current builds. I am changing the status to ON_QA.

Comment 12 Prasanth 2017-09-14 08:08:06 UTC
Verified