Skip to content

Commit 441a01d

Browse files
committed
Update to use csi proxy beta
This PR updates driver to use csi-proxy beta version.
1 parent a259069 commit 441a01d

File tree

211 files changed

+47970
-21019
lines changed

Some content is hidden

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

211 files changed

+47970
-21019
lines changed

deploy/kubernetes/base/node_windows/node.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ spec:
4343
# Don't change base image without changing pdImagePlaceholder in
4444
# test/k8s-integration/main.go
4545
image: gke.gcr.io/gcp-compute-persistent-disk-csi-driver-win
46+
imagePullPolicy: Always
4647
args:
4748
- "--v=5"
4849
- "--endpoint=unix:/csi/csi.sock"
@@ -53,19 +54,19 @@ spec:
5354
- name: plugin-dir
5455
mountPath: C:\csi
5556
- name: csi-proxy-disk-pipe
56-
mountPath: \\.\pipe\csi-proxy-disk-v1alpha1
57+
mountPath: \\.\pipe\csi-proxy-disk-v1beta1
5758
- name: csi-proxy-volume-pipe
58-
mountPath: \\.\pipe\csi-proxy-volume-v1alpha1
59+
mountPath: \\.\pipe\csi-proxy-volume-v1beta1
5960
- name: csi-proxy-filesystem-pipe
6061
mountPath: \\.\pipe\csi-proxy-filesystem-v1alpha1
6162
volumes:
6263
- name: csi-proxy-disk-pipe
6364
hostPath:
64-
path: \\.\pipe\csi-proxy-disk-v1alpha1
65+
path: \\.\pipe\csi-proxy-disk-v1beta1
6566
type: ""
6667
- name: csi-proxy-volume-pipe
6768
hostPath:
68-
path: \\.\pipe\csi-proxy-volume-v1alpha1
69+
path: \\.\pipe\csi-proxy-volume-v1beta1
6970
type: ""
7071
- name: csi-proxy-filesystem-pipe
7172
hostPath:

deploy/kubernetes/base/node_windows/psp.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ spec:
1818
- pathPrefix: \var\lib\kubelet
1919
- pathPrefix: \var\lib\kubelet\plugins_registry
2020
- pathPrefix: \var\lib\kubelet\plugins\pd.csi.storage.gke.io
21-
- pathPrefix: \\.\pipe\csi-proxy-disk-v1alpha1
22-
- pathPrefix: \\.\pipe\csi-proxy-volume-v1alpha1
21+
- pathPrefix: \\.\pipe\csi-proxy-disk-v1beta1
22+
- pathPrefix: \\.\pipe\csi-proxy-volume-v1beta1
2323
- pathPrefix: \\.\pipe\csi-proxy-filesystem-v1alpha1
2424

go.mod

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,17 @@ require (
66
cloud.google.com/go v0.45.1
77
github.com/GoogleCloudPlatform/k8s-cloud-provider v0.0.0-20190822182118-27a4ced34534
88
github.com/container-storage-interface/spec v1.2.0
9-
github.com/golang/protobuf v1.3.4
9+
github.com/golang/protobuf v1.4.1
1010
github.com/google/uuid v1.1.1
1111
github.com/hashicorp/go-multierror v1.0.0 // indirect
12-
github.com/kubernetes-csi/csi-proxy/client v0.0.0-20200330215040-9eff16441b2a
12+
github.com/kubernetes-csi/csi-proxy/client v0.2.0
1313
github.com/kubernetes-csi/csi-test/v3 v3.0.0
1414
github.com/onsi/ginkgo v1.11.0
1515
github.com/onsi/gomega v1.7.1
1616
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
1717
golang.org/x/sys v0.0.0-20191113165036-4c7a9d0fe056
18-
golang.org/x/tools/gopls v0.3.3 // indirect
1918
google.golang.org/api v0.10.0
20-
google.golang.org/genproto v0.0.0-20191114150713-6bbd007550de
19+
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013
2120
google.golang.org/grpc v1.27.1
2221
gopkg.in/gcfg.v1 v1.2.3
2322
gopkg.in/warnings.v0 v0.1.2 // indirect

go.sum

Lines changed: 25 additions & 152 deletions
Large diffs are not rendered by default.

pkg/mount-manager/safe-mounter_windows.go

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,18 @@ import (
2222
"fmt"
2323
"os"
2424
"path/filepath"
25+
"strings"
2526

26-
diskv1alpha1 "github.com/kubernetes-csi/csi-proxy/client/api/disk/v1alpha1"
27-
diskclientv1alpha1 "github.com/kubernetes-csi/csi-proxy/client/groups/disk/v1alpha1"
27+
diskv1beta1 "github.com/kubernetes-csi/csi-proxy/client/api/disk/v1beta1"
28+
diskclientv1beta1 "github.com/kubernetes-csi/csi-proxy/client/groups/disk/v1beta1"
2829

2930
fsv1alpha1 "github.com/kubernetes-csi/csi-proxy/client/api/filesystem/v1alpha1"
3031
fsclientv1alpha1 "github.com/kubernetes-csi/csi-proxy/client/groups/filesystem/v1alpha1"
3132

32-
volumev1alpha1 "github.com/kubernetes-csi/csi-proxy/client/api/volume/v1alpha1"
33-
volumeclientv1alpha1 "github.com/kubernetes-csi/csi-proxy/client/groups/volume/v1alpha1"
33+
volumev1beta1 "github.com/kubernetes-csi/csi-proxy/client/api/volume/v1beta1"
34+
volumeclientv1beta1 "github.com/kubernetes-csi/csi-proxy/client/groups/volume/v1beta1"
3435

36+
"k8s.io/klog"
3537
utilexec "k8s.io/utils/exec"
3638
"k8s.io/utils/mount"
3739
)
@@ -40,20 +42,20 @@ var _ mount.Interface = &CSIProxyMounter{}
4042

4143
type CSIProxyMounter struct {
4244
FsClient *fsclientv1alpha1.Client
43-
DiskClient *diskclientv1alpha1.Client
44-
VolumeClient *volumeclientv1alpha1.Client
45+
DiskClient *diskclientv1beta1.Client
46+
VolumeClient *volumeclientv1beta1.Client
4547
}
4648

4749
func NewCSIProxyMounter() (*CSIProxyMounter, error) {
4850
fsClient, err := fsclientv1alpha1.NewClient()
4951
if err != nil {
5052
return nil, err
5153
}
52-
diskClient, err := diskclientv1alpha1.NewClient()
54+
diskClient, err := diskclientv1beta1.NewClient()
5355
if err != nil {
5456
return nil, err
5557
}
56-
volumeClient, err := volumeclientv1alpha1.NewClient()
58+
volumeClient, err := volumeclientv1beta1.NewClient()
5759
if err != nil {
5860
return nil, err
5961
}
@@ -142,30 +144,37 @@ func (mounter *CSIProxyMounter) Unmount(target string) error {
142144
}
143145

144146
func (mounter *CSIProxyMounter) GetDevicePath(deviceName string, partition string, volumeKey string) (string, error) {
145-
getDiskNumberRequest := &diskv1alpha1.GetDiskNumberByNameRequest{
146-
DiskName: deviceName,
147-
}
148-
getDiskNumberResponse, err := mounter.DiskClient.GetDiskNumberByName(context.Background(), getDiskNumberRequest)
147+
id := "page83"
148+
listRequest := &diskv1beta1.ListDiskIDsRequest{}
149+
diskIDsResponse, err := mounter.DiskClient.ListDiskIDs(context.Background(), listRequest)
149150
if err != nil {
150151
return "", err
151152
}
152-
return getDiskNumberResponse.DiskNumber, nil
153+
diskIDsMap := diskIDsResponse.GetDiskIDs()
154+
for diskNum, diskInfo := range diskIDsMap {
155+
klog.V(4).Infof("found disknum %s, diskInfo %v", diskNum, diskInfo)
156+
idValue, found := diskInfo.Identifiers[id]
157+
if found && strings.Contains(idValue, deviceName) {
158+
return diskNum, nil
159+
}
160+
}
161+
return "", fmt.Errorf("could not find disk number for device %s", deviceName)
153162

154163
}
155164

156165
// FormatAndMount accepts the source disk number, target path to mount, the fstype to format with and options to be used.
157166
// After formatting, it will mount the disk to target path on the host
158167
func (mounter *CSIProxyMounter) FormatAndMount(source string, target string, fstype string, options []string) error {
159168
// Call PartitionDisk CSI proxy call to partition the disk and return the volume id
160-
partionDiskRequest := &diskv1alpha1.PartitionDiskRequest{
169+
partionDiskRequest := &diskv1beta1.PartitionDiskRequest{
161170
DiskID: source,
162171
}
163172

164173
_, err := mounter.DiskClient.PartitionDisk(context.Background(), partionDiskRequest)
165174
if err != nil {
166175
return err
167176
}
168-
volumeIDsRequest := &volumev1alpha1.ListVolumesOnDiskRequest{
177+
volumeIDsRequest := &volumev1beta1.ListVolumesOnDiskRequest{
169178
DiskId: source,
170179
}
171180
volumeIdResponse, err := mounter.VolumeClient.ListVolumesOnDisk(context.Background(), volumeIDsRequest)
@@ -174,15 +183,15 @@ func (mounter *CSIProxyMounter) FormatAndMount(source string, target string, fst
174183
}
175184
// TODO: consider partitions and choose the right partition.
176185
volumeID := volumeIdResponse.VolumeIds[0]
177-
isVolumeFormattedRequest := &volumev1alpha1.IsVolumeFormattedRequest{
186+
isVolumeFormattedRequest := &volumev1beta1.IsVolumeFormattedRequest{
178187
VolumeId: volumeID,
179188
}
180189
isVolumeFormattedResponse, err := mounter.VolumeClient.IsVolumeFormatted(context.Background(), isVolumeFormattedRequest)
181190
if err != nil {
182191
return err
183192
}
184193
if !isVolumeFormattedResponse.Formatted {
185-
formatVolumeRequest := &volumev1alpha1.FormatVolumeRequest{
194+
formatVolumeRequest := &volumev1beta1.FormatVolumeRequest{
186195
VolumeId: volumeID,
187196
// TODO (jingxu97): Accept the filesystem and other options
188197
}
@@ -192,7 +201,7 @@ func (mounter *CSIProxyMounter) FormatAndMount(source string, target string, fst
192201
}
193202
}
194203
// Mount the volume by calling the CSI proxy call.
195-
mountVolumeRequest := &volumev1alpha1.MountVolumeRequest{
204+
mountVolumeRequest := &volumev1beta1.MountVolumeRequest{
196205
VolumeId: volumeID,
197206
Path: target,
198207
}

0 commit comments

Comments
 (0)