Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1842455

Summary: [csi-snapshot-controller] default volumesnapshotclasses is not supported well
Product: OpenShift Container Platform Reporter: Qin Ping <piqin>
Component: StorageAssignee: Christian Huffman <chuffman>
Status: CLOSED DUPLICATE QA Contact: Qin Ping <piqin>
Severity: low Docs Contact:
Priority: medium    
Version: 4.5CC: aos-bugs, chuffman
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-06-01 12:40:00 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 Qin Ping 2020-06-01 09:54:36 UTC
Description of problem:
Default volumesnapshotclass is not supported well. Creating the volumesnapshotclass with annotaion snapshot.storage.kubernetes.io/is-default-class="true", when run `oc get volumesnapshotclass` command, can not see the volumesnapshotclass is marked as default, and when creating volumesnapshot, will get the err msg like: Failed to set default snapshot class with error cannot find default snapshot class

Version-Release number of selected component (if applicable):
$ oc get clusterversion --context=admin
NAME      VERSION                             AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.5.0-0.nightly-2020-05-30-025738   True        False         5h41m   Cluster version is 4.5.0-0.nightly-2020-05-30-025738


How reproducible:
Always

Steps to Reproduce:
1. Create a default volumesnapshotclass with:
$ cat volumesnapshotclass.yaml 
apiVersion: snapshot.storage.k8s.io/v1beta1
kind: VolumeSnapshotClass  
metadata:
  name: csi-aws-ebs-snapclass
  annotations:
    snapshot.storage.kubernetes.io/is-default-class: "true"
driver: ebs.csi.aws.com
deletionPolicy: Delete
2. Check the created volumesnapshotclass
$ oc get VolumeSnapshotClass
NAME                    DRIVER            DELETIONPOLICY   AGE
csi-aws-ebs-snapclass   ebs.csi.aws.com   Delete           39m
3. Create a volumesnapshot with:
$ cat volumesnapshot.yaml 
apiVersion: snapshot.storage.k8s.io/v1beta1
kind: VolumeSnapshot
metadata:
  name: mysnap
spec:
  source:
    persistentVolumeClaimName: pvc1
4. Check the volumesnapshot


Actual results:
$ oc get VolumeSnapshotClass
NAME                    DRIVER            DELETIONPOLICY   AGE
csi-aws-ebs-snapclass   ebs.csi.aws.com   Delete           39m

$ oc describe volumesnapshot
Name:         mysnap
Namespace:    default
<skip>
Status:
  Error:
    Message:     Failed to set default snapshot class with error cannot find default snapshot class
    Time:        2020-06-01T08:41:27Z
  Ready To Use:  false
Events:          <none>


Expected results:
when running `oc get VolumeSnapshotClass` cmd, if the volumesnapshotclass is the default one, we can get the similar output with storageclass.

Master Log:

Node Log (of failed PODs):

PV Dump:

PVC Dump:

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

Additional info:

Comment 1 Christian Huffman 2020-06-01 12:40:00 UTC
This would be a good enhancement; however, it is not currently possible. VolumeSnapshotClass is outside of the core kubernetes API. Configuring the displayed information for these types is performed via kubebuilder extensions, and kubebuilder cannot perform dynamic operations, such as checking for annotations and modifying the displayed result.

*** This bug has been marked as a duplicate of bug 1810500 ***