Bug 1869504

Summary: controller_maniladriver cannot create storage-class due to OSP manila invalid name
Product: OpenShift Container Platform Reporter: Nick Satsia <nsatsia>
Component: StorageAssignee: Mike Fedosin <mfedosin>
Storage sub component: Operators QA Contact: Qin Ping <piqin>
Status: CLOSED ERRATA Docs Contact:
Severity: high    
Priority: unspecified CC: aos-bugs, asimonel, fbertina, jsafrane, mfedosin, tbarron
Version: 4.5   
Target Milestone: ---   
Target Release: 4.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of:
: 1869590 (view as bug list) Environment:
Last Closed: 2020-10-27 16:28:38 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: 1869590    

Description Nick Satsia 2020-08-18 07:02:02 UTC
Description of problem:
When you create a ManilaDriver, if a visible (to the project) manila type exists that contains an upper case letter (valid name in OSP manila) then you cannot create PVCs for any manila type even when a storage class is created in OCP.

Version-Release number of selected component (if applicable):
OCP 4.5.5
OSP 16.1

How reproducible:
100%

Steps to Reproduce:
1. Create manila type on OSP with a name that contains a capital letter.
2. Create manila type on OSP with a name that contains only lower case letters.
3. Create a ManilaDriver on OCP

Actual results:
A storage class for the all lower case name is created but not for the manila type with the upper case letter in its name. No PVCs can be created on the valid storage-class.

Expected results:
Can crefate PVCs for valid manila type storage class.

Master Log:

Node Log (of failed PODs):
```
{"level":"info","ts":1597723637.172184,"logger":"controller_maniladriver","msg":"Reconciling Manila Credentials","Request.Namespace":"","Request.Name":"cluster"}
{"level":"info","ts":1597723637.213778,"logger":"controller_maniladriver","msg":"Creating a new Secret","Request.Namespace":"","Request.Name":"cluster","Secret.Namespace":"openshift-manila-csi-driver","Secret.Name":"csi-manila-secrets"}
{"level":"info","ts":1597723637.2215185,"logger":"controller_maniladriver","msg":"Fetching Manila Share Types","Request.Namespace":"","Request.Name":"cluster"}
{"level":"info","ts":1597723637.9286904,"logger":"controller_maniladriver","msg":"Reconciling Manila StorageClasses","Request.Namespace":"","Request.Name":"cluster"}
{"level":"info","ts":1597723637.9287562,"logger":"controller_maniladriver","msg":"Reconciling Manila StorageClass","Request.Namespace":"","Request.Name":"cluster","StorageClass.Name":"csi-manila-cluster"}
{"level":"info","ts":1597723637.9551845,"logger":"controller_maniladriver","msg":"Creating a new StorageClass","Request.Namespace":"","Request.Name":"cluster","StorageClass.Name":"csi-manila-cluster"}
{"level":"info","ts":1597723637.976047,"logger":"controller_maniladriver","msg":"Reconciling Manila StorageClass","Request.Namespace":"","Request.Name":"cluster","StorageClass.Name":"csi-manila-NFSTYPE"}
{"level":"info","ts":1597723637.9942188,"logger":"controller_maniladriver","msg":"Creating a new StorageClass","Request.Namespace":"","Request.Name":"cluster","StorageClass.Name":"csi-manila-NFSTYPE"}
{"level":"error","ts":1597723637.9961302,"logger":"controller-runtime.controller","msg":"Reconciler error","controller":"maniladriver-controller","request":"/cluster","error":"StorageClass.storage.k8s.io \"csi-manila-NFSTYPE\" is invalid: metadata.name: Invalid value: \"csi-manila-NFSTYPE\": a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')","stacktrace":"github.com/go-logr/zapr.(*zapLogger).Error\n\t/go/src/github.com/openshift/csi-driver-manila-operator/vendor/github.com/go-logr/zapr/zapr.go:128\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\t/go/src/github.com/openshift/csi-driver-manila-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:258\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/go/src/github.com/openshift/csi-driver-manila-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:232\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).worker\n\t/go/src/github.com/openshift/csi-driver-manila-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:211\nk8s.io/apimachinery/pkg/util/wait.JitterUntil.func1\n\t/go/src/github.com/openshift/csi-driver-manila-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:152\nk8s.io/apimachinery/pkg/util/wait.JitterUntil\n\t/go/src/github.com/openshift/csi-driver-manila-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:153\nk8s.io/apimachinery/pkg/util/wait.Until\n\t/go/src/github.com/openshift/csi-driver-manila-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:88"}
{"level":"info","ts":1597723638.996293,"logger":"controller_maniladriver","msg":"Reconciling ManilaDriver","Request.Namespace":"","Request.Name":"cluster"}
{"level":"info","ts":1597723639.0029697,"logger":"controller_maniladriver","msg":"Reconciling Manila Driver Namespace","Request.Namespace":"","Request.Name":"cluster"}
{"level":"info","ts":1597723639.004993,"logger":"controller_maniladriver","msg":"Skip reconcile: Namespace already exists","Request.Namespace":"","Request.Name":"cluster","Namespace.Name":"openshift-manila-csi-driver"}
{"level":"info","ts":1597723639.0050025,"logger":"controller_maniladriver","msg":"Reconciling CA Cert ConfigMap","Request.Namespace":"","Request.Name":"cluster"}
{"level":"info","ts":1597723639.0069327,"logger":"controller_maniladriver","msg":"Reconciling Manila Credentials Request","Request.Namespace":"","Request.Name":"cluster"}
{"level":"info","ts":1597723639.0096223,"logger":"controller_maniladriver","msg":"Skip reconcile: CredentialsRequest already exists","Request.Namespace":"","Request.Name":"cluster","CredentialsRequest.Namespace":"openshift-cloud-credential-operator","CredentialsRequest.Name":"manila-csi-credentials-request"}
```
PV Dump:

PVC Dump:

StorageClass Dump (if StorageClass used by PV/PVC):

Additional info:
```
vran, admin) [stack@vm-director-osp161 environments]$ manila type-list                                                                                                                                                                       
+--------------------------------------+---------+------------+------------+--------------------------------------+-----------------------------+-------------+                                                                               
| ID                                   | Name    | visibility | is_default | required_extra_specs                 | optional_extra_specs        | Description |                                                                               
+--------------------------------------+---------+------------+------------+--------------------------------------+-----------------------------+-------------+                                                                               
| f67997fb-0196-422d-8437-c105e003d0c3 | cluster | public     | -          | driver_handles_share_servers : False | share_backend_name : cephfs | OCP4        |                                                                               
| f9db3fea-5a64-441c-82ff-bd7de43b1cd3 | NFSTYPE | public     | -          | driver_handles_share_servers : False | share_backend_name : cephfs | None        |                                                                               
+--------------------------------------+---------+------------+------------+--------------------------------------+-----------------------------+-------------+                                                                               
(vran, admin) [stack@vm-director-osp161 environments]$
```

Comment 6 Qin Ping 2020-09-03 03:25:57 UTC
Created the manila type NFSTYPE on openstack.
Deleted the manila-csi-controllerplugin POD in OCP4.6(4.6.0-0.nightly-2020-09-01-070508). It created a new stroage class "csi-manila-nfstype", all lower case which is good.

For the manila service don't allow duplicated type name, then looks this fix is good, I'll mark it as verified.
$ manila type-create  NFStype false
ERROR: Share Type NFStype already exists. (HTTP 409) (Request-ID: req-21e5e8a1-cc88-432d-b041-2e4208839c07)

Thanks a lot for Nick's help!

Comment 8 errata-xmlrpc 2020-10-27 16:28:38 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 (OpenShift Container Platform 4.6 GA Images), 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-2020:4196