Bug 1954124 - oc set volume not adding storageclass to pvc which leads to issues using snapshots
Summary: oc set volume not adding storageclass to pvc which leads to issues using snap...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.6.z
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 4.8.0
Assignee: Filip Krepinsky
QA Contact: zhou ying
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-04-27 15:52 UTC by daniel
Modified: 2021-07-27 23:04 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: oc volume set ... --claim-class=<...> did not set the storageClassName but only a deprecated volume.beta.kubernetes.io/storage-class annotation Fix: oc volume set command properly sets storageClassName on a PVC
Clone Of:
Environment:
Last Closed: 2021-07-27 23:04:05 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift oc pull 840 0 None Waiting on Red Hat Is there encryption in transit 2022-05-03 09:38:06 UTC
Red Hat Product Errata RHSA-2021:2438 0 None None None 2021-07-27 23:04:22 UTC

Description daniel 2021-04-27 15:52:29 UTC
Description of problem:
using oc volume set ...  --claim-class=<...> does not set the `storageClassName:`
in the created pvc which in turn makes this volume not eligible for snapshots as the VolumeSnaphotClass has a dependency to the original storage class 


Version-Release number of selected component (if applicable):
ocp 4.6.24  with OCS 4.6 or OCS 4.7 (rc)
ocp 4.7.7 with OCS 4.7 (rc)

How reproducible:


Steps to Reproduce:
1. create OCP 4.6.24 or OCP 4.7.7 cluster
2. deploy OCS 4.6 or 4.7 on top of it
3. create  pods (e.g. like shown here https://red-hat-storage.github.io/ocs-training/training/ocs4/ocs.html#_create_a_new_ocp_application_deployment_using_cephfs_volume )

4. especially set volume with 
`oc set volume deploy/file-uploader --add --name=my-shared-storage \
-t pvc --claim-mode=ReadWriteMany --claim-size=1Gi \
--claim-name=my-shared-storage --claim-class=ocs-storagecluster-cephfs \
--mount-path=/opt/app-root/src/uploaded \
-n my-shared-storage`

5. Try to get snapshot via ui --> Snapshot Class is empty and cannot be chosen 

Actual results:

it is not possible to create a snapshot from a volume created with 

oc set volume deploy/file-uploader --add --name=my-shared-storage \
-t pvc --claim-mode=ReadWriteMany --claim-size=1Gi \
--claim-name=my-shared-storage --claim-class=ocs-storagecluster-cephfs \
--mount-path=/opt/app-root/src/uploaded \
-n my-shared-storage

looking at the created pvc with oc edit, I see 

~~~
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  annotations:
    pv.kubernetes.io/bind-completed: "yes"
    pv.kubernetes.io/bound-by-controller: "yes"
    volume.beta.kubernetes.io/storage-class: ocs-storagecluster-cephfs
    volume.beta.kubernetes.io/storage-provisioner: openshift-storage.cephfs.csi.ceph.com
  creationTimestamp: "2021-04-27T14:01:00Z"
  finalizers:
  - kubernetes.io/pvc-protection
  name: my-shared-storage
  namespace: my-shared-storage
  resourceVersion: "49103"
  selfLink: /api/v1/namespaces/my-shared-storage/persistentvolumeclaims/my-shared-storage
  uid: a4a7a5b7-38f3-4009-8a40-9bbfd4a5ec19
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 1Gi
  volumeMode: Filesystem
  volumeName: pvc-a4a7a5b7-38f3-4009-8a40-9bbfd4a5ec19
status:
  accessModes:
  - ReadWriteMany
  capacity:
    storage: 1Gi
  phase: Bound

~~~

so no storageClassName added 


Expected results:

storageClassName added to the created pvc as specified by oc volume set ...  --claim-class=<...> 



Additional info:

If I do edit the created pvc and add the storageClassName to it:

~~~
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  annotations:
    pv.kubernetes.io/bind-completed: "yes"
    pv.kubernetes.io/bound-by-controller: "yes"
    volume.beta.kubernetes.io/storage-class: ocs-storagecluster-cephfs
    volume.beta.kubernetes.io/storage-provisioner: openshift-storage.cephfs.csi.ceph.com
  creationTimestamp: "2021-04-27T15:01:00Z"
  finalizers:
  - kubernetes.io/pvc-protection
  name: my-shared-storage
  namespace: my-shared-storage
  resourceVersion: "49312"
  selfLink: /api/v1/namespaces/my-shared-storage/persistentvolumeclaims/my-shared-storage
  uid: a4a7a5b7-38f3-4009-8a40-9bbfd4a5ec19
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 1Gi
  storageClassName: ocs-storagecluster-cephfs  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  volumeMode: Filesystem
  volumeName: pvc-a4a7a5b7-38f3-4009-8a40-9bbfd4a5ec19
status:
  accessModes:
  - ReadWriteMany
  capacity:
    storage: 1Gi
  phase: Bound

~~~


I see in the UI a Snapshot Class prefilled and can create a snapshot

Comment 1 Michal Fojtik 2021-05-27 16:43:13 UTC
This bug hasn't had any activity in the last 30 days. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're marking this bug as "LifecycleStale" and decreasing the severity/priority. If you have further information on the current state of the bug, please update it, otherwise this bug can be closed in about 7 days. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. Additionally, you can add LifecycleFrozen into Keywords if you think this bug should never be marked as stale. Please consult with bug assignee before you do that.

Comment 4 zhou ying 2021-06-17 07:01:36 UTC
Checked with latest oc , can't reproduce the issue now: 
[root@localhost roottest]# oc version --client 
Client Version: 4.8.0-202106130124.p0.git.1077b05.assembly.stream-1077b05

Now we can see the storageClassName added . 

# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  annotations:
    pv.kubernetes.io/bind-completed: "yes"
    pv.kubernetes.io/bound-by-controller: "yes"
    volume.beta.kubernetes.io/storage-provisioner: openshift-storage.cephfs.csi.ceph.com
  creationTimestamp: "2021-06-17T06:21:20Z"
  finalizers:
  - kubernetes.io/pvc-protection
  name: my-shared-storage
  namespace: my-shared-storage
  resourceVersion: "83896"
  uid: 360b7b64-4f06-4a40-b0e8-d73d4af607cf
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 1Gi
  storageClassName: ocs-storagecluster-cephfs
  volumeMode: Filesystem
  volumeName: pvc-360b7b64-4f06-4a40-b0e8-d73d4af607cf
status:
  accessModes:
  - ReadWriteMany
  capacity:
    storage: 1Gi
  phase: Bound

Comment 6 Filip Krepinsky 2021-07-02 08:38:30 UTC
Hi Paul, this looks fine. Thanks

Comment 8 errata-xmlrpc 2021-07-27 23:04:05 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 (Moderate: OpenShift Container Platform 4.8.2 bug fix and security update), 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/RHSA-2021:2438


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