mirror of
https://github.com/kastenhq/kubestr.git
synced 2024-12-14 11:57:56 +00:00
Support csi v1 (#46)
* support csi v1 * fio file * Adding missing files * adding missing UT for version
This commit is contained in:
parent
461543547c
commit
782d565c18
8 changed files with 143 additions and 73 deletions
24
pkg/common/common.go
Normal file
24
pkg/common/common.go
Normal file
|
@ -0,0 +1,24 @@
|
|||
package common
|
||||
|
||||
const (
|
||||
// VolSnapClassAlphaDriverKey describes alpha driver key
|
||||
VolSnapClassAlphaDriverKey = "snapshotter"
|
||||
// VolSnapClassBetaDriverKey describes beta driver key
|
||||
VolSnapClassBetaDriverKey = "driver"
|
||||
// VolSnapClassStableDriverKey describes the stable driver key
|
||||
VolSnapClassStableDriverKey = "driver"
|
||||
// DefaultPodImage the default pod image
|
||||
DefaultPodImage = "ghcr.io/kastenhq/kubestr:latest"
|
||||
// SnapGroupName describes the snapshot group name
|
||||
SnapGroupName = "snapshot.storage.k8s.io"
|
||||
// VolumeSnapshotClassResourcePlural describes volume snapshot classses
|
||||
VolumeSnapshotClassResourcePlural = "volumesnapshotclasses"
|
||||
// VolumeSnapshotResourcePlural is "volumesnapshots"
|
||||
VolumeSnapshotResourcePlural = "volumesnapshots"
|
||||
// SnapshotAlphaVersion is the apiversion of the alpha relase
|
||||
SnapshotAlphaVersion = "snapshot.storage.k8s.io/v1alpha1"
|
||||
// SnapshotBetaVersion is the apiversion of the beta relase
|
||||
SnapshotBetaVersion = "snapshot.storage.k8s.io/v1beta1"
|
||||
// SnapshotStableVersion is the apiversion of the stable release
|
||||
SnapshotStableVersion = "snapshot.storage.k8s.io/v1"
|
||||
)
|
|
@ -8,6 +8,7 @@ import (
|
|||
kankube "github.com/kanisterio/kanister/pkg/kube"
|
||||
kansnapshot "github.com/kanisterio/kanister/pkg/kube/snapshot"
|
||||
"github.com/kanisterio/kanister/pkg/kube/snapshot/apis/v1alpha1"
|
||||
"github.com/kastenhq/kubestr/pkg/common"
|
||||
"github.com/kastenhq/kubestr/pkg/csi/types"
|
||||
"github.com/pkg/errors"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
|
@ -21,24 +22,11 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
// SnapGroupName describes the snapshot group name
|
||||
SnapGroupName = "snapshot.storage.k8s.io"
|
||||
// VolumeSnapshotClassResourcePlural describes volume snapshot classses
|
||||
VolumeSnapshotClassResourcePlural = "volumesnapshotclasses"
|
||||
// VolumeSnapshotResourcePlural is "volumesnapshots"
|
||||
VolumeSnapshotResourcePlural = "volumesnapshots"
|
||||
// VolSnapClassAlphaDriverKey describes alpha driver key
|
||||
VolSnapClassAlphaDriverKey = "snapshotter"
|
||||
// VolSnapClassBetaDriverKey describes beta driver key
|
||||
VolSnapClassBetaDriverKey = "driver"
|
||||
alphaVersion = "snapshot.storage.k8s.io/v1alpha1"
|
||||
betaVersion = "snapshot.storage.k8s.io/v1beta1"
|
||||
originalPVCGenerateName = "kubestr-csi-original-pvc"
|
||||
originalPodGenerateName = "kubestr-csi-original-pod"
|
||||
clonedPVCGenerateName = "kubestr-csi-cloned-pvc"
|
||||
clonedPodGenerateName = "kubestr-csi-cloned-pod"
|
||||
createdByLabel = "created-by-kubestr-csi"
|
||||
DefaultPodImage = "ghcr.io/kastenhq/kubestr:latest"
|
||||
clonePrefix = "kubestr-clone-"
|
||||
snapshotPrefix = "kubestr-snapshot-"
|
||||
)
|
||||
|
@ -347,7 +335,7 @@ func (o *validateOperations) ValidateVolumeSnapshotClass(ctx context.Context, vo
|
|||
if o.dynCli == nil {
|
||||
return nil, fmt.Errorf("dynCli not initialized")
|
||||
}
|
||||
VolSnapClassGVR := schema.GroupVersionResource{Group: SnapGroupName, Version: groupVersion.Version, Resource: VolumeSnapshotClassResourcePlural}
|
||||
VolSnapClassGVR := schema.GroupVersionResource{Group: common.SnapGroupName, Version: groupVersion.Version, Resource: common.VolumeSnapshotClassResourcePlural}
|
||||
return o.dynCli.Resource(VolSnapClassGVR).Get(ctx, volumeSnapshotClass, metav1.GetOptions{})
|
||||
}
|
||||
|
||||
|
@ -412,7 +400,7 @@ func (c *applicationCreate) CreatePod(ctx context.Context, args *types.CreatePod
|
|||
return nil, err
|
||||
}
|
||||
if args.ContainerImage == "" {
|
||||
args.ContainerImage = DefaultPodImage
|
||||
args.ContainerImage = common.DefaultPodImage
|
||||
}
|
||||
|
||||
pod := &v1.Pod{
|
||||
|
@ -526,7 +514,7 @@ func (c *snapshotCreate) CreateFromSourceCheck(ctx context.Context, snapshotter
|
|||
return errors.Wrapf(err, "Failed to create a VolumeSnapshotClass to use to restore the snapshot")
|
||||
}
|
||||
defer func() {
|
||||
VolSnapClassGVR := schema.GroupVersionResource{Group: SnapGroupName, Version: SnapshotGroupVersion.Version, Resource: VolumeSnapshotClassResourcePlural}
|
||||
VolSnapClassGVR := schema.GroupVersionResource{Group: common.SnapGroupName, Version: SnapshotGroupVersion.Version, Resource: common.VolumeSnapshotClassResourcePlural}
|
||||
err := c.dynCli.Resource(VolSnapClassGVR).Delete(ctx, targetSnapClassName, metav1.DeleteOptions{})
|
||||
if err != nil {
|
||||
fmt.Printf("Delete VSC Error (%s) - (%v)\n", targetSnapClassName, err)
|
||||
|
@ -587,7 +575,7 @@ func (c *cleanse) DeleteSnapshot(ctx context.Context, snapshotName string, names
|
|||
if SnapshotGroupVersion == nil || SnapshotGroupVersion.Version == "" {
|
||||
return fmt.Errorf("snapshot group version not provided")
|
||||
}
|
||||
VolSnapGVR := schema.GroupVersionResource{Group: SnapGroupName, Version: SnapshotGroupVersion.Version, Resource: VolumeSnapshotResourcePlural}
|
||||
VolSnapGVR := schema.GroupVersionResource{Group: common.SnapGroupName, Version: SnapshotGroupVersion.Version, Resource: common.VolumeSnapshotResourcePlural}
|
||||
return c.dynCli.Resource(VolSnapGVR).Namespace(namespace).Delete(ctx, snapshotName, metav1.DeleteOptions{})
|
||||
}
|
||||
|
||||
|
@ -609,7 +597,7 @@ func (p *apiVersionFetch) GetCSISnapshotGroupVersion() (*metav1.GroupVersionForD
|
|||
return nil, err
|
||||
}
|
||||
for _, group := range groups {
|
||||
if group.Name == SnapGroupName {
|
||||
if group.Name == common.SnapGroupName {
|
||||
return &group.PreferredVersion, nil
|
||||
}
|
||||
}
|
||||
|
@ -637,14 +625,18 @@ func getDriverNameFromUVSC(vsc unstructured.Unstructured, version string) string
|
|||
var driverName interface{}
|
||||
var ok bool
|
||||
switch version {
|
||||
case alphaVersion:
|
||||
driverName, ok = vsc.Object[VolSnapClassAlphaDriverKey]
|
||||
case common.SnapshotAlphaVersion:
|
||||
driverName, ok = vsc.Object[common.VolSnapClassAlphaDriverKey]
|
||||
if !ok {
|
||||
return ""
|
||||
}
|
||||
|
||||
case betaVersion:
|
||||
driverName, ok = vsc.Object[VolSnapClassBetaDriverKey]
|
||||
case common.SnapshotBetaVersion:
|
||||
driverName, ok = vsc.Object[common.VolSnapClassBetaDriverKey]
|
||||
if !ok {
|
||||
return ""
|
||||
}
|
||||
case common.SnapshotStableVersion:
|
||||
driverName, ok = vsc.Object[common.VolSnapClassStableDriverKey]
|
||||
if !ok {
|
||||
return ""
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
kansnapshot "github.com/kanisterio/kanister/pkg/kube/snapshot"
|
||||
"github.com/kanisterio/kanister/pkg/kube/snapshot/apis/v1alpha1"
|
||||
"github.com/kanisterio/kanister/pkg/kube/snapshot/apis/v1beta1"
|
||||
"github.com/kastenhq/kubestr/pkg/common"
|
||||
"github.com/kastenhq/kubestr/pkg/csi/types"
|
||||
. "gopkg.in/check.v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
|
@ -34,42 +35,67 @@ func (s *CSITestSuite) TestGetDriverNameFromUVSC(c *C) {
|
|||
{
|
||||
vsc: unstructured.Unstructured{
|
||||
Object: map[string]interface{}{
|
||||
VolSnapClassAlphaDriverKey: "p2",
|
||||
common.VolSnapClassAlphaDriverKey: "p2",
|
||||
},
|
||||
},
|
||||
version: alphaVersion,
|
||||
version: common.SnapshotAlphaVersion,
|
||||
expOut: "p2",
|
||||
},
|
||||
{
|
||||
vsc: unstructured.Unstructured{
|
||||
Object: map[string]interface{}{},
|
||||
},
|
||||
version: alphaVersion,
|
||||
version: common.SnapshotAlphaVersion,
|
||||
expOut: "",
|
||||
},
|
||||
{
|
||||
vsc: unstructured.Unstructured{
|
||||
Object: map[string]interface{}{
|
||||
VolSnapClassBetaDriverKey: "p2",
|
||||
common.VolSnapClassBetaDriverKey: "p2",
|
||||
},
|
||||
},
|
||||
version: betaVersion,
|
||||
version: common.SnapshotBetaVersion,
|
||||
expOut: "p2",
|
||||
},
|
||||
{
|
||||
vsc: unstructured.Unstructured{
|
||||
Object: map[string]interface{}{},
|
||||
},
|
||||
version: betaVersion,
|
||||
version: common.SnapshotBetaVersion,
|
||||
expOut: "",
|
||||
},
|
||||
{
|
||||
vsc: unstructured.Unstructured{
|
||||
Object: map[string]interface{}{
|
||||
VolSnapClassBetaDriverKey: map[string]string{},
|
||||
common.VolSnapClassBetaDriverKey: map[string]string{},
|
||||
},
|
||||
},
|
||||
version: betaVersion,
|
||||
version: common.SnapshotBetaVersion,
|
||||
expOut: "",
|
||||
},
|
||||
{
|
||||
vsc: unstructured.Unstructured{
|
||||
Object: map[string]interface{}{
|
||||
common.VolSnapClassStableDriverKey: "p2",
|
||||
},
|
||||
},
|
||||
version: common.SnapshotStableVersion,
|
||||
expOut: "p2",
|
||||
},
|
||||
{
|
||||
vsc: unstructured.Unstructured{
|
||||
Object: map[string]interface{}{},
|
||||
},
|
||||
version: common.SnapshotStableVersion,
|
||||
expOut: "",
|
||||
},
|
||||
{
|
||||
vsc: unstructured.Unstructured{
|
||||
Object: map[string]interface{}{
|
||||
common.VolSnapClassStableDriverKey: map[string]string{},
|
||||
},
|
||||
},
|
||||
version: common.SnapshotStableVersion,
|
||||
expOut: "",
|
||||
},
|
||||
} {
|
||||
|
@ -192,7 +218,7 @@ func (s *CSITestSuite) TestValidateVolumeSnapshotClass(c *C) {
|
|||
ops := &validateOperations{
|
||||
dynCli: fakedynamic.NewSimpleDynamicClient(runtime.NewScheme()),
|
||||
}
|
||||
uVSC, err := ops.ValidateVolumeSnapshotClass(ctx, "vsc", &metav1.GroupVersionForDiscovery{GroupVersion: alphaVersion})
|
||||
uVSC, err := ops.ValidateVolumeSnapshotClass(ctx, "vsc", &metav1.GroupVersionForDiscovery{GroupVersion: common.SnapshotAlphaVersion})
|
||||
c.Check(err, NotNil)
|
||||
c.Check(uVSC, IsNil)
|
||||
|
||||
|
@ -480,7 +506,7 @@ func (s *CSITestSuite) TestCreatePod(c *C) {
|
|||
}},
|
||||
})
|
||||
if tc.args.ContainerImage == "" {
|
||||
c.Assert(pod.Spec.Containers[0].Image, Equals, DefaultPodImage)
|
||||
c.Assert(pod.Spec.Containers[0].Image, Equals, common.DefaultPodImage)
|
||||
} else {
|
||||
c.Assert(pod.Spec.Containers[0].Image, Equals, tc.args.ContainerImage)
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/kanisterio/kanister/pkg/kube/snapshot/apis/v1alpha1"
|
||||
"github.com/kastenhq/kubestr/pkg/common"
|
||||
"github.com/kastenhq/kubestr/pkg/csi/mocks"
|
||||
"github.com/kastenhq/kubestr/pkg/csi/types"
|
||||
. "gopkg.in/check.v1"
|
||||
|
@ -42,13 +43,13 @@ func (s *CSITestSuite) TestValidateArgs(c *C) {
|
|||
}, nil),
|
||||
f.versionOps.EXPECT().GetCSISnapshotGroupVersion().Return(
|
||||
&metav1.GroupVersionForDiscovery{
|
||||
GroupVersion: alphaVersion,
|
||||
GroupVersion: common.SnapshotAlphaVersion,
|
||||
}, nil),
|
||||
f.validateOps.EXPECT().ValidateVolumeSnapshotClass(gomock.Any(), "vsc", &metav1.GroupVersionForDiscovery{
|
||||
GroupVersion: alphaVersion,
|
||||
GroupVersion: common.SnapshotAlphaVersion,
|
||||
}).Return(&unstructured.Unstructured{
|
||||
Object: map[string]interface{}{
|
||||
VolSnapClassAlphaDriverKey: "p1",
|
||||
common.VolSnapClassAlphaDriverKey: "p1",
|
||||
},
|
||||
}, nil),
|
||||
)
|
||||
|
@ -70,13 +71,13 @@ func (s *CSITestSuite) TestValidateArgs(c *C) {
|
|||
}, nil),
|
||||
f.versionOps.EXPECT().GetCSISnapshotGroupVersion().Return(
|
||||
&metav1.GroupVersionForDiscovery{
|
||||
GroupVersion: alphaVersion,
|
||||
GroupVersion: common.SnapshotAlphaVersion,
|
||||
}, nil),
|
||||
f.validateOps.EXPECT().ValidateVolumeSnapshotClass(gomock.Any(), "vsc", &metav1.GroupVersionForDiscovery{
|
||||
GroupVersion: alphaVersion,
|
||||
GroupVersion: common.SnapshotAlphaVersion,
|
||||
}).Return(&unstructured.Unstructured{
|
||||
Object: map[string]interface{}{
|
||||
VolSnapClassAlphaDriverKey: "p2",
|
||||
common.VolSnapClassAlphaDriverKey: "p2",
|
||||
},
|
||||
}, nil),
|
||||
)
|
||||
|
@ -98,10 +99,10 @@ func (s *CSITestSuite) TestValidateArgs(c *C) {
|
|||
}, nil),
|
||||
f.versionOps.EXPECT().GetCSISnapshotGroupVersion().Return(
|
||||
&metav1.GroupVersionForDiscovery{
|
||||
GroupVersion: alphaVersion,
|
||||
GroupVersion: common.SnapshotAlphaVersion,
|
||||
}, nil),
|
||||
f.validateOps.EXPECT().ValidateVolumeSnapshotClass(gomock.Any(), "vsc", &metav1.GroupVersionForDiscovery{
|
||||
GroupVersion: alphaVersion,
|
||||
GroupVersion: common.SnapshotAlphaVersion,
|
||||
}).Return(nil, fmt.Errorf("vsc error")),
|
||||
)
|
||||
},
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
"path/filepath"
|
||||
|
||||
kankube "github.com/kanisterio/kanister/pkg/kube"
|
||||
"github.com/kastenhq/kubestr/pkg/common"
|
||||
"github.com/pkg/errors"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
sv1 "k8s.io/api/storage/v1"
|
||||
|
@ -22,7 +23,7 @@ const (
|
|||
PodNamespaceEnvKey = "POD_NAMESPACE"
|
||||
// DefaultFIOJob describes the default FIO job
|
||||
DefaultFIOJob = "default-fio"
|
||||
// KubestrFIOJob describes the default FIO job
|
||||
// KubestrFIOJobGenName describes the generate name
|
||||
KubestrFIOJobGenName = "kubestr-fio"
|
||||
// ConfigMapJobKey is the default fio job key
|
||||
ConfigMapJobKey = "fiojob"
|
||||
|
@ -42,7 +43,6 @@ const (
|
|||
VolumeMountPath = "/dataset"
|
||||
// CreatedByFIOLabel is the key that desrcibes the label used to mark configmaps
|
||||
CreatedByFIOLabel = "createdbyfio"
|
||||
DefaultPodImage = "ghcr.io/kastenhq/kubestr:latest"
|
||||
)
|
||||
|
||||
// FIO is an interface that represents FIO related commands
|
||||
|
@ -238,7 +238,7 @@ func (s *fioStepper) createPod(ctx context.Context, pvcName, configMapName, test
|
|||
}
|
||||
|
||||
if image == "" {
|
||||
image = DefaultPodImage
|
||||
image = common.DefaultPodImage
|
||||
}
|
||||
|
||||
pod := &v1.Pod{
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/kastenhq/kubestr/pkg/common"
|
||||
"github.com/pkg/errors"
|
||||
. "gopkg.in/check.v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
|
@ -641,7 +642,7 @@ func (s *FIOTestSuite) TestCreatPod(c *C) {
|
|||
{Name: "config-map", MountPath: ConfigMapMountPath},
|
||||
})
|
||||
if tc.image == "" {
|
||||
c.Assert(pod.Spec.Containers[0].Image, Equals, DefaultPodImage)
|
||||
c.Assert(pod.Spec.Containers[0].Image, Equals, common.DefaultPodImage)
|
||||
} else {
|
||||
c.Assert(pod.Spec.Containers[0].Image, Equals, tc.image)
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
"strings"
|
||||
|
||||
kanvolume "github.com/kanisterio/kanister/pkg/kube/volume"
|
||||
"github.com/kastenhq/kubestr/pkg/common"
|
||||
"github.com/pkg/errors"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
sv1 "k8s.io/api/storage/v1"
|
||||
|
@ -20,16 +21,6 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
// SnapGroupName describes the snapshot group name
|
||||
SnapGroupName = "snapshot.storage.k8s.io"
|
||||
// VolumeSnapshotClassResourcePlural describes volume snapshot classses
|
||||
VolumeSnapshotClassResourcePlural = "volumesnapshotclasses"
|
||||
alphaVersion = "snapshot.storage.k8s.io/v1alpha1"
|
||||
betaVersion = "snapshot.storage.k8s.io/v1beta1"
|
||||
// VolSnapClassAlphaDriverKey describes alpha driver key
|
||||
VolSnapClassAlphaDriverKey = "snapshotter"
|
||||
// VolSnapClassBetaDriverKey describes beta driver key
|
||||
VolSnapClassBetaDriverKey = "driver"
|
||||
// APIVersionKey describes the APIVersion key
|
||||
APIVersionKey = "apiVersion"
|
||||
// FeatureGateTestPVCName is the name of the pvc created by the feature gate
|
||||
|
@ -284,14 +275,20 @@ func (p *Kubestr) validateVolumeSnapshotClass(vsc unstructured.Unstructured, gro
|
|||
Raw: vsc,
|
||||
}
|
||||
switch groupVersion {
|
||||
case alphaVersion:
|
||||
_, ok := vsc.Object[VolSnapClassAlphaDriverKey]
|
||||
case common.SnapshotAlphaVersion:
|
||||
_, ok := vsc.Object[common.VolSnapClassAlphaDriverKey]
|
||||
if !ok {
|
||||
retVSC.StatusList = append(retVSC.StatusList,
|
||||
makeStatus(StatusError, fmt.Sprintf("VolumeSnapshotClass (%s) missing 'snapshotter' field", vsc.GetName()), nil))
|
||||
}
|
||||
case betaVersion:
|
||||
_, ok := vsc.Object[VolSnapClassBetaDriverKey]
|
||||
case common.SnapshotBetaVersion:
|
||||
_, ok := vsc.Object[common.VolSnapClassBetaDriverKey]
|
||||
if !ok {
|
||||
retVSC.StatusList = append(retVSC.StatusList,
|
||||
makeStatus(StatusError, fmt.Sprintf("VolumeSnapshotClass (%s) missing 'driver' field", vsc.GetName()), nil))
|
||||
}
|
||||
case common.SnapshotStableVersion:
|
||||
_, ok := vsc.Object[common.VolSnapClassStableDriverKey]
|
||||
if !ok {
|
||||
retVSC.StatusList = append(retVSC.StatusList,
|
||||
makeStatus(StatusError, fmt.Sprintf("VolumeSnapshotClass (%s) missing 'driver' field", vsc.GetName()), nil))
|
||||
|
@ -325,7 +322,7 @@ func (p *Kubestr) loadStorageClasses(ctx context.Context) (*sv1.StorageClassList
|
|||
|
||||
func (p *Kubestr) loadVolumeSnapshotClasses(ctx context.Context, version string) (*unstructured.UnstructuredList, error) {
|
||||
if p.volumeSnapshotClassList == nil {
|
||||
VolSnapClassGVR := schema.GroupVersionResource{Group: SnapGroupName, Version: version, Resource: VolumeSnapshotClassResourcePlural}
|
||||
VolSnapClassGVR := schema.GroupVersionResource{Group: common.SnapGroupName, Version: version, Resource: common.VolumeSnapshotClassResourcePlural}
|
||||
us, err := p.dynCli.Resource(VolSnapClassGVR).List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -340,14 +337,18 @@ func (p *Kubestr) getDriverNameFromUVSC(vsc unstructured.Unstructured, version s
|
|||
var driverName interface{}
|
||||
var ok bool
|
||||
switch version {
|
||||
case alphaVersion:
|
||||
driverName, ok = vsc.Object[VolSnapClassAlphaDriverKey]
|
||||
case common.SnapshotAlphaVersion:
|
||||
driverName, ok = vsc.Object[common.VolSnapClassAlphaDriverKey]
|
||||
if !ok {
|
||||
return ""
|
||||
}
|
||||
|
||||
case betaVersion:
|
||||
driverName, ok = vsc.Object[VolSnapClassBetaDriverKey]
|
||||
case common.SnapshotBetaVersion:
|
||||
driverName, ok = vsc.Object[common.VolSnapClassBetaDriverKey]
|
||||
if !ok {
|
||||
return ""
|
||||
}
|
||||
case common.SnapshotStableVersion:
|
||||
driverName, ok = vsc.Object[common.VolSnapClassStableDriverKey]
|
||||
if !ok {
|
||||
return ""
|
||||
}
|
||||
|
@ -366,7 +367,7 @@ func (p *Kubestr) getCSIGroupVersion() *metav1.GroupVersionForDiscovery {
|
|||
return nil
|
||||
}
|
||||
for _, group := range groups {
|
||||
if group.Name == SnapGroupName {
|
||||
if group.Name == common.SnapGroupName {
|
||||
return &group.PreferredVersion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -325,3 +325,28 @@ func (s *ProvisionerTestSuite) TestGetDriverNameFromUVSC(c *C) {
|
|||
c.Assert(out, Equals, tc.out)
|
||||
}
|
||||
}
|
||||
|
||||
// func (s *ProvisionerTestSuite) TestGetDriverStats(c *C) {
|
||||
// var snapshotCount int
|
||||
// var expansionCount int
|
||||
// var cloningCount int
|
||||
// featureMap := make(map[string]struct{})
|
||||
// for _, driver := range CSIDriverList {
|
||||
// if strings.Contains("Snapshot", driver.Features) {
|
||||
// snapshotCount++
|
||||
// }
|
||||
// if strings.Contains("Expansion", driver.Features) {
|
||||
// expansionCount++
|
||||
// }
|
||||
// if strings.Contains("Cloning", driver.Features) {
|
||||
// cloningCount++
|
||||
// }
|
||||
// featureMap[driver.Features] = struct{}{}
|
||||
// }
|
||||
// c.Log("totalcsidrivers: ", len(CSIDriverList))
|
||||
// c.Log("snapshotCount: ", snapshotCount)
|
||||
// c.Log("expansionCount: ", expansionCount)
|
||||
// c.Log("cloningCount: ", cloningCount)
|
||||
// c.Log("unique combinations: ", len(featureMap))
|
||||
// c.Assert(true, Equals, false)
|
||||
// }
|
||||
|
|
Loading…
Reference in a new issue