Bug 1648361

Summary: Persistent Volume Claim created via Web-Console is missing storageClassName
Product: OpenShift Container Platform Reporter: Simon Reber <sreber>
Component: Management ConsoleAssignee: Zac Herman <zherman>
Status: CLOSED ERRATA QA Contact: Yadan Pei <yapei>
Severity: medium Docs Contact:
Priority: high    
Version: 3.11.0CC: aos-bugs, hasha, jokerman, mmccomas, spadgett, xiaocwan
Target Milestone: ---   
Target Release: 3.11.z   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-01-30 15:19:31 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:

Description Simon Reber 2018-11-09 14:23:51 UTC
Description of problem:

Installing Red Hat OpenShift Container Platform 3.11 cluster with local volume (https://docs.openshift.com/container-platform/3.11/install_config/configuring_local.html) storage configured.

When creating a Persistant Volume Claim using the web-console it creates a claim as shown below. The problem is the claim remains pending forever. But when adding `storageClassName` to the claim it works and correctly claims the volume.

```
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  annotations:
    volume.beta.kubernetes.io/storage-class: local-ssd
  finalizers:
  - kubernetes.io/pvc-protection
  name: test
  namespace: storagetest
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 9G
```

Problem is that the claim is using `volume.beta.kubernetes.io/storage-class: local-ssd` to specify the storage class. But as per kubernetes documentation, `volume.beta.kubernetes.io/storage-class` is deprecated and was replaced with `storageClassName`. Even though `volume.beta.kubernetes.io/storage-class` should still be working, it does not.

But when removing `volume.beta.kubernetes.io/storage-class` and adding `storageClassName` the claim works and the volume is immediately bound.

```
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  annotations:
  finalizers:
  - kubernetes.io/pvc-protection
  name: test
  namespace: storagetest
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 9G
  storageClassName: local-ssd
```

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

 - atomic-openshift-3.11.16-1.git.0.b48b8f8.el7

How reproducible:

 - Always

Steps to Reproduce:
1. Configure Local Volume Storage as per https://docs.openshift.com/container-platform/3.11/install_config/configuring_local.html
2. Create Volume Claim via Web-Console
3. See it in pending state forever

Actual results:

Volume Claim is in pending state forever

Expected results:

Replace `volume.beta.kubernetes.io/storage-class` with `storageClassName` as this is the way moving forward and in accordance with upstream kubernetes. That way the claim will also work.

Additional info:

Comment 3 Zac Herman 2018-11-13 01:06:10 UTC
The sotrageClassName property was introduced in K8s 1.6 and the volume.beta.kubernetes.io/storage-class was deprecated in the 1.9 release.  Let's go ahead and change the code to use the proper value and retest to make sure everything works.  PR 3094 has been opened to handle this: https://github.com/openshift/origin-web-console/pull/3094

Comment 5 shahan 2019-01-17 06:34:31 UTC
1. Configure Local Volume Storage as per https://docs.openshift.com/container-platform/3.11/install_config/configuring_local.html
2. Create pvc on the page console/project/hasha-pro1/create-pvc
$ oc get pvc test -n hasha-pro1 -o yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  annotations:
    pv.kubernetes.io/bind-completed: "yes"
    pv.kubernetes.io/bound-by-controller: "yes"
  creationTimestamp: 2019-01-17T06:25:38Z
  finalizers:
  - kubernetes.io/pvc-protection
  name: test
  namespace: hasha-pro1
  resourceVersion: "48760"
  selfLink: /api/v1/namespaces/hasha-pro1/persistentvolumeclaims/test
  uid: b49f898b-1a20-11e9-8fd9-0e19b4aaa806
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  storageClassName: local-ssd
  volumeName: local-pv-114f21ab
status:
  accessModes:
  - ReadWriteOnce
  capacity:
    storage: 1951Mi
  phase: Bound

using storageClassName field to specify the local pv.
Verified this bug.

oc v3.11.69
OpenShift Master: v3.11.69 
Kubernetes Master:v1.11.0+d4cacc0 
OpenShift Web Console: v3.11.69

Comment 7 errata-xmlrpc 2019-01-30 15:19:31 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:0096