Bug 2024545

Summary: Overprovision Level Policy Control doesn't support custom storageclass
Product: [Red Hat Storage] Red Hat OpenShift Data Foundation Reporter: Shay Rozen <srozen>
Component: ocs-operatorAssignee: Shachar Sharon <ssharon>
Status: CLOSED ERRATA QA Contact: Oded <oviner>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.9CC: ebenahar, hnallurv, ikave, madam, muagarwa, nberry, ocs-bugs, odf-bz-bot, shilpsha, sostapov, ssharon
Target Milestone: ---Keywords: AutomationBackLog
Target Release: ODF 4.10.0Flags: muagarwa: needinfo? (ssharon)
shilpsha: needinfo? (ssharon)
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 4.10.0-151 Doc Type: Bug Fix
Doc Text:
.Define OverprovisionControl for custom and built-in storage-classes Previously, it was not possible to define OverProvisionControl user-defined custom storage-classes, because it was rejected as invalid for the entire StorageCluster CRD. This was because the original solution was restricted only to built-in OpenShift Container Storage (OCS) storage-classes. With this update, you can define OverprovisionControl for both default as well as user-defined storage-classes.
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-04-13 18:50:37 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: 2011326, 2056571    
Attachments:
Description Flags
storagecluster yaml none

Description Shay Rozen 2021-11-18 10:15:25 UTC
Created attachment 1842535 [details]
storagecluster yaml

Created attachment 1842535 [details]
storagecluster yaml

Description of problem
=======================

When mentioning custom storageclass in overprovision the storagecluster is in error state and in describe storagecluster there is the following error:

```
  Warning  FailedValidation  32s (x2 over 17h)  controller_storagecluster  unsupported storageclassname: sc1
```

Version of all relevant components
==================================

all ocs 4.9
all ocp 4.9

Does this issue impact your ability to continue to work with the product?
=========================================================================

Can't overprovision level policy control can use custom storageclass

Is there any workaround available to the best of your knowledge?
================================================================

Use only default storageclass. Compression and other replication can't be used - there is no workaround for this scenario.

Rate from 1 - 5 the complexity of the scenario you performed that caused this
bug (1 - very simple, 5 - very complex)?
========================================

1

Can this issue reproducible?
============================

Always

Can this issue reproduce from the UI?
=====================================

No

If this is a regression, please provide more details to justify this
====================================================================

No

Steps to Reproduce
==================

1. Install ODF 4.9
2. Create custom storageclass based on rbd with default/custom pool
3. Add in storagecluster overprovision with the new storageclass
  overprovisionControl:
  - capacity: 50Gi
    quotaName: quota1
    selector:
      labels:
        matchLabels:
          storagequota: storagequota1
    storageClassName: sc1

Actual results
==============

Storagecluster is in error state:

```
$ oc get storageclusters.ocs.openshift.io ocs-storagecluster
NAME                 AGE   PHASE   EXTERNAL   CREATED AT             VERSION
ocs-storagecluster   17h   Error              2021-11-17T16:23:41Z   4.9.0
```

And the following appear in the describe of the storagecluster:

```
Warning  FailedValidation  32s (x2 over 17h)  controller_storagecluster  unsupported storageclassname: sc1
```

Expected results
================

Should be legit to work with custom storageclass in overprovision.

Additional info
===============

Comment 4 Elad 2021-11-18 10:26:31 UTC
@

Comment 6 Mudit Agarwal 2021-11-23 08:30:43 UTC
Moving it out to 4.10/4.9.z and added this as a known issue as discussed offline.

Shachar, please add the doc text.

Comment 9 Mudit Agarwal 2022-01-11 11:43:15 UTC
Not required for z-stream, lets fix first in 4.10 and then take a decision.

Comment 15 Oded 2022-03-30 14:48:53 UTC
SetUp:
ODF Version:4.10.0-194
OCP Version: 4.10.0-0.nightly-2022-03-13-040322
LSO version: local-storage-operator.4.10.0-202202241648
Provider:Vmware

Test Process:
1.Create SC [sc-test]:
$ oc describe sc sc-test
Name:                  sc-test
IsDefaultClass:        No
Annotations:           <none>
Provisioner:           openshift-storage.rbd.csi.ceph.com
Parameters:            clusterID=openshift-storage,csi.storage.k8s.io/controller-expand-secret-name=rook-csi-rbd-provisioner,csi.storage.k8s.io/controller-expand-secret-namespace=openshift-storage,csi.storage.k8s.io/fstype=ext4,csi.storage.k8s.io/node-stage-secret-name=rook-csi-rbd-node,csi.storage.k8s.io/node-stage-secret-namespace=openshift-storage,csi.storage.k8s.io/provisioner-secret-name=rook-csi-rbd-provisioner,csi.storage.k8s.io/provisioner-secret-namespace=openshift-storage,fsName=ocs-storagecluster-cephfilesystem,imageFeatures=layering,imageFormat=2,pool=ocs-storagecluster-cephblockpool
AllowVolumeExpansion:  True
MountOptions:          <none>
ReclaimPolicy:         Delete
VolumeBindingMode:     Immediate
Events:                <none>

2.Check storagecluster status:
$ oc get storageclusters.ocs.openshift.io -n openshift-storage
NAME                 AGE   PHASE   EXTERNAL   CREATED AT             VERSION
ocs-storagecluster   14d   Ready              2022-03-15T22:30:02Z   4.10.0

3.Added “overprovisionControl” section to storagecluster yaml file:
  overprovisionControl:
  - capacity: 10Gi
    quotaName: quota1
    selector:
      labels:
        matchLabels:
          storagequota: storagequota1
    storageClassName: sc-test

$ oc edit storageclusters.ocs.openshift.io -n openshift-storage
storagecluster.ocs.openshift.io/ocs-storagecluster edited

4.Check storagecluster status:
$ oc get storageclusters.ocs.openshift.io -n openshift-storage 
NAME                 AGE   PHASE   EXTERNAL   CREATED AT             VERSION
ocs-storagecluster   14d   Ready              2022-03-15T22:30:02Z   4.10.0


for mor details:
https://docs.google.com/document/d/1QfmqMNRBJ0byVQ0F9F4p3hYfg_saSVu1-hytyV0CDbw/edit

Comment 16 Mudit Agarwal 2022-03-31 15:01:05 UTC
Pls add doc text

Comment 17 Oded 2022-04-04 15:17:31 UTC
Bug Fixed.

SetUp:
ODF Version:4.10.0-194
OCP Version: 4.10.0-0.nightly-2022-03-13-040322
LSO version: local-storage-operator.4.10.0-202202241648
Provider:Vmware

Test Process:
1.Create project with “openshift-quota” label
$ cat ns_ocs-quota-sc-test.yaml 
apiVersion: v1
kind: Namespace
metadata:
  name: ocs-quota-sc-test
  labels:
    openshift-quota: quota-sc-test

2.Create SC [sc-test]:
$ oc describe sc sc-test
Name:                  sc-test
IsDefaultClass:        No
Annotations:           <none>
Provisioner:           openshift-storage.rbd.csi.ceph.com
Parameters:            clusterID=openshift-storage,csi.storage.k8s.io/controller-expand-secret-name=rook-csi-rbd-provisioner,csi.storage.k8s.io/controller-expand-secret-namespace=openshift-storage,csi.storage.k8s.io/fstype=ext4,csi.storage.k8s.io/node-stage-secret-name=rook-csi-rbd-node,csi.storage.k8s.io/node-stage-secret-namespace=openshift-storage,csi.storage.k8s.io/provisioner-secret-name=rook-csi-rbd-provisioner,csi.storage.k8s.io/provisioner-secret-namespace=openshift-storage,fsName=ocs-storagecluster-cephfilesystem,imageFeatures=layering,imageFormat=2,pool=ocs-storagecluster-cephblockpool
AllowVolumeExpansion:  True
MountOptions:          <none>
ReclaimPolicy:         Delete
VolumeBindingMode:     Immediate
Events:                <none>

3.Check storagecluster status:
$ oc get storageclusters.ocs.openshift.io -n openshift-storage
NAME                 AGE   PHASE   EXTERNAL   CREATED AT             VERSION
ocs-storagecluster   14d   Ready              2022-03-15T22:30:02Z   4.10.0

4.Added “overprovisionControl” section to storagecluster yaml file:

$ oc edit storageclusters.ocs.openshift.io -n openshift-storage
storagecluster.ocs.openshift.io/ocs-storagecluster edited

  - capacity: 7Gi
    storageClassName: sc-test
    quotaName: quota-sc-test
    selector:
      labels:
        matchLabels:
          openshift-quota: quota-sc-test


5.Check storagecluster status:
$ oc get storageclusters.ocs.openshift.io -n openshift-storage 
NAME                 AGE   PHASE   EXTERNAL   CREATED AT             VERSION
ocs-storagecluster   19d   Ready              2022-03-15T22:30:02Z   4.10.0



6. Check quota “ocs-sc-test-quota-sc-test” 
$ oc describe clusterresourcequota ocs-sc-test-quota-sc-test
Name:		ocs-sc-test-quota-sc-test
Created:	About a minute ago
Labels:		<none>
Annotations:	<none>
Namespace Selector: ["ocs-quota-sc-test"]
Label Selector: openshift-quota=quota-sc-test
AnnotationSelector: map[]
Resource						Used	Hard
--------						----	----
sc-test.storageclass.storage.k8s.io/requests.storage	0	7Gi

7.Create 3Gi pvc on project “ocs-quota-sc-test” with sc “sc-test”
$ oc describe clusterresourcequota ocs-sc-test-quota-sc-test
Name:		ocs-sc-test-quota-sc-test
Created:	7 minutes ago
Labels:		<none>
Annotations:	<none>
Namespace Selector: ["ocs-quota-sc-test"]
Label Selector: openshift-quota=quota-sc-test
AnnotationSelector: map[]
Resource						Used	Hard
--------						----	----
sc-test.storageclass.storage.k8s.io/requests.storage	3Gi	7Gi


8.Create 5Gi pvc on project “ocs-quota-sc-test” with sc “sc-test”
Error: [expected]
persistentvolumeclaims "test2" is forbidden: exceeded quota: ocs-sc-test-quota-sc-test, requested: sc-test.storageclass.storage.k8s.io/requests.storage=5Gi, used: sc-test.storageclass.storage.k8s.io/requests.storage=3Gi, limited: sc-test.storageclass.storage.k8s.io/requests.storage=7Gi


for more info:
https://docs.google.com/document/d/1QfmqMNRBJ0byVQ0F9F4p3hYfg_saSVu1-hytyV0CDbw/edit

Comment 20 errata-xmlrpc 2022-04-13 18:50:37 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 (Important: Red Hat OpenShift Data Foundation 4.10.0 enhancement, security & bug fix 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-2022:1372