Skip to content

Commit 3680b7c

Browse files
authored
Merge pull request #89 from msau42/spec-1.0
Update external-attacher to use CSI spec 1.0
2 parents 9da8c6d + afb5c14 commit 3680b7c

51 files changed

Lines changed: 5054 additions & 3459 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Gopkg.lock

Lines changed: 23 additions & 142 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

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

77
[[constraint]]
88
name = "github.com/golang/protobuf"
@@ -12,13 +12,9 @@
1212
branch = "master"
1313
name = "github.com/golang/glog"
1414

15-
#[[constraint]]
16-
# name = "github.com/golang/mock"
17-
# version = "1.0.0"
18-
1915
[[constraint]]
20-
branch = "master"
2116
name = "github.com/kubernetes-csi/csi-test"
17+
version = "1.0.0-rc2"
2218

2319
[[constraint]]
2420
name = "google.golang.org/grpc"

pkg/connection/connection.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
"strings"
2424
"time"
2525

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

195-
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) {
195+
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) {
196196
client := csi.NewControllerClient(c.conn)
197197

198198
req := csi.ControllerPublishVolumeRequest{
199-
VolumeId: volumeID,
200-
NodeId: nodeID,
201-
VolumeCapability: caps,
202-
Readonly: readOnly,
203-
VolumeAttributes: attributes,
204-
ControllerPublishSecrets: secrets,
199+
VolumeId: volumeID,
200+
NodeId: nodeID,
201+
VolumeCapability: caps,
202+
Readonly: readOnly,
203+
VolumeContext: context,
204+
Secrets: secrets,
205205
}
206206

207207
rsp, err := client.ControllerPublishVolume(ctx, &req)
208208
if err != nil {
209209
return nil, isFinalError(err), err
210210
}
211-
return rsp.PublishInfo, false, nil
211+
return rsp.PublishContext, false, nil
212212
}
213213

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

223223
_, err = client.ControllerUnpublishVolume(ctx, &req)

pkg/connection/connection_test.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"reflect"
2323
"testing"
2424

25-
"github.com/container-storage-interface/spec/lib/go/csi/v0"
25+
"github.com/container-storage-interface/spec/lib/go/csi"
2626
"github.com/golang/mock/gomock"
2727
"github.com/golang/protobuf/proto"
2828
"github.com/kubernetes-csi/csi-test/driver"
@@ -374,15 +374,15 @@ func TestAttach(t *testing.T) {
374374
VolumeId: defaultVolumeID,
375375
NodeId: defaultNodeID,
376376
VolumeCapability: defaultCaps,
377-
VolumeAttributes: map[string]string{"foo": "bar"},
377+
VolumeContext: map[string]string{"foo": "bar"},
378378
Readonly: false,
379379
}
380380
secretsRequest := &csi.ControllerPublishVolumeRequest{
381-
VolumeId: defaultVolumeID,
382-
NodeId: defaultNodeID,
383-
VolumeCapability: defaultCaps,
384-
ControllerPublishSecrets: map[string]string{"foo": "bar"},
385-
Readonly: false,
381+
VolumeId: defaultVolumeID,
382+
NodeId: defaultNodeID,
383+
VolumeCapability: defaultCaps,
384+
Secrets: map[string]string{"foo": "bar"},
385+
Readonly: false,
386386
}
387387

388388
tests := []struct {
@@ -407,7 +407,7 @@ func TestAttach(t *testing.T) {
407407
caps: defaultCaps,
408408
input: defaultRequest,
409409
output: &csi.ControllerPublishVolumeResponse{
410-
PublishInfo: publishVolumeInfo,
410+
PublishContext: publishVolumeInfo,
411411
},
412412
expectError: false,
413413
expectedInfo: publishVolumeInfo,
@@ -432,7 +432,7 @@ func TestAttach(t *testing.T) {
432432
readonly: true,
433433
input: readOnlyRequest,
434434
output: &csi.ControllerPublishVolumeResponse{
435-
PublishInfo: publishVolumeInfo,
435+
PublishContext: publishVolumeInfo,
436436
},
437437
expectError: false,
438438
expectedInfo: publishVolumeInfo,
@@ -468,7 +468,7 @@ func TestAttach(t *testing.T) {
468468
attributes: map[string]string{"foo": "bar"},
469469
input: attributesRequest,
470470
output: &csi.ControllerPublishVolumeResponse{
471-
PublishInfo: publishVolumeInfo,
471+
PublishContext: publishVolumeInfo,
472472
},
473473
expectError: false,
474474
expectedInfo: publishVolumeInfo,
@@ -482,7 +482,7 @@ func TestAttach(t *testing.T) {
482482
secrets: map[string]string{"foo": "bar"},
483483
input: secretsRequest,
484484
output: &csi.ControllerPublishVolumeResponse{
485-
PublishInfo: publishVolumeInfo,
485+
PublishContext: publishVolumeInfo,
486486
},
487487
expectError: false,
488488
expectedInfo: publishVolumeInfo,
@@ -519,7 +519,7 @@ func TestAttach(t *testing.T) {
519519
t.Errorf("test %q: got error: %v", test.name, err)
520520
}
521521
if err == nil && !reflect.DeepEqual(publishInfo, test.expectedInfo) {
522-
t.Errorf("got unexpected PublishInfo: %+v", publishInfo)
522+
t.Errorf("got unexpected PublishContext: %+v", publishInfo)
523523
}
524524
if detached != test.expectDetached {
525525
t.Errorf("test %q: expected detached=%v, got %v", test.name, test.expectDetached, detached)
@@ -540,7 +540,7 @@ func TestDetachAttach(t *testing.T) {
540540
secretsRequest := &csi.ControllerUnpublishVolumeRequest{
541541
VolumeId: defaultVolumeID,
542542
NodeId: defaultNodeID,
543-
ControllerUnpublishSecrets: map[string]string{"foo": "bar"},
543+
Secrets: map[string]string{"foo": "bar"},
544544
}
545545

546546
tests := []struct {

pkg/controller/framework_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"testing"
2525
"time"
2626

27-
"github.com/container-storage-interface/spec/lib/go/csi/v0"
27+
"github.com/container-storage-interface/spec/lib/go/csi"
2828
"github.com/davecgh/go-spew/spew"
2929
"github.com/golang/glog"
3030
"github.com/kubernetes-csi/external-attacher/pkg/connection"

pkg/controller/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"fmt"
2222
"regexp"
2323

24-
"github.com/container-storage-interface/spec/lib/go/csi/v0"
24+
"github.com/container-storage-interface/spec/lib/go/csi"
2525
"github.com/golang/glog"
2626
"k8s.io/api/core/v1"
2727
storage "k8s.io/api/storage/v1beta1"

pkg/controller/util_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"reflect"
55
"testing"
66

7-
"github.com/container-storage-interface/spec/lib/go/csi/v0"
7+
"github.com/container-storage-interface/spec/lib/go/csi"
88
"k8s.io/api/core/v1"
99
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1010
)

vendor/github.com/container-storage-interface/spec/.gitignore

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/container-storage-interface/spec/.travis.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
66 KB
Binary file not shown.

0 commit comments

Comments
 (0)