Fix detecting default annotation on VolumeGroupSnapshotClass

The `IsDefaultAnnotation()` function has been extended to check for the
correct default annotation, taking the Kind of the object into
consideration.
This commit is contained in:
Niels de Vos
2024-02-22 12:23:17 +01:00
parent ca0b24b661
commit aa837d1ddf
4 changed files with 107 additions and 5 deletions

View File

@@ -1416,7 +1416,7 @@ func (ctrl *csiSnapshotCommonController) SetDefaultSnapshotClass(snapshot *crdv1
defaultClasses := []*crdv1.VolumeSnapshotClass{}
for _, class := range list {
if utils.IsDefaultAnnotation(class.ObjectMeta) && pvDriver == class.Driver {
if utils.IsDefaultAnnotation(class.TypeMeta, class.ObjectMeta) && pvDriver == class.Driver {
defaultClasses = append(defaultClasses, class)
klog.V(5).Infof("get defaultClass added: %s, driver: %s", class.Name, pvDriver)
}