Add "readyToUse" filter field to volumesnapshotcontent

Signed-off-by: f10atin9 <f10atin9@kubesphere.io>
This commit is contained in:
f10atin9
2022-03-02 18:02:57 +08:00
parent 003b96bf7a
commit ca39efe137

View File

@@ -1,6 +1,7 @@
package volumesnapshotcontent
import (
"strconv"
"strings"
v1 "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1"
@@ -17,6 +18,7 @@ const (
volumeSnapshotClassName = "volumeSnapshotClassName"
volumeSnapshotName = "volumeSnapshotName"
volumeSnapshotNameSpace = "volumeSnapshotNamespace"
readyToUse = "readyToUse"
)
type volumesnapshotcontentGetter struct {
@@ -70,6 +72,8 @@ func (v *volumesnapshotcontentGetter) filter(object runtime.Object, filter query
return strings.EqualFold(snapshotcontent.Spec.VolumeSnapshotRef.Name, string(filter.Value))
case volumeSnapshotNameSpace:
return strings.EqualFold(snapshotcontent.Spec.VolumeSnapshotRef.Namespace, string(filter.Value))
case readyToUse:
return strings.EqualFold(strconv.FormatBool(*snapshotcontent.Status.ReadyToUse), string(filter.Value))
default:
return v1alpha3.DefaultObjectMetaFilter(snapshotcontent.ObjectMeta, filter)
}