Skip to content

Commit 75565a3

Browse files
committed
1 parent 7f5fa35 commit 75565a3

Some content is hidden

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

49 files changed

+6202
-2338
lines changed

Diff for: deploy/kubernetes/base/node_windows/node.yaml

+22
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,35 @@ spec:
5353
mountPropagation: "None"
5454
- name: plugin-dir
5555
mountPath: C:\csi
56+
- name: csi-proxy-volume-v1
57+
mountPath: \\.\pipe\csi-proxy-volume-v1
58+
- name: csi-proxy-filesystem-v1
59+
mountPath: \\.\pipe\csi-proxy-filesystem-v1
60+
- name: csi-proxy-disk-v1
61+
mountPath: \\.\pipe\csi-proxy-disk-v1
62+
# these paths are still included for compatibility, they're used
63+
# only if the node has still the beta version of the CSI proxy
5664
- name: csi-proxy-volume-v1beta1
5765
mountPath: \\.\pipe\csi-proxy-volume-v1beta1
5866
- name: csi-proxy-filesystem-v1beta1
5967
mountPath: \\.\pipe\csi-proxy-filesystem-v1beta1
6068
- name: csi-proxy-disk-v1beta2
6169
mountPath: \\.\pipe\csi-proxy-disk-v1beta2
6270
volumes:
71+
- name: csi-proxy-disk-v1
72+
hostPath:
73+
path: \\.\pipe\csi-proxy-disk-v1
74+
type: ""
75+
- name: csi-proxy-volume-v1
76+
hostPath:
77+
path: \\.\pipe\csi-proxy-volume-v1
78+
type: ""
79+
- name: csi-proxy-filesystem-v1
80+
hostPath:
81+
path: \\.\pipe\csi-proxy-filesystem-v1
82+
type: ""
83+
# these paths are still included for compatibility, they're used
84+
# only if the node has still the beta version of the CSI proxy
6385
- name: csi-proxy-disk-v1beta2
6486
hostPath:
6587
path: \\.\pipe\csi-proxy-disk-v1beta2

Diff for: deploy/kubernetes/base/node_windows/psp.yaml

+7-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ 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-v1beta1
21+
- pathPrefix: \\.\pipe\csi-proxy-disk-v1
22+
- pathPrefix: \\.\pipe\csi-proxy-volume-v1
23+
- pathPrefix: \\.\pipe\csi-proxy-filesystem-v1
24+
# these paths are allowed only for compatibility mode if the PD CSI driver
25+
# is using the CSI Proxy v1 client and the node is still using the
26+
# beta version of the CSI proxy
27+
- pathPrefix: \\.\pipe\csi-proxy-disk-v1beta2
2228
- pathPrefix: \\.\pipe\csi-proxy-volume-v1beta1
2329
- pathPrefix: \\.\pipe\csi-proxy-filesystem-v1beta1
2430

Diff for: deploy/kubernetes/overlays/noauth-debug/kustomization.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ transformers:
88
patchesStrategicMerge:
99
- noauth.yaml
1010
- controller-overlay.yaml
11+
- node-overlay.yaml
1112
namespace: gce-pd-csi-driver
1213
# To change the dev image, add something like the following.
1314
# images:
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
kind: DaemonSet
2+
apiVersion: apps/v1
3+
metadata:
4+
name: csi-gce-pd-node
5+
spec:
6+
template:
7+
spec:
8+
containers:
9+
- name: gce-pd-driver
10+
imagePullPolicy: Always
11+
---
12+
kind: DaemonSet
13+
apiVersion: apps/v1
14+
metadata:
15+
name: csi-gce-pd-node-win
16+
spec:
17+
template:
18+
spec:
19+
containers:
20+
- name: gce-pd-driver
21+
imagePullPolicy: Always

Diff for: go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require (
99
github.com/golang/protobuf v1.4.2
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.2.2
12+
github.com/kubernetes-csi/csi-proxy/client v1.0.0-rc.1
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

Diff for: go.sum

+11-10
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ github.com/GoogleCloudPlatform/k8s-cloud-provider v0.0.0-20190822182118-27a4ced3
6464
github.com/GoogleCloudPlatform/testgrid v0.0.1-alpha.3/go.mod h1:f96W2HYy3tiBNV5zbbRc+NczwYHgG1PHXMQfoEWv680=
6565
github.com/JeffAshton/win_pdh v0.0.0-20161109143554-76bb4ee9f0ab/go.mod h1:3VYc5hodBMJ5+l/7J4xAyMeuM2PNuepvHlGs8yilUCA=
6666
github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd/go.mod h1:64YHyfSL2R96J44Nlwm39UHepQbyR5q10x7iYa1ks2E=
67-
github.com/Microsoft/go-winio v0.4.14 h1:+hMXMk01us9KgxGb7ftKQt2Xpf5hH/yky+TDA+qxleU=
6867
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
68+
github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk=
69+
github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0=
6970
github.com/Microsoft/hcsshim v0.0.0-20190417211021-672e52e9209d/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg=
7071
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
7172
github.com/OpenPeeDeeP/depguard v1.0.0/go.mod h1:7/4sitnI9YlQgTLLk734QlzXT8DuHVnAyztLplQjk+o=
@@ -458,17 +459,17 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv
458459
github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s=
459460
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
460461
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
461-
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
462462
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
463+
github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=
463464
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
464465
github.com/kr/pty v1.0.0/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
465466
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
466467
github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
467468
github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
468469
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
469470
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
470-
github.com/kubernetes-csi/csi-proxy/client v0.2.2 h1:VpMddHnbYA1oBeU5nrisdyrpOAAT0HqME7fsTi6BG2w=
471-
github.com/kubernetes-csi/csi-proxy/client v0.2.2/go.mod h1:6ptQQmti5QHwBxSsh8Cy00oGdogj0JXewFnu8FFjgOs=
471+
github.com/kubernetes-csi/csi-proxy/client v1.0.0-rc.1 h1:rWwsNUTbgFfUMYGe/w4N+AJAR8Z/wQ1QMgf5JdTlv8g=
472+
github.com/kubernetes-csi/csi-proxy/client v1.0.0-rc.1/go.mod h1:URLOkEbRhOwKVvGvug6HSKRTpLSFuQ/Gt3xahDag8qc=
472473
github.com/kubernetes-csi/csi-test/v3 v3.0.0 h1:mVsfA4J67uNm8fdF/Pr84oMqL92qjIhjWbEUH8zv1fU=
473474
github.com/kubernetes-csi/csi-test/v3 v3.0.0/go.mod h1:VdIKGnDZHOjg4M5yd0OZICtsoEzdn64d0K33N6dm35Q=
474475
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
@@ -564,8 +565,9 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9
564565
github.com/pelletier/go-toml v1.3.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo=
565566
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
566567
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
567-
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
568568
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
569+
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
570+
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
569571
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
570572
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
571573
github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA=
@@ -653,10 +655,8 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
653655
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
654656
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
655657
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
656-
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
657658
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
658-
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
659-
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
659+
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
660660
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
661661
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
662662
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
@@ -858,6 +858,7 @@ golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7w
858858
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
859859
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
860860
golang.org/x/sys v0.0.0-20190912141932-bc967efca4b8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
861+
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
861862
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
862863
golang.org/x/sys v0.0.0-20191022100944-742c48ecaeb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
863864
golang.org/x/sys v0.0.0-20191113165036-4c7a9d0fe056/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -1063,8 +1064,8 @@ gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4
10631064
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
10641065
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
10651066
gopkg.in/check.v1 v1.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
1066-
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
10671067
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
1068+
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
10681069
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
10691070
gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
10701071
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
@@ -1095,6 +1096,7 @@ gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
10951096
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
10961097
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
10971098
gopkg.in/yaml.v3 v3.0.0-20190709130402-674ba3eaed22/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
1099+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
10981100
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
10991101
gotest.tools v2.1.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
11001102
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
@@ -1161,7 +1163,6 @@ k8s.io/test-infra v0.0.0-20200115230622-70a5174aa78d h1:7zSVb69fwXGyyBrtMttOXdZh
11611163
k8s.io/test-infra v0.0.0-20200115230622-70a5174aa78d/go.mod h1:d8SKryJBXAwfCFVL4wieRez47J2NOOAb9d029sWLseQ=
11621164
k8s.io/utils v0.0.0-20181019225348-5e321f9a457c/go.mod h1:8k8uAuAQ0rXslZKaEWd0c3oVhZz7sSzSiPnVZayjIX0=
11631165
k8s.io/utils v0.0.0-20190506122338-8fab8cb257d5/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew=
1164-
k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89 h1:d4vVOjXm687F1iLSP2q3lyPPuyvTUt3aVoBpi2DqRsU=
11651166
k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew=
11661167
k8s.io/utils v0.0.0-20201110183641-67b214c5f920 h1:CbnUZsM497iRC5QMVkHwyl8s2tB3g7yaSHkYPkpgelw=
11671168
k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=

Diff for: manifest_osversion.sh

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
# replace the following with annotation approach. https://github.com/docker/cli/pull/2578
77

88
export DOCKER_CLI_EXPERIMENTAL=enabled
9-
_WINDOWS_VERSIONS="20H2 2004 1909 ltsc2019"
109
BASE="mcr.microsoft.com/windows/servercore"
1110

1211
IFS=', ' read -r -a imagetags <<< "$WINDOWS_IMAGE_TAGS"

Diff for: pkg/gce-pd-csi-driver/utils_windows.go

+81-31
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package gceGCEDriver
1717

1818
import (
1919
"fmt"
20+
"strconv"
2021
"strings"
2122

2223
"k8s.io/mount-utils"
@@ -28,29 +29,51 @@ func formatAndMount(source, target, fstype string, options []string, m *mount.Sa
2829
if !strings.EqualFold(fstype, defaultWindowsFsType) {
2930
return fmt.Errorf("GCE PD CSI driver can only supports %s file system, it does not support %s", defaultWindowsFsType, fstype)
3031
}
31-
proxy, ok := m.Interface.(*mounter.CSIProxyMounter)
32-
if !ok {
33-
return fmt.Errorf("could not cast to csi proxy class")
32+
switch m.Interface.(type) {
33+
case *mounter.CSIProxyMounterV1:
34+
proxy := m.Interface.(*mounter.CSIProxyMounterV1)
35+
diskNumber, err := strconv.ParseUint(source, 10, 64)
36+
if err != nil {
37+
return err
38+
}
39+
return proxy.FormatAndMount(uint32(diskNumber), target, fstype, options)
40+
41+
case *mounter.CSIProxyMounterV1Beta:
42+
proxy := m.Interface.(*mounter.CSIProxyMounterV1Beta)
43+
return proxy.FormatAndMount(source, target, fstype, options)
3444
}
35-
return proxy.FormatAndMount(source, target, fstype, options)
45+
46+
return fmt.Errorf("Invalid interface type=%v", m.Interface)
3647
}
3748

3849
// Before mounting (which means creating symlink) in Windows, the targetPath should
3950
// not exist. Currently kubelet creates the path beforehand, this is a workaround to
4051
// remove the path first.
4152
func preparePublishPath(path string, m *mount.SafeFormatAndMount) error {
42-
proxy, ok := m.Interface.(*mounter.CSIProxyMounter)
43-
if !ok {
44-
return fmt.Errorf("could not cast to csi proxy class")
45-
}
46-
exists, err := proxy.ExistsPath(path)
47-
if err != nil {
48-
return err
53+
switch m.Interface.(type) {
54+
case *mounter.CSIProxyMounterV1:
55+
proxy := m.Interface.(*mounter.CSIProxyMounterV1)
56+
exists, err := proxy.ExistsPath(path)
57+
if err != nil {
58+
return err
59+
}
60+
if exists {
61+
return proxy.RemovePodDir(path)
62+
}
63+
return nil
64+
case *mounter.CSIProxyMounterV1Beta:
65+
proxy := m.Interface.(*mounter.CSIProxyMounterV1Beta)
66+
exists, err := proxy.ExistsPath(path)
67+
if err != nil {
68+
return err
69+
}
70+
if exists {
71+
return proxy.RemovePodDir(path)
72+
}
73+
return nil
4974
}
50-
if exists {
51-
return proxy.RemovePodDir(path)
52-
}
53-
return nil
75+
76+
return fmt.Errorf("Invalid interface type=%v", m.Interface)
5477
}
5578

5679
// Before staging (which means creating symlink) in Windows, the targetPath should
@@ -60,19 +83,27 @@ func prepareStagePath(path string, m *mount.SafeFormatAndMount) error {
6083
}
6184

6285
func cleanupPublishPath(path string, m *mount.SafeFormatAndMount) error {
63-
proxy, ok := m.Interface.(*mounter.CSIProxyMounter)
64-
if !ok {
65-
return fmt.Errorf("could not cast to csi proxy class")
86+
switch m.Interface.(type) {
87+
case *mounter.CSIProxyMounterV1:
88+
proxy := m.Interface.(*mounter.CSIProxyMounterV1)
89+
return proxy.RemovePodDir(path)
90+
case *mounter.CSIProxyMounterV1Beta:
91+
proxy := m.Interface.(*mounter.CSIProxyMounterV1Beta)
92+
return proxy.RemovePodDir(path)
6693
}
67-
return proxy.RemovePodDir(path)
94+
return fmt.Errorf("Invalid interface type=%v", m.Interface)
6895
}
6996

7097
func cleanupStagePath(path string, m *mount.SafeFormatAndMount) error {
71-
proxy, ok := m.Interface.(*mounter.CSIProxyMounter)
72-
if !ok {
73-
return fmt.Errorf("could not cast to csi proxy class")
98+
switch m.Interface.(type) {
99+
case *mounter.CSIProxyMounterV1:
100+
proxy := m.Interface.(*mounter.CSIProxyMounterV1)
101+
return proxy.UnmountDevice(path)
102+
case *mounter.CSIProxyMounterV1Beta:
103+
proxy := m.Interface.(*mounter.CSIProxyMounterV1Beta)
104+
return proxy.UnmountDevice(path)
74105
}
75-
return proxy.UnmountDevice(path)
106+
return fmt.Errorf("Invalid interface type=%v", m.Interface)
76107
}
77108

78109
// search Windows disk number by volumeID
@@ -85,18 +116,37 @@ func getDevicePath(ns *GCENodeServer, volumeID, partition string) (string, error
85116
if err != nil {
86117
return "", fmt.Errorf("error getting device name: %v", err)
87118
}
88-
proxy, ok := ns.Mounter.Interface.(*mounter.CSIProxyMounter)
89-
if !ok {
90-
return "", fmt.Errorf("could not cast to csi proxy class")
119+
120+
switch ns.Mounter.Interface.(type) {
121+
case *mounter.CSIProxyMounterV1:
122+
proxy := ns.Mounter.Interface.(*mounter.CSIProxyMounterV1)
123+
diskNumber, err := proxy.GetDevicePath(deviceName, partition, volumeKey.Name)
124+
if err != nil {
125+
return "", err
126+
}
127+
return strconv.FormatUint(uint64(diskNumber), 10), nil
128+
case *mounter.CSIProxyMounterV1Beta:
129+
proxy := ns.Mounter.Interface.(*mounter.CSIProxyMounterV1Beta)
130+
return proxy.GetDevicePath(deviceName, partition, volumeKey.Name)
91131
}
92-
return proxy.GetDevicePath(deviceName, partition, volumeKey.Name)
132+
133+
return "", fmt.Errorf("Invalid interface type=%v", ns.Mounter.Interface)
134+
93135
}
94136

95137
func getBlockSizeBytes(devicePath string, m *mount.SafeFormatAndMount) (int64, error) {
96-
proxy, ok := m.Interface.(*mounter.CSIProxyMounter)
97-
if !ok {
98-
return 0, fmt.Errorf("could not cast to csi proxy class")
138+
switch m.Interface.(type) {
139+
case *mounter.CSIProxyMounterV1:
140+
proxy := m.Interface.(*mounter.CSIProxyMounterV1)
141+
diskNumber, err := strconv.ParseUint(devicePath, 10, 64)
142+
if err != nil {
143+
return 0, err
144+
}
145+
return proxy.GetBlockSizeBytes(uint32(diskNumber))
146+
case *mounter.CSIProxyMounterV1Beta:
147+
proxy := m.Interface.(*mounter.CSIProxyMounterV1Beta)
148+
return proxy.GetBlockSizeBytes(devicePath)
99149
}
150+
return 0, fmt.Errorf("Invalid interface type=%v", m.Interface)
100151

101-
return proxy.GetBlockSizeBytes(devicePath)
102152
}

0 commit comments

Comments
 (0)