Skip to content

Commit e6b3ba1

Browse files
feat: migrate to csi proxy v2 alpha
1 parent a524d2c commit e6b3ba1

Some content is hidden

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

73 files changed

+2451
-13398
lines changed

Diff for: Dockerfile.Windows

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ RUN cd /code/ && GOARCH=$(echo $TARGETPLATFORM | cut -f2 -d '/') GCE_PD_CSI_STAG
2424

2525
FROM ${BASE_IMAGE}
2626
LABEL description="PD CSI driver"
27+
ENV PATH="${PATH};c:\\Windows\\System32\\WindowsPowerShell\\v1.0"
28+
2729
COPY --from=builder /code/bin/gce-pd-csi-driver.exe /gce-pd-csi-driver.exe
2830

2931
USER ContainerAdministrator

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

+16-62
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,21 @@ spec:
2222
serviceAccountName: csi-gce-pd-node-sa-win
2323
nodeSelector:
2424
kubernetes.io/os: windows
25+
hostNetwork: true
26+
securityContext:
27+
windowsOptions:
28+
hostProcess: true
29+
runAsUserName: "NT AUTHORITY\\SYSTEM"
2530
containers:
2631
- name: csi-driver-registrar
2732
image: k8s.gcr.io/sig-storage/csi-node-driver-registrar
33+
command:
34+
- csi-node-driver-registrar.exe
2835
args:
2936
- --v=5
30-
- --csi-address=unix://C:\\csi\\csi.sock
31-
- --kubelet-registration-path=C:\\var\\lib\\kubelet\\plugins\\pd.csi.storage.gke.io\\csi.sock
37+
- --csi-address=unix://c:\var\lib\kubelet\plugins\pd.csi.storage.gke.io\csi.sock
38+
- --kubelet-registration-path=/var/lib/kubelet/plugins/pd.csi.storage.gke.io/csi.sock
39+
- --plugin-registration-path=/var/lib/kubelet/plugins_registry
3240
env:
3341
- name: KUBE_NODE_NAME
3442
valueFrom:
@@ -37,74 +45,20 @@ spec:
3745
volumeMounts:
3846
- name: plugin-dir
3947
mountPath: /csi
40-
- name: registration-dir
41-
mountPath: /registration
4248
- name: gce-pd-driver
4349
# Don't change base image without changing pdImagePlaceholder in
4450
# test/k8s-integration/main.go
4551
image: gke.gcr.io/gcp-compute-persistent-disk-csi-driver
52+
command:
53+
- gce-pd-csi-driver.exe
4654
args:
47-
- "--v=5"
48-
- "--endpoint=unix:/csi/csi.sock"
49-
- "--run-controller-service=false"
50-
volumeMounts:
51-
- name: kubelet-dir
52-
mountPath: C:\var\lib\kubelet
53-
mountPropagation: "None"
54-
- name: plugin-dir
55-
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
64-
- name: csi-proxy-volume-v1beta1
65-
mountPath: \\.\pipe\csi-proxy-volume-v1beta1
66-
- name: csi-proxy-filesystem-v1beta1
67-
mountPath: \\.\pipe\csi-proxy-filesystem-v1beta1
68-
- name: csi-proxy-disk-v1beta2
69-
mountPath: \\.\pipe\csi-proxy-disk-v1beta2
55+
- --v=5
56+
- --endpoint=unix:/c:\var\lib\kubelet\plugins\pd.csi.storage.gke.io\csi.sock
57+
- --run-controller-service=false
7058
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
85-
- name: csi-proxy-disk-v1beta2
86-
hostPath:
87-
path: \\.\pipe\csi-proxy-disk-v1beta2
88-
type: ""
89-
- name: csi-proxy-volume-v1beta1
90-
hostPath:
91-
path: \\.\pipe\csi-proxy-volume-v1beta1
92-
type: ""
93-
- name: csi-proxy-filesystem-v1beta1
94-
hostPath:
95-
path: \\.\pipe\csi-proxy-filesystem-v1beta1
96-
type: ""
97-
- name: registration-dir
98-
hostPath:
99-
path: \var\lib\kubelet\plugins_registry
100-
type: Directory
101-
- name: kubelet-dir
102-
hostPath:
103-
path: \var\lib\kubelet
104-
type: Directory
10559
- name: plugin-dir
10660
hostPath:
107-
path: \var\lib\kubelet\plugins\pd.csi.storage.gke.io
61+
path: /var/lib/kubelet/plugins/pd.csi.storage.gke.io
10862
type: DirectoryOrCreate
10963
tolerations:
11064
- operator: Exists

Diff for: docs/local-development.md

-9
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,3 @@ Running Unit Tests:
1919
```
2020
$ ./test/run-unit.sh
2121
```
22-
23-
## Dependency Management
24-
25-
Use [dep](https://github.com/golang/dep)
26-
```
27-
$ dep ensure
28-
```
29-
30-
To modify dependencies or versions change `./Gopkg.toml`

Diff for: go.mod

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/GoogleCloudPlatform/k8s-cloud-provider v1.18.0
99
github.com/container-storage-interface/spec v1.6.0
1010
github.com/google/uuid v1.3.0
11-
github.com/kubernetes-csi/csi-proxy/client v1.1.1
11+
github.com/kubernetes-csi/csi-proxy/v2 v2.0.0-alpha.0
1212
github.com/kubernetes-csi/csi-test/v4 v4.4.0
1313
github.com/onsi/ginkgo v1.16.5
1414
github.com/onsi/gomega v1.20.0
@@ -32,7 +32,6 @@ require (
3232
require (
3333
cloud.google.com/go v0.103.0 // indirect
3434
cloud.google.com/go/iam v0.3.0 // indirect
35-
github.com/Microsoft/go-winio v0.4.17 // indirect
3635
github.com/PuerkitoBio/purell v1.1.1 // indirect
3736
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
3837
github.com/beorn7/perks v1.0.1 // indirect
@@ -64,7 +63,6 @@ require (
6463
github.com/modern-go/reflect2 v1.0.2 // indirect
6564
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
6665
github.com/nxadm/tail v1.4.8 // indirect
67-
github.com/pkg/errors v0.9.1 // indirect
6866
github.com/prometheus/client_golang v1.12.1 // indirect
6967
github.com/prometheus/client_model v0.2.0 // indirect
7068
github.com/prometheus/common v0.32.1 // indirect

Diff for: go.sum

+3-5
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,6 @@ github.com/Masterminds/vcs v1.13.1/go.mod h1:N09YCmOQr6RLxC6UNHzuVwAdodYbbnycGHS
191191
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
192192
github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw=
193193
github.com/Microsoft/go-winio v0.4.15/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw=
194-
github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0=
195-
github.com/Microsoft/go-winio v0.4.17 h1:iT12IBVClFevaf8PuVyi3UmZOVh4OqnaLxDTW2O6j3w=
196194
github.com/Microsoft/go-winio v0.4.17/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84=
197195
github.com/Microsoft/hcsshim v0.8.7/go.mod h1:OHd7sQqRFrYd3RmSgbgji+ctCwkbq2wbEYNSzOYtcBQ=
198196
github.com/Microsoft/hcsshim v0.8.22/go.mod h1:91uVCVzvX2QD16sMCenoxxXo6L1wJnLMX2PSufFMtF0=
@@ -1048,8 +1046,8 @@ github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
10481046
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
10491047
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
10501048
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
1051-
github.com/kubernetes-csi/csi-proxy/client v1.1.1 h1:GagYqArF85E/pQuzldTEQ3WmrcNVU/bYPNG+Ha8tTC4=
1052-
github.com/kubernetes-csi/csi-proxy/client v1.1.1/go.mod h1:SfK4HVKQdMH5KrffivddAWgX5hl3P5KmnuOTBbDNboU=
1049+
github.com/kubernetes-csi/csi-proxy/v2 v2.0.0-alpha.0 h1:9uY7OxvgKhDqqEuSCDW++cZcYlHFVTwhbEdZa5XqJCQ=
1050+
github.com/kubernetes-csi/csi-proxy/v2 v2.0.0-alpha.0/go.mod h1:pacx+PW7lLlu6kAvpr8Lgq/5fdiAsKxOtXXFHMaLMb8=
10531051
github.com/kubernetes-csi/csi-test/v4 v4.4.0 h1:r0mnAwDURI24Vw3a/LyA/ga11yD5ZGuU7+REO35Na9s=
10541052
github.com/kubernetes-csi/csi-test/v4 v4.4.0/go.mod h1:t1RzseMZJKy313nezI/d7TolbbiKpUZM3SXQvXxOX0w=
10551053
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
@@ -1273,7 +1271,6 @@ github.com/pierrec/lz4 v2.2.6+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi
12731271
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
12741272
github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
12751273
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
1276-
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
12771274
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
12781275
github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=
12791276
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
@@ -2457,6 +2454,7 @@ k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
24572454
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
24582455
k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
24592456
k8s.io/klog/v2 v2.8.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec=
2457+
k8s.io/klog/v2 v2.9.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec=
24602458
k8s.io/klog/v2 v2.60.1 h1:VW25q3bZx9uE3vvdL6M8ezOX79vA2Aq1nEWLqNQclHc=
24612459
k8s.io/klog/v2 v2.60.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
24622460
k8s.io/kube-aggregator v0.24.1/go.mod h1:vZvRALCO32hrIuREhkYwLq5Crc0zh6SxzJDAKrQM1+k=

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ package gceGCEDriver
1616

1717
import (
1818
"net"
19-
"net/url"
2019
"os"
2120
"path/filepath"
2221
"sync"
@@ -75,7 +74,7 @@ func (s *nonBlockingGRPCServer) serve(endpoint string, ids csi.IdentityServer, c
7574
grpc.UnaryInterceptor(logGRPC),
7675
}
7776

78-
u, err := url.Parse(endpoint)
77+
u, err := parseEndpoint(endpoint)
7978

8079
if err != nil {
8180
klog.Fatal(err.Error())

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

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

1818
import (
1919
"fmt"
20+
"net/url"
2021
"os"
2122
"strconv"
2223
"strings"
@@ -79,3 +80,7 @@ func getBlockSizeBytes(devicePath string, m *mount.SafeFormatAndMount) (int64, e
7980
}
8081
return gotSizeBytes, nil
8182
}
83+
84+
func parseEndpoint(endpoint string) (*url.URL, error) {
85+
return url.Parse(endpoint)
86+
}

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

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

1818
import (
1919
"fmt"
20+
"net/url"
2021
"strings"
2122

2223
"k8s.io/mount-utils"
@@ -100,3 +101,17 @@ func getBlockSizeBytes(devicePath string, m *mount.SafeFormatAndMount) (int64, e
100101
}
101102
return proxy.GetDiskTotalBytes(devicePath)
102103
}
104+
105+
func parseEndpoint(endpoint string) (*url.URL, error) {
106+
u, err := url.Parse(endpoint)
107+
if err != nil {
108+
return nil, err
109+
}
110+
if u.Scheme == "unix" {
111+
// remove leading slashes
112+
if len(u.Path) > 0 && string(u.Path[0]) == "/" {
113+
u.Path = u.Path[1:]
114+
}
115+
}
116+
return u, err
117+
}

0 commit comments

Comments
 (0)