Skip to content

Commit

Permalink
Merge pull request #89 from msau42/spec-1.0
Browse files Browse the repository at this point in the history
Update external-attacher to use CSI spec 1.0
  • Loading branch information
k8s-ci-robot authored Nov 15, 2018
2 parents 9da8c6d + afb5c14 commit 3680b7c
Show file tree
Hide file tree
Showing 51 changed files with 5,054 additions and 3,459 deletions.
165 changes: 23 additions & 142 deletions Gopkg.lock

Large diffs are not rendered by default.

8 changes: 2 additions & 6 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[[constraint]]
name = "github.com/container-storage-interface/spec"
version = "~0.3.0"
version = "1.0.0-rc2"

[[constraint]]
name = "github.com/golang/protobuf"
Expand All @@ -12,13 +12,9 @@
branch = "master"
name = "github.com/golang/glog"

#[[constraint]]
# name = "github.com/golang/mock"
# version = "1.0.0"

[[constraint]]
branch = "master"
name = "github.com/kubernetes-csi/csi-test"
version = "1.0.0-rc2"

[[constraint]]
name = "google.golang.org/grpc"
Expand Down
20 changes: 10 additions & 10 deletions pkg/connection/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"strings"
"time"

"github.com/container-storage-interface/spec/lib/go/csi/v0"
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/golang/glog"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
Expand Down Expand Up @@ -192,23 +192,23 @@ func (c *csiConnection) SupportsPluginControllerService(ctx context.Context) (bo
return false, nil
}

func (c *csiConnection) Attach(ctx context.Context, volumeID string, readOnly bool, nodeID string, caps *csi.VolumeCapability, attributes, secrets map[string]string) (metadata map[string]string, detached bool, err error) {
func (c *csiConnection) Attach(ctx context.Context, volumeID string, readOnly bool, nodeID string, caps *csi.VolumeCapability, context, secrets map[string]string) (metadata map[string]string, detached bool, err error) {
client := csi.NewControllerClient(c.conn)

req := csi.ControllerPublishVolumeRequest{
VolumeId: volumeID,
NodeId: nodeID,
VolumeCapability: caps,
Readonly: readOnly,
VolumeAttributes: attributes,
ControllerPublishSecrets: secrets,
VolumeId: volumeID,
NodeId: nodeID,
VolumeCapability: caps,
Readonly: readOnly,
VolumeContext: context,
Secrets: secrets,
}

rsp, err := client.ControllerPublishVolume(ctx, &req)
if err != nil {
return nil, isFinalError(err), err
}
return rsp.PublishInfo, false, nil
return rsp.PublishContext, false, nil
}

func (c *csiConnection) Detach(ctx context.Context, volumeID string, nodeID string, secrets map[string]string) (detached bool, err error) {
Expand All @@ -217,7 +217,7 @@ func (c *csiConnection) Detach(ctx context.Context, volumeID string, nodeID stri
req := csi.ControllerUnpublishVolumeRequest{
VolumeId: volumeID,
NodeId: nodeID,
ControllerUnpublishSecrets: secrets,
Secrets: secrets,
}

_, err = client.ControllerUnpublishVolume(ctx, &req)
Expand Down
26 changes: 13 additions & 13 deletions pkg/connection/connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"reflect"
"testing"

"github.com/container-storage-interface/spec/lib/go/csi/v0"
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/golang/mock/gomock"
"github.com/golang/protobuf/proto"
"github.com/kubernetes-csi/csi-test/driver"
Expand Down Expand Up @@ -374,15 +374,15 @@ func TestAttach(t *testing.T) {
VolumeId: defaultVolumeID,
NodeId: defaultNodeID,
VolumeCapability: defaultCaps,
VolumeAttributes: map[string]string{"foo": "bar"},
VolumeContext: map[string]string{"foo": "bar"},
Readonly: false,
}
secretsRequest := &csi.ControllerPublishVolumeRequest{
VolumeId: defaultVolumeID,
NodeId: defaultNodeID,
VolumeCapability: defaultCaps,
ControllerPublishSecrets: map[string]string{"foo": "bar"},
Readonly: false,
VolumeId: defaultVolumeID,
NodeId: defaultNodeID,
VolumeCapability: defaultCaps,
Secrets: map[string]string{"foo": "bar"},
Readonly: false,
}

tests := []struct {
Expand All @@ -407,7 +407,7 @@ func TestAttach(t *testing.T) {
caps: defaultCaps,
input: defaultRequest,
output: &csi.ControllerPublishVolumeResponse{
PublishInfo: publishVolumeInfo,
PublishContext: publishVolumeInfo,
},
expectError: false,
expectedInfo: publishVolumeInfo,
Expand All @@ -432,7 +432,7 @@ func TestAttach(t *testing.T) {
readonly: true,
input: readOnlyRequest,
output: &csi.ControllerPublishVolumeResponse{
PublishInfo: publishVolumeInfo,
PublishContext: publishVolumeInfo,
},
expectError: false,
expectedInfo: publishVolumeInfo,
Expand Down Expand Up @@ -468,7 +468,7 @@ func TestAttach(t *testing.T) {
attributes: map[string]string{"foo": "bar"},
input: attributesRequest,
output: &csi.ControllerPublishVolumeResponse{
PublishInfo: publishVolumeInfo,
PublishContext: publishVolumeInfo,
},
expectError: false,
expectedInfo: publishVolumeInfo,
Expand All @@ -482,7 +482,7 @@ func TestAttach(t *testing.T) {
secrets: map[string]string{"foo": "bar"},
input: secretsRequest,
output: &csi.ControllerPublishVolumeResponse{
PublishInfo: publishVolumeInfo,
PublishContext: publishVolumeInfo,
},
expectError: false,
expectedInfo: publishVolumeInfo,
Expand Down Expand Up @@ -519,7 +519,7 @@ func TestAttach(t *testing.T) {
t.Errorf("test %q: got error: %v", test.name, err)
}
if err == nil && !reflect.DeepEqual(publishInfo, test.expectedInfo) {
t.Errorf("got unexpected PublishInfo: %+v", publishInfo)
t.Errorf("got unexpected PublishContext: %+v", publishInfo)
}
if detached != test.expectDetached {
t.Errorf("test %q: expected detached=%v, got %v", test.name, test.expectDetached, detached)
Expand All @@ -540,7 +540,7 @@ func TestDetachAttach(t *testing.T) {
secretsRequest := &csi.ControllerUnpublishVolumeRequest{
VolumeId: defaultVolumeID,
NodeId: defaultNodeID,
ControllerUnpublishSecrets: map[string]string{"foo": "bar"},
Secrets: map[string]string{"foo": "bar"},
}

tests := []struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/framework_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"testing"
"time"

"github.com/container-storage-interface/spec/lib/go/csi/v0"
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/davecgh/go-spew/spew"
"github.com/golang/glog"
"github.com/kubernetes-csi/external-attacher/pkg/connection"
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"fmt"
"regexp"

"github.com/container-storage-interface/spec/lib/go/csi/v0"
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/golang/glog"
"k8s.io/api/core/v1"
storage "k8s.io/api/storage/v1beta1"
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"reflect"
"testing"

"github.com/container-storage-interface/spec/lib/go/csi/v0"
"github.com/container-storage-interface/spec/lib/go/csi"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions vendor/github.com/container-storage-interface/spec/OWNERS

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/container-storage-interface/spec/VERSION

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3680b7c

Please sign in to comment.