From 52f15d89f2b0be4a9b637fa4db457c20a1c5f279 Mon Sep 17 00:00:00 2001 From: wnxn Date: Tue, 19 Jun 2018 14:30:06 +0800 Subject: [PATCH] fix bug: missing pvc when listing pvc of a sc --- pkg/models/storage.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/models/storage.go b/pkg/models/storage.go index c61e4cd25..bb4d900ba 100644 --- a/pkg/models/storage.go +++ b/pkg/models/storage.go @@ -47,11 +47,12 @@ func GetPvcListBySc(storageclass string) (res []v12.PersistentVolumeClaim, err e // Select persistent volume claims which // storage class name is equal to the specific storage class. for _, claim := range claimList.Items { - if claim.Spec.StorageClassName != nil && - *claim.Spec.StorageClassName == storageclass { + if claim.Spec.StorageClassName != nil { + if *claim.Spec.StorageClassName == storageclass { + res = append(res, claim) + } + } else if claim.GetAnnotations()[v12.BetaStorageClassAnnotation] == storageclass { res = append(res, claim) - } else { - continue } } return res, nil