Bug 2060554 - pvc source-cr includes a storageclass annotation that overrides user config in PVC spec.storageClassName
Summary: pvc source-cr includes a storageclass annotation that overrides user config i...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Telco Edge
Version: 4.10
Hardware: Unspecified
OS: Unspecified
urgent
medium
Target Milestone: ---
: 4.11.0
Assignee: melserng
QA Contact: yliu1
URL:
Whiteboard:
Depends On:
Blocks: 2062492 2062493
TreeView+ depends on / blocked
 
Reported: 2022-03-03 18:46 UTC by yliu1
Modified: 2022-08-26 16:43 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Known Issue
Doc Text:
Cause: Processing of StoragePVC CR during GitOps ZTP flow does not exclude volume.beta.kubernetes.io/storage-class annotation when user does not include a value for it. Consequence: The spec.storageClassName field is ignored due to the annotation. Workaround (if any): Set the desired StorageClass name in the volume.beta.kubernetes.io/storage-class annotation within your PolicyGenTemplate when using StoragePVC. Result: The StorageClass name specified in the metadata annotation is used as desired.
Clone Of:
Environment:
Last Closed: 2022-08-26 16:43:57 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift-kni cnf-features-deploy pull 998 0 None open Bug 2060554: ztp: fix PersistentVolumeClaim source cr 2022-03-09 21:06:29 UTC

Description yliu1 2022-03-03 18:46:31 UTC
Description of problem:

PVC source-cr has an annotation with storageclass set to $storageclass, if user uses spec.storageClassName to specify the storage class, then it will be overridden by an invalid storage class - "$storageclass". 

This annotation should be commented out or document that we only support specifying storageclass via pvc annotation.

https://github.com/openshift-kni/cnf-features-deploy/blob/f949a6f296a78d2579d809a329c30d9dd91026b3/ztp/source-crs/StoragePVC.yaml#L8

  annotations:
    ran.openshift.io/ztp-deploy-wave: "10"
    volume.beta.kubernetes.io/storage-class: $storageclass


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

How reproducible:
Always


Steps to Reproduce:
1. Deploy a cluster via ZTP with storage class specified via PVC spec. 
http://registry.kni-qe-0.lab.eng.rdu2.redhat.com:3000/kni-qe/ztp-site-configs/src/b35e3bd01e76825fc77de68924e23b61025fcadf/policygentemplates/group-du-sno-ranGen.yaml#L109

2. Check created PVC post deployment
3.

Actual results:
2. PVC points to an non-existed storage class.

[kni@ran-vcl01-installer ~]$ oc describe pvc -n  openshift-image-registry registry-storage
Name:          registry-storage
Namespace:     openshift-image-registry
StorageClass:  $storageclass
Status:        Pending
Volume:        
Labels:        <none>
Annotations:   ran.openshift.io/ztp-deploy-wave: 10
               volume.beta.kubernetes.io/storage-class: $storageclass
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:      
Access Modes:  
VolumeMode:    Filesystem
Used By:       image-registry-674bbcc9f6-6646n
...
Events:
  Type     Reason              Age                    From                         Message
  ----     ------              ----                   ----                         -------
  Warning  ProvisioningFailed  80m                    persistentvolume-controller  storageclass.storage.k8s.io "$storageclass" not found
  Warning  ProvisioningFailed  74m (x7 over 76m)      persistentvolume-controller  storageclass.storage.k8s.io "$storageclass" not found
  Warning  ProvisioningFailed  66m (x14 over 69m)     persistentvolume-controller  storageclass.storage.k8s.io "$storageclass" not found
  Warning  ProvisioningFailed  62m (x7 over 63m)      persistentvolume-controller  storageclass.storage.k8s.io "$storageclass" not found
  Warning  ProvisioningFailed  45m (x21 over 50m)     persistentvolume-controller  storageclass.storage.k8s.io "$storageclass" not found
  Warning  ProvisioningFailed  5m22s (x144 over 40m)  persistentvolume-controller  storageclass.storage.k8s.io "$storageclass" not found


Expected results:
StorageClass:  fs-lso


Additional info:

Comment 3 yliu1 2022-03-10 19:04:07 UTC
Mark as verified by reviewing the code to unblock backport.


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