mirror of https://github.com/k3s-io/k3s
Update CSI client to pick up CSI v1.0.0 changes
parent
9d4810f25a
commit
09d3dce38a
|
@ -30,7 +30,7 @@ go_library(
|
||||||
"//staging/src/k8s.io/csi-api/pkg/client/informers/externalversions:go_default_library",
|
"//staging/src/k8s.io/csi-api/pkg/client/informers/externalversions:go_default_library",
|
||||||
"//staging/src/k8s.io/csi-api/pkg/client/informers/externalversions/csi/v1alpha1:go_default_library",
|
"//staging/src/k8s.io/csi-api/pkg/client/informers/externalversions/csi/v1alpha1:go_default_library",
|
||||||
"//staging/src/k8s.io/csi-api/pkg/client/listers/csi/v1alpha1:go_default_library",
|
"//staging/src/k8s.io/csi-api/pkg/client/listers/csi/v1alpha1:go_default_library",
|
||||||
"//vendor/github.com/container-storage-interface/spec/lib/go/csi/v0:go_default_library",
|
"//vendor/github.com/container-storage-interface/spec/lib/go/csi:go_default_library",
|
||||||
"//vendor/google.golang.org/grpc:go_default_library",
|
"//vendor/google.golang.org/grpc:go_default_library",
|
||||||
"//vendor/k8s.io/klog:go_default_library",
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
|
@ -69,7 +69,7 @@ go_test(
|
||||||
"//staging/src/k8s.io/client-go/util/testing:go_default_library",
|
"//staging/src/k8s.io/client-go/util/testing:go_default_library",
|
||||||
"//staging/src/k8s.io/csi-api/pkg/apis/csi/v1alpha1:go_default_library",
|
"//staging/src/k8s.io/csi-api/pkg/apis/csi/v1alpha1:go_default_library",
|
||||||
"//staging/src/k8s.io/csi-api/pkg/client/clientset/versioned/fake:go_default_library",
|
"//staging/src/k8s.io/csi-api/pkg/client/clientset/versioned/fake:go_default_library",
|
||||||
"//vendor/github.com/container-storage-interface/spec/lib/go/csi/v0:go_default_library",
|
"//vendor/github.com/container-storage-interface/spec/lib/go/csi:go_default_library",
|
||||||
"//vendor/k8s.io/klog:go_default_library",
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
@ -29,7 +29,7 @@ import (
|
||||||
|
|
||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
|
|
||||||
csipb "github.com/container-storage-interface/spec/lib/go/csi/v0"
|
csipb "github.com/container-storage-interface/spec/lib/go/csi"
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
storage "k8s.io/api/storage/v1beta1"
|
storage "k8s.io/api/storage/v1beta1"
|
||||||
apierrs "k8s.io/apimachinery/pkg/api/errors"
|
apierrs "k8s.io/apimachinery/pkg/api/errors"
|
||||||
|
|
|
@ -24,7 +24,7 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
csipb "github.com/container-storage-interface/spec/lib/go/csi/v0"
|
csipb "github.com/container-storage-interface/spec/lib/go/csi"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
api "k8s.io/api/core/v1"
|
api "k8s.io/api/core/v1"
|
||||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
|
@ -46,8 +46,8 @@ type csiClient interface {
|
||||||
targetPath string,
|
targetPath string,
|
||||||
accessMode api.PersistentVolumeAccessMode,
|
accessMode api.PersistentVolumeAccessMode,
|
||||||
volumeInfo map[string]string,
|
volumeInfo map[string]string,
|
||||||
volumeAttribs map[string]string,
|
volumeContext map[string]string,
|
||||||
nodePublishSecrets map[string]string,
|
secrets map[string]string,
|
||||||
fsType string,
|
fsType string,
|
||||||
mountOptions []string,
|
mountOptions []string,
|
||||||
) error
|
) error
|
||||||
|
@ -62,8 +62,8 @@ type csiClient interface {
|
||||||
stagingTargetPath string,
|
stagingTargetPath string,
|
||||||
fsType string,
|
fsType string,
|
||||||
accessMode api.PersistentVolumeAccessMode,
|
accessMode api.PersistentVolumeAccessMode,
|
||||||
nodeStageSecrets map[string]string,
|
secrets map[string]string,
|
||||||
volumeAttribs map[string]string,
|
volumeContext map[string]string,
|
||||||
) error
|
) error
|
||||||
NodeUnstageVolume(ctx context.Context, volID, stagingTargetPath string) error
|
NodeUnstageVolume(ctx context.Context, volID, stagingTargetPath string) error
|
||||||
NodeGetCapabilities(ctx context.Context) ([]*csipb.NodeServiceCapability, error)
|
NodeGetCapabilities(ctx context.Context) ([]*csipb.NodeServiceCapability, error)
|
||||||
|
@ -136,8 +136,8 @@ func (c *csiDriverClient) NodePublishVolume(
|
||||||
targetPath string,
|
targetPath string,
|
||||||
accessMode api.PersistentVolumeAccessMode,
|
accessMode api.PersistentVolumeAccessMode,
|
||||||
volumeInfo map[string]string,
|
volumeInfo map[string]string,
|
||||||
volumeAttribs map[string]string,
|
volumeContext map[string]string,
|
||||||
nodePublishSecrets map[string]string,
|
secrets map[string]string,
|
||||||
fsType string,
|
fsType string,
|
||||||
mountOptions []string,
|
mountOptions []string,
|
||||||
) error {
|
) error {
|
||||||
|
@ -156,12 +156,12 @@ func (c *csiDriverClient) NodePublishVolume(
|
||||||
defer closer.Close()
|
defer closer.Close()
|
||||||
|
|
||||||
req := &csipb.NodePublishVolumeRequest{
|
req := &csipb.NodePublishVolumeRequest{
|
||||||
VolumeId: volID,
|
VolumeId: volID,
|
||||||
TargetPath: targetPath,
|
TargetPath: targetPath,
|
||||||
Readonly: readOnly,
|
Readonly: readOnly,
|
||||||
PublishInfo: volumeInfo,
|
PublishContext: volumeInfo,
|
||||||
VolumeAttributes: volumeAttribs,
|
VolumeContext: volumeContext,
|
||||||
NodePublishSecrets: nodePublishSecrets,
|
Secrets: secrets,
|
||||||
VolumeCapability: &csipb.VolumeCapability{
|
VolumeCapability: &csipb.VolumeCapability{
|
||||||
AccessMode: &csipb.VolumeCapability_AccessMode{
|
AccessMode: &csipb.VolumeCapability_AccessMode{
|
||||||
Mode: asCSIAccessMode(accessMode),
|
Mode: asCSIAccessMode(accessMode),
|
||||||
|
@ -215,12 +215,12 @@ func (c *csiDriverClient) NodeUnpublishVolume(ctx context.Context, volID string,
|
||||||
|
|
||||||
func (c *csiDriverClient) NodeStageVolume(ctx context.Context,
|
func (c *csiDriverClient) NodeStageVolume(ctx context.Context,
|
||||||
volID string,
|
volID string,
|
||||||
publishInfo map[string]string,
|
publishContext map[string]string,
|
||||||
stagingTargetPath string,
|
stagingTargetPath string,
|
||||||
fsType string,
|
fsType string,
|
||||||
accessMode api.PersistentVolumeAccessMode,
|
accessMode api.PersistentVolumeAccessMode,
|
||||||
nodeStageSecrets map[string]string,
|
secrets map[string]string,
|
||||||
volumeAttribs map[string]string,
|
volumeContext map[string]string,
|
||||||
) error {
|
) error {
|
||||||
klog.V(4).Info(log("calling NodeStageVolume rpc [volid=%s,staging_target_path=%s]", volID, stagingTargetPath))
|
klog.V(4).Info(log("calling NodeStageVolume rpc [volid=%s,staging_target_path=%s]", volID, stagingTargetPath))
|
||||||
if volID == "" {
|
if volID == "" {
|
||||||
|
@ -238,15 +238,15 @@ func (c *csiDriverClient) NodeStageVolume(ctx context.Context,
|
||||||
|
|
||||||
req := &csipb.NodeStageVolumeRequest{
|
req := &csipb.NodeStageVolumeRequest{
|
||||||
VolumeId: volID,
|
VolumeId: volID,
|
||||||
PublishInfo: publishInfo,
|
PublishContext: publishContext,
|
||||||
StagingTargetPath: stagingTargetPath,
|
StagingTargetPath: stagingTargetPath,
|
||||||
VolumeCapability: &csipb.VolumeCapability{
|
VolumeCapability: &csipb.VolumeCapability{
|
||||||
AccessMode: &csipb.VolumeCapability_AccessMode{
|
AccessMode: &csipb.VolumeCapability_AccessMode{
|
||||||
Mode: asCSIAccessMode(accessMode),
|
Mode: asCSIAccessMode(accessMode),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
NodeStageSecrets: nodeStageSecrets,
|
Secrets: secrets,
|
||||||
VolumeAttributes: volumeAttribs,
|
VolumeContext: volumeContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
if fsType == fsTypeBlockName {
|
if fsType == fsTypeBlockName {
|
||||||
|
|
|
@ -23,7 +23,7 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
csipb "github.com/container-storage-interface/spec/lib/go/csi/v0"
|
csipb "github.com/container-storage-interface/spec/lib/go/csi"
|
||||||
api "k8s.io/api/core/v1"
|
api "k8s.io/api/core/v1"
|
||||||
"k8s.io/kubernetes/pkg/volume/csi/fake"
|
"k8s.io/kubernetes/pkg/volume/csi/fake"
|
||||||
)
|
)
|
||||||
|
@ -57,19 +57,19 @@ func (c *fakeCsiDriverClient) NodePublishVolume(
|
||||||
targetPath string,
|
targetPath string,
|
||||||
accessMode api.PersistentVolumeAccessMode,
|
accessMode api.PersistentVolumeAccessMode,
|
||||||
volumeInfo map[string]string,
|
volumeInfo map[string]string,
|
||||||
volumeAttribs map[string]string,
|
volumeContext map[string]string,
|
||||||
nodePublishSecrets map[string]string,
|
secrets map[string]string,
|
||||||
fsType string,
|
fsType string,
|
||||||
mountOptions []string,
|
mountOptions []string,
|
||||||
) error {
|
) error {
|
||||||
c.t.Log("calling fake.NodePublishVolume...")
|
c.t.Log("calling fake.NodePublishVolume...")
|
||||||
req := &csipb.NodePublishVolumeRequest{
|
req := &csipb.NodePublishVolumeRequest{
|
||||||
VolumeId: volID,
|
VolumeId: volID,
|
||||||
TargetPath: targetPath,
|
TargetPath: targetPath,
|
||||||
Readonly: readOnly,
|
Readonly: readOnly,
|
||||||
PublishInfo: volumeInfo,
|
PublishContext: volumeInfo,
|
||||||
VolumeAttributes: volumeAttribs,
|
VolumeContext: volumeContext,
|
||||||
NodePublishSecrets: nodePublishSecrets,
|
Secrets: secrets,
|
||||||
VolumeCapability: &csipb.VolumeCapability{
|
VolumeCapability: &csipb.VolumeCapability{
|
||||||
AccessMode: &csipb.VolumeCapability_AccessMode{
|
AccessMode: &csipb.VolumeCapability_AccessMode{
|
||||||
Mode: asCSIAccessMode(accessMode),
|
Mode: asCSIAccessMode(accessMode),
|
||||||
|
@ -100,17 +100,17 @@ func (c *fakeCsiDriverClient) NodeUnpublishVolume(ctx context.Context, volID str
|
||||||
|
|
||||||
func (c *fakeCsiDriverClient) NodeStageVolume(ctx context.Context,
|
func (c *fakeCsiDriverClient) NodeStageVolume(ctx context.Context,
|
||||||
volID string,
|
volID string,
|
||||||
publishInfo map[string]string,
|
publishContext map[string]string,
|
||||||
stagingTargetPath string,
|
stagingTargetPath string,
|
||||||
fsType string,
|
fsType string,
|
||||||
accessMode api.PersistentVolumeAccessMode,
|
accessMode api.PersistentVolumeAccessMode,
|
||||||
nodeStageSecrets map[string]string,
|
secrets map[string]string,
|
||||||
volumeAttribs map[string]string,
|
volumeContext map[string]string,
|
||||||
) error {
|
) error {
|
||||||
c.t.Log("calling fake.NodeStageVolume...")
|
c.t.Log("calling fake.NodeStageVolume...")
|
||||||
req := &csipb.NodeStageVolumeRequest{
|
req := &csipb.NodeStageVolumeRequest{
|
||||||
VolumeId: volID,
|
VolumeId: volID,
|
||||||
PublishInfo: publishInfo,
|
PublishContext: publishContext,
|
||||||
StagingTargetPath: stagingTargetPath,
|
StagingTargetPath: stagingTargetPath,
|
||||||
VolumeCapability: &csipb.VolumeCapability{
|
VolumeCapability: &csipb.VolumeCapability{
|
||||||
AccessMode: &csipb.VolumeCapability_AccessMode{
|
AccessMode: &csipb.VolumeCapability_AccessMode{
|
||||||
|
@ -122,8 +122,8 @@ func (c *fakeCsiDriverClient) NodeStageVolume(ctx context.Context,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
NodeStageSecrets: nodeStageSecrets,
|
Secrets: secrets,
|
||||||
VolumeAttributes: volumeAttribs,
|
VolumeContext: volumeContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := c.nodeClient.NodeStageVolume(ctx, req)
|
_, err := c.nodeClient.NodeStageVolume(ctx, req)
|
||||||
|
@ -321,7 +321,7 @@ func TestClientNodeStageVolume(t *testing.T) {
|
||||||
volID string
|
volID string
|
||||||
stagingTargetPath string
|
stagingTargetPath string
|
||||||
fsType string
|
fsType string
|
||||||
secret map[string]string
|
secrets map[string]string
|
||||||
mustFail bool
|
mustFail bool
|
||||||
err error
|
err error
|
||||||
}{
|
}{
|
||||||
|
@ -351,7 +351,7 @@ func TestClientNodeStageVolume(t *testing.T) {
|
||||||
tc.stagingTargetPath,
|
tc.stagingTargetPath,
|
||||||
tc.fsType,
|
tc.fsType,
|
||||||
api.ReadWriteOnce,
|
api.ReadWriteOnce,
|
||||||
tc.secret,
|
tc.secrets,
|
||||||
map[string]string{"attr0": "val0"},
|
map[string]string{"attr0": "val0"},
|
||||||
)
|
)
|
||||||
checkErr(t, tc.mustFail, err)
|
checkErr(t, tc.mustFail, err)
|
||||||
|
|
|
@ -98,47 +98,46 @@ func TestMounterGetPath(t *testing.T) {
|
||||||
func MounterSetUpTests(t *testing.T, podInfoEnabled bool) {
|
func MounterSetUpTests(t *testing.T, podInfoEnabled bool) {
|
||||||
defer utilfeaturetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIDriverRegistry, podInfoEnabled)()
|
defer utilfeaturetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIDriverRegistry, podInfoEnabled)()
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
driver string
|
driver string
|
||||||
attributes map[string]string
|
volumeContext map[string]string
|
||||||
|
expectedVolumeContext map[string]string
|
||||||
expectedAttributes map[string]string
|
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "no pod info",
|
name: "no pod info",
|
||||||
driver: "no-info",
|
driver: "no-info",
|
||||||
attributes: nil,
|
volumeContext: nil,
|
||||||
expectedAttributes: nil,
|
expectedVolumeContext: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "no CSIDriver -> no pod info",
|
name: "no CSIDriver -> no pod info",
|
||||||
driver: "unknown-driver",
|
driver: "unknown-driver",
|
||||||
attributes: nil,
|
volumeContext: nil,
|
||||||
expectedAttributes: nil,
|
expectedVolumeContext: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "CSIDriver with PodInfoRequiredOnMount=nil -> no pod info",
|
name: "CSIDriver with PodInfoRequiredOnMount=nil -> no pod info",
|
||||||
driver: "nil",
|
driver: "nil",
|
||||||
attributes: nil,
|
volumeContext: nil,
|
||||||
expectedAttributes: nil,
|
expectedVolumeContext: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "no pod info -> keep existing attributes",
|
name: "no pod info -> keep existing volumeContext",
|
||||||
driver: "no-info",
|
driver: "no-info",
|
||||||
attributes: map[string]string{"foo": "bar"},
|
volumeContext: map[string]string{"foo": "bar"},
|
||||||
expectedAttributes: map[string]string{"foo": "bar"},
|
expectedVolumeContext: map[string]string{"foo": "bar"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "add pod info",
|
name: "add pod info",
|
||||||
driver: "info",
|
driver: "info",
|
||||||
attributes: nil,
|
volumeContext: nil,
|
||||||
expectedAttributes: map[string]string{"csi.storage.k8s.io/pod.uid": "test-pod", "csi.storage.k8s.io/serviceAccount.name": "test-service-account", "csi.storage.k8s.io/pod.name": "test-pod", "csi.storage.k8s.io/pod.namespace": "test-ns"},
|
expectedVolumeContext: map[string]string{"csi.storage.k8s.io/pod.uid": "test-pod", "csi.storage.k8s.io/serviceAccount.name": "test-service-account", "csi.storage.k8s.io/pod.name": "test-pod", "csi.storage.k8s.io/pod.namespace": "test-ns"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "add pod info -> keep existing attributes",
|
name: "add pod info -> keep existing volumeContext",
|
||||||
driver: "info",
|
driver: "info",
|
||||||
attributes: map[string]string{"foo": "bar"},
|
volumeContext: map[string]string{"foo": "bar"},
|
||||||
expectedAttributes: map[string]string{"foo": "bar", "csi.storage.k8s.io/pod.uid": "test-pod", "csi.storage.k8s.io/serviceAccount.name": "test-service-account", "csi.storage.k8s.io/pod.name": "test-pod", "csi.storage.k8s.io/pod.namespace": "test-ns"},
|
expectedVolumeContext: map[string]string{"foo": "bar", "csi.storage.k8s.io/pod.uid": "test-pod", "csi.storage.k8s.io/serviceAccount.name": "test-service-account", "csi.storage.k8s.io/pod.name": "test-pod", "csi.storage.k8s.io/pod.namespace": "test-ns"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +162,7 @@ func MounterSetUpTests(t *testing.T, podInfoEnabled bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pv := makeTestPV("test-pv", 10, test.driver, testVol)
|
pv := makeTestPV("test-pv", 10, test.driver, testVol)
|
||||||
pv.Spec.CSI.VolumeAttributes = test.attributes
|
pv.Spec.CSI.VolumeAttributes = test.volumeContext
|
||||||
pv.Spec.MountOptions = []string{"foo=bar", "baz=qux"}
|
pv.Spec.MountOptions = []string{"foo=bar", "baz=qux"}
|
||||||
pvName := pv.GetName()
|
pvName := pv.GetName()
|
||||||
|
|
||||||
|
@ -245,13 +244,13 @@ func MounterSetUpTests(t *testing.T, podInfoEnabled bool) {
|
||||||
t.Errorf("csi server expected mount options %v, got %v", pv.Spec.MountOptions, vol.MountFlags)
|
t.Errorf("csi server expected mount options %v, got %v", pv.Spec.MountOptions, vol.MountFlags)
|
||||||
}
|
}
|
||||||
if podInfoEnabled {
|
if podInfoEnabled {
|
||||||
if !reflect.DeepEqual(vol.Attributes, test.expectedAttributes) {
|
if !reflect.DeepEqual(vol.VolumeContext, test.expectedVolumeContext) {
|
||||||
t.Errorf("csi server expected attributes %+v, got %+v", test.expectedAttributes, vol.Attributes)
|
t.Errorf("csi server expected volumeContext %+v, got %+v", test.expectedVolumeContext, vol.VolumeContext)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// CSIPodInfo feature is disabled, we expect no modifications to attributes.
|
// CSIPodInfo feature is disabled, we expect no modifications to volumeContext.
|
||||||
if !reflect.DeepEqual(vol.Attributes, test.attributes) {
|
if !reflect.DeepEqual(vol.VolumeContext, test.volumeContext) {
|
||||||
t.Errorf("csi server expected attributes %+v, got %+v", test.attributes, vol.Attributes)
|
t.Errorf("csi server expected volumeContext %+v, got %+v", test.volumeContext, vol.VolumeContext)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -9,7 +9,7 @@ go_library(
|
||||||
importpath = "k8s.io/kubernetes/pkg/volume/csi/fake",
|
importpath = "k8s.io/kubernetes/pkg/volume/csi/fake",
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
"//vendor/github.com/container-storage-interface/spec/lib/go/csi/v0:go_default_library",
|
"//vendor/github.com/container-storage-interface/spec/lib/go/csi:go_default_library",
|
||||||
"//vendor/google.golang.org/grpc:go_default_library",
|
"//vendor/google.golang.org/grpc:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
@ -23,7 +23,7 @@ import (
|
||||||
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
|
||||||
csipb "github.com/container-storage-interface/spec/lib/go/csi/v0"
|
csipb "github.com/container-storage-interface/spec/lib/go/csi"
|
||||||
)
|
)
|
||||||
|
|
||||||
// IdentityClient is a CSI identity client used for testing
|
// IdentityClient is a CSI identity client used for testing
|
||||||
|
@ -57,9 +57,9 @@ func (f *IdentityClient) Probe(ctx context.Context, in *csipb.ProbeRequest, opts
|
||||||
}
|
}
|
||||||
|
|
||||||
type CSIVolume struct {
|
type CSIVolume struct {
|
||||||
Attributes map[string]string
|
VolumeContext map[string]string
|
||||||
Path string
|
Path string
|
||||||
MountFlags []string
|
MountFlags []string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NodeClient returns CSI node client
|
// NodeClient returns CSI node client
|
||||||
|
@ -99,10 +99,10 @@ func (f *NodeClient) GetNodeStagedVolumes() map[string]CSIVolume {
|
||||||
return f.nodeStagedVolumes
|
return f.nodeStagedVolumes
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *NodeClient) AddNodeStagedVolume(volID, deviceMountPath string, attributes map[string]string) {
|
func (f *NodeClient) AddNodeStagedVolume(volID, deviceMountPath string, volumeContext map[string]string) {
|
||||||
f.nodeStagedVolumes[volID] = CSIVolume{
|
f.nodeStagedVolumes[volID] = CSIVolume{
|
||||||
Path: deviceMountPath,
|
Path: deviceMountPath,
|
||||||
Attributes: attributes,
|
VolumeContext: volumeContext,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,9 +125,9 @@ func (f *NodeClient) NodePublishVolume(ctx context.Context, req *csipb.NodePubli
|
||||||
return nil, errors.New("invalid fstype")
|
return nil, errors.New("invalid fstype")
|
||||||
}
|
}
|
||||||
f.nodePublishedVolumes[req.GetVolumeId()] = CSIVolume{
|
f.nodePublishedVolumes[req.GetVolumeId()] = CSIVolume{
|
||||||
Path: req.GetTargetPath(),
|
Path: req.GetTargetPath(),
|
||||||
Attributes: req.GetVolumeAttributes(),
|
VolumeContext: req.GetVolumeContext(),
|
||||||
MountFlags: req.GetVolumeCapability().GetMount().MountFlags,
|
MountFlags: req.GetVolumeCapability().GetMount().MountFlags,
|
||||||
}
|
}
|
||||||
return &csipb.NodePublishVolumeResponse{}, nil
|
return &csipb.NodePublishVolumeResponse{}, nil
|
||||||
}
|
}
|
||||||
|
@ -172,8 +172,8 @@ func (f *NodeClient) NodeStageVolume(ctx context.Context, req *csipb.NodeStageVo
|
||||||
}
|
}
|
||||||
|
|
||||||
f.nodeStagedVolumes[req.GetVolumeId()] = CSIVolume{
|
f.nodeStagedVolumes[req.GetVolumeId()] = CSIVolume{
|
||||||
Path: req.GetStagingTargetPath(),
|
Path: req.GetStagingTargetPath(),
|
||||||
Attributes: req.GetVolumeAttributes(),
|
VolumeContext: req.GetVolumeContext(),
|
||||||
}
|
}
|
||||||
return &csipb.NodeStageVolumeResponse{}, nil
|
return &csipb.NodeStageVolumeResponse{}, nil
|
||||||
}
|
}
|
||||||
|
@ -195,11 +195,6 @@ func (f *NodeClient) NodeUnstageVolume(ctx context.Context, req *csipb.NodeUnsta
|
||||||
return &csipb.NodeUnstageVolumeResponse{}, nil
|
return &csipb.NodeUnstageVolumeResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NodeGetId implements method
|
|
||||||
func (f *NodeClient) NodeGetId(ctx context.Context, in *csipb.NodeGetIdRequest, opts ...grpc.CallOption) (*csipb.NodeGetIdResponse, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// NodeGetId implements csi method
|
// NodeGetId implements csi method
|
||||||
func (f *NodeClient) NodeGetInfo(ctx context.Context, in *csipb.NodeGetInfoRequest, opts ...grpc.CallOption) (*csipb.NodeGetInfoResponse, error) {
|
func (f *NodeClient) NodeGetInfo(ctx context.Context, in *csipb.NodeGetInfoRequest, opts ...grpc.CallOption) (*csipb.NodeGetInfoResponse, error) {
|
||||||
if f.nextErr != nil {
|
if f.nextErr != nil {
|
||||||
|
@ -227,6 +222,11 @@ func (f *NodeClient) NodeGetCapabilities(ctx context.Context, in *csipb.NodeGetC
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NodeGetVolumeStats implements csi method
|
||||||
|
func (f *NodeClient) NodeGetVolumeStats(ctx context.Context, in *csipb.NodeGetVolumeStatsRequest, opts ...grpc.CallOption) (*csipb.NodeGetVolumeStatsResponse, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
// ControllerClient represents a CSI Controller client
|
// ControllerClient represents a CSI Controller client
|
||||||
type ControllerClient struct {
|
type ControllerClient struct {
|
||||||
nextCapabilities []*csipb.ControllerServiceCapability
|
nextCapabilities []*csipb.ControllerServiceCapability
|
||||||
|
|
|
@ -19,7 +19,7 @@ go_library(
|
||||||
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/util/retry:go_default_library",
|
"//staging/src/k8s.io/client-go/util/retry:go_default_library",
|
||||||
"//staging/src/k8s.io/csi-api/pkg/apis/csi/v1alpha1:go_default_library",
|
"//staging/src/k8s.io/csi-api/pkg/apis/csi/v1alpha1:go_default_library",
|
||||||
"//vendor/github.com/container-storage-interface/spec/lib/go/csi/v0:go_default_library",
|
"//vendor/github.com/container-storage-interface/spec/lib/go/csi:go_default_library",
|
||||||
"//vendor/k8s.io/klog:go_default_library",
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -61,7 +61,7 @@ go_test(
|
||||||
"//staging/src/k8s.io/client-go/util/testing:go_default_library",
|
"//staging/src/k8s.io/client-go/util/testing:go_default_library",
|
||||||
"//staging/src/k8s.io/csi-api/pkg/apis/csi/v1alpha1:go_default_library",
|
"//staging/src/k8s.io/csi-api/pkg/apis/csi/v1alpha1:go_default_library",
|
||||||
"//staging/src/k8s.io/csi-api/pkg/client/clientset/versioned/fake:go_default_library",
|
"//staging/src/k8s.io/csi-api/pkg/client/clientset/versioned/fake:go_default_library",
|
||||||
"//vendor/github.com/container-storage-interface/spec/lib/go/csi/v0:go_default_library",
|
"//vendor/github.com/container-storage-interface/spec/lib/go/csi:go_default_library",
|
||||||
"//vendor/github.com/stretchr/testify/assert:go_default_library",
|
"//vendor/github.com/stretchr/testify/assert:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
@ -23,7 +23,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
csipb "github.com/container-storage-interface/spec/lib/go/csi/v0"
|
csipb "github.com/container-storage-interface/spec/lib/go/csi"
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
"k8s.io/apimachinery/pkg/api/resource"
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
|
|
|
@ -21,7 +21,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/container-storage-interface/spec/lib/go/csi/v0"
|
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/resource"
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
|
|
Loading…
Reference in New Issue