Skip to content

Commit 226b530

Browse files
committed
Add windows driver installation support
This PR adds windows driver support. It adds a windows base dir to install base yaml files. It also adds a windows alpha kustomization file. To install driver for windows, first set env NODE_OS=windows and GCE_PD_DRIVER_VERSION=alpha and run deploy/kubernetes/deploy-driver.sh script. This PR also reorgnize the dir structure for linux version. Now under overlay, we have a linux and a windows dir. Under each of them, we have alpha, stable, etc. Currently windows only has alpha version.
1 parent 85088c4 commit 226b530

27 files changed

+249
-35
lines changed

deploy/kubernetes/base/controller.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ spec:
1717
# since it replaces GCE Metadata Server with GKE Metadata Server. Remove
1818
# this requirement when issue is resolved and before any exposure of
1919
# metrics ports
20+
nodeSelector:
21+
kubernetes.io/os: linux
2022
hostNetwork: true
2123
serviceAccountName: csi-gce-pd-controller-sa
2224
priorityClassName: csi-gce-pd-controller

deploy/kubernetes/base/kustomization.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@ commonLabels:
33
namespace:
44
gce-pd-csi-driver
55
resources:
6-
- node.yaml
76
- controller.yaml
87
- setup-cluster.yaml

deploy/kubernetes/base/setup-cluster.yaml

+13-9
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,6 @@ spec:
164164
volumes:
165165
- '*'
166166
hostNetwork: true
167-
allowedHostPaths:
168-
- pathPrefix: "/var/lib/kubelet/plugins_registry/"
169-
- pathPrefix: "/var/lib/kubelet"
170-
- pathPrefix: "/var/lib/kubelet/plugins/pd.csi.storage.gke.io/"
171-
- pathPrefix: "/dev"
172-
- pathPrefix: "/etc/udev"
173-
- pathPrefix: "/lib/udev"
174-
- pathPrefix: "/run/udev"
175-
- pathPrefix: "/sys"
176167
---
177168

178169
kind: ClusterRole
@@ -199,6 +190,19 @@ subjects:
199190
- kind: ServiceAccount
200191
name: csi-gce-pd-node-sa
201192

193+
---
194+
apiVersion: rbac.authorization.k8s.io/v1
195+
kind: ClusterRoleBinding
196+
metadata:
197+
name: csi-gce-pd-controller
198+
roleRef:
199+
apiGroup: rbac.authorization.k8s.io
200+
kind: ClusterRole
201+
name: csi-gce-pd-node-deploy
202+
subjects:
203+
- kind: ServiceAccount
204+
name: csi-gce-pd-controller-sa
205+
202206
---
203207
apiVersion: rbac.authorization.k8s.io/v1
204208
kind: ClusterRole

deploy/kubernetes/delete-driver.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ set -o errexit
1313
readonly NAMESPACE="${GCE_PD_DRIVER_NAMESPACE:-gce-pd-csi-driver}"
1414
readonly DEPLOY_VERSION="${GCE_PD_DRIVER_VERSION:-stable}"
1515
readonly PKGDIR="${GOPATH}/src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver"
16+
readonly OS="${OS:-linux}"
1617
source "${PKGDIR}/deploy/common.sh"
1718

1819
ensure_kustomize
1920

20-
${KUSTOMIZE_PATH} build ${PKGDIR}/deploy/kubernetes/overlays/${DEPLOY_VERSION} | ${KUBECTL} delete -v="${VERBOSITY}" --ignore-not-found -f -
21+
${KUSTOMIZE_PATH} build ${PKGDIR}/deploy/kubernetes/overlays/${OS}/${DEPLOY_VERSION} | ${KUBECTL} delete -v="${VERBOSITY}" --ignore-not-found -f -
2122
${KUBECTL} delete secret cloud-sa -v="${VERBOSITY}" --ignore-not-found
2223

2324
if [[ ${NAMESPACE} != "" && ${NAMESPACE} != "default" ]] && \

deploy/kubernetes/deploy-driver.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ set -x
1919
readonly NAMESPACE="${GCE_PD_DRIVER_NAMESPACE:-gce-pd-csi-driver}"
2020
readonly DEPLOY_VERSION="${GCE_PD_DRIVER_VERSION:-stable}"
2121
readonly PKGDIR="${GOPATH}/src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver"
22+
readonly OS="${OS:-linux}"
2223
source "${PKGDIR}/deploy/common.sh"
2324

2425
print_usage()
@@ -95,6 +96,6 @@ fi
9596
${KUBECTL} version
9697

9798
readonly tmp_spec=/tmp/gcp-compute-persistent-disk-csi-driver-specs-generated.yaml
98-
${KUSTOMIZE_PATH} build ${PKGDIR}/deploy/kubernetes/overlays/${DEPLOY_VERSION} | tee $tmp_spec
99+
${KUSTOMIZE_PATH} build ${PKGDIR}/deploy/kubernetes/overlays/${OS}/${DEPLOY_VERSION} | tee $tmp_spec
99100
${KUBECTL} apply -v="${VERBOSITY}" -f $tmp_spec
100101

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: policy/v1beta1
2+
kind: PodSecurityPolicy
3+
metadata:
4+
name: csi-gce-pd-node-psp
5+
spec:
6+
allowedHostPaths:
7+
- pathPrefix: "/var/lib/kubelet/plugins_registry/"
8+
- pathPrefix: "/var/lib/kubelet"
9+
- pathPrefix: "/var/lib/kubelet/plugins/pd.csi.storage.gke.io/"
10+
- pathPrefix: "/dev"
11+
- pathPrefix: "/etc/udev"
12+
- pathPrefix: "/lib/udev"
13+
- pathPrefix: "/run/udev"
14+
- pathPrefix: "/sys"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
kind: DaemonSet
2+
apiVersion: apps/v1
3+
metadata:
4+
name: csi-gce-pd-node
5+
spec:
6+
template:
7+
spec:
8+
hostNetwork: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
bases:
4+
- ../../../base
5+
patchesStrategicMerge:
6+
- enableHostNetwork.yaml
7+
- allowedHostPaths.yaml
8+
- node.yaml
9+
images:
10+
- name: gke.gcr.io/gcp-compute-persistent-disk-csi-driver
11+
# Don't change stable image without changing pdImagePlaceholder in
12+
# test/k8s-integration/main.go
13+
newName: gke.gcr.io/gcp-compute-persistent-disk-csi-driver
14+
newTag: "v0.7.0-gke.0"
15+
- name: gke.gcr.io/csi-provisioner
16+
newName: gke.gcr.io/csi-provisioner
17+
newTag: "v1.5.0-gke.0"
18+
- name: gke.gcr.io/csi-attacher
19+
newName: gke.gcr.io/csi-attacher
20+
newTag: "v2.1.1-gke.0"
21+
- name: gke.gcr.io/csi-node-driver-registrar
22+
newName: gke.gcr.io/csi-node-driver-registrar
23+
newTag: "v1.2.0-gke.0"
24+
- name: gke.gcr.io/csi-resizer
25+
newName: gke.gcr.io/csi-resizer
26+
newTag: "v0.4.0-gke.0"
27+
- name: gke.gcr.io/csi-snapshotter
28+
newName: gke.gcr.io/csi-snapshotter
29+
newTag: "v2.1.1-gke.0"

deploy/kubernetes/base/node.yaml renamed to deploy/kubernetes/overlays/linux/base/node.yaml

+8-11
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@ spec:
1212
labels:
1313
app: gcp-compute-persistent-disk-csi-driver
1414
spec:
15+
nodeSelector:
16+
kubernetes.io/os: linux
1517
# Host network must be used for interaction with Workload Identity in GKE
1618
# since it replaces GCE Metadata Server with GKE Metadata Server. Remove
1719
# this requirement when issue is resolved and before any exposure of
18-
# metrics ports.
19-
hostNetwork: true
20+
# metrics ports. But hostNetwork is not working for Windows, might be an issue
21+
# when deploying on GKE Windows node.
22+
# hostNetwork: true
2023
priorityClassName: csi-gce-pd-node
2124
serviceAccountName: csi-gce-pd-node-sa
2225
containers:
@@ -26,10 +29,6 @@ spec:
2629
- "--v=5"
2730
- "--csi-address=/csi/csi.sock"
2831
- "--kubelet-registration-path=/var/lib/kubelet/plugins/pd.csi.storage.gke.io/csi.sock"
29-
lifecycle:
30-
preStop:
31-
exec:
32-
command: ["/bin/sh", "-c", "rm -rf /registration/pd.csi.storage.gke.io /registration/pd.csi.storage.gke.io-reg.sock"]
3332
env:
3433
- name: KUBE_NODE_NAME
3534
valueFrom:
@@ -41,14 +40,14 @@ spec:
4140
- name: registration-dir
4241
mountPath: /registration
4342
- name: gce-pd-driver
44-
securityContext:
45-
privileged: true
4643
# Don't change base image without changing pdImagePlaceholder in
4744
# test/k8s-integration/main.go
4845
image: gke.gcr.io/gcp-compute-persistent-disk-csi-driver
4946
args:
5047
- "--v=5"
5148
- "--endpoint=unix:/csi/csi.sock"
49+
securityContext:
50+
privileged: true
5251
volumeMounts:
5352
- name: kubelet-dir
5453
mountPath: /var/lib/kubelet
@@ -67,8 +66,6 @@ spec:
6766
mountPath: /run/udev
6867
- name: sys
6968
mountPath: /sys
70-
nodeSelector:
71-
kubernetes.io/os: linux
7269
volumes:
7370
- name: registration-dir
7471
hostPath:
@@ -108,4 +105,4 @@ spec:
108105
# See "special case". This will tolerate everything. Node component should
109106
# be scheduled on all nodes.
110107
tolerations:
111-
- operator: Exists
108+
- operator: Exists
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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: csi-driver-registrar
10+
args:
11+
- "--v=5"
12+
- "--csi-address=/csi/csi.sock"
13+
- "--kubelet-registration-path=/var/lib/kubelet/plugins/pd.csi.storage.gke.io/csi.sock"

deploy/kubernetes/overlays/dev/WARNING.md renamed to deploy/kubernetes/overlays/linux/dev/WARNING.md

+1-8
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,4 @@ BROKEN AT ANY TIME
55
This is the absolute cutting edge development Driver, it is intended for testing
66
and development only and can have vast differences in
77
functionality/behavior/configuration. Use only to try the newest features that
8-
are not guaranteed to work yet.
9-
10-
APPROXIMATE CHANGELOG in latest:
11-
* Topology
12-
* RePD
13-
* Volume ID Format Changed
14-
* Node ID Format Changed
15-
* Parameter "zone" Removed
8+
are not guaranteed to work yet.

deploy/kubernetes/overlays/prow-gke-release-staging-head/kustomization.yaml renamed to deploy/kubernetes/overlays/linux/prow-gke-release-staging-head/kustomization.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
33
bases:
4-
- ../../base
4+
- ../base
55
images:
66
- name: gke.gcr.io/gcp-compute-persistent-disk-csi-driver
77
newName: gcr.io/gke-release-staging/gcp-compute-persistent-disk-csi-driver

deploy/kubernetes/overlays/prow-gke-release-staging-rc/kustomization.yaml renamed to deploy/kubernetes/overlays/linux/prow-gke-release-staging-rc/kustomization.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
33
bases:
4-
- ../../base
4+
- ../base
55
images:
66
- name: gke.gcr.io/gcp-compute-persistent-disk-csi-driver
77
newName: gcr.io/gke-release-staging/gcp-compute-persistent-disk-csi-driver

deploy/kubernetes/overlays/stable/kustomization.yaml renamed to deploy/kubernetes/overlays/linux/stable/kustomization.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
33
bases:
4-
- ../../base
4+
- ../base
55
images:
66
- name: gke.gcr.io/gcp-compute-persistent-disk-csi-driver
77
# Don't change stable image without changing pdImagePlaceholder in
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: policy/v1beta1
2+
kind: PodSecurityPolicy
3+
metadata:
4+
name: csi-gce-pd-node-psp
5+
spec:
6+
allowedHostPaths:
7+
- pathPrefix: \var\lib\kubelet
8+
- pathPrefix: \var\lib\kubelet\plugins_registry
9+
- pathPrefix: \var\lib\kubelet\plugins\pd.csi.storage.gke.io
10+
- pathPrefix: \\.\pipe\csi-proxy-disk-v1alpha1
11+
- pathPrefix: \\.\pipe\csi-proxy-volume-v1alpha1
12+
- pathPrefix: \\.\pipe\csi-proxy-filesystem-v1alpha1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
bases:
4+
- ../../../base
5+
patchesStrategicMerge:
6+
- node.yaml
7+
- allowedHostPaths.yaml
8+
images:
9+
- name: gke.gcr.io/gcp-compute-persistent-disk-csi-driver
10+
# Don't change stable image without changing pdImagePlaceholder in
11+
# test/k8s-integration/main.go
12+
newName: gke.gcr.io/gcp-compute-persistent-disk-csi-driver
13+
newTag: "v0.7.0-gke.0"
14+
- name: gke.gcr.io/gcp-compute-persistent-disk-csi-driver-win
15+
# Temporarly set to the private repo. Will swtich to public one
16+
# once it is available.
17+
newName: gcr.io/jing-k8s-dev/gce-pd-windows-2019
18+
newTag: "0.2.0"
19+
- name: gke.gcr.io/csi-provisioner
20+
newName: gke.gcr.io/csi-provisioner
21+
newTag: "v1.5.0-gke.0"
22+
- name: gke.gcr.io/csi-attacher
23+
newName: gke.gcr.io/csi-attacher
24+
newTag: "v2.1.1-gke.0"
25+
- name: gke.gcr.io/csi-node-driver-registrar
26+
newName: gcr.io/k8s-staging-csi/csi-node-driver-registrar
27+
newTag: "amd64-windows-v20200428-v1.3.0-26-g510710d5"
28+
- name: gke.gcr.io/csi-resizer
29+
newName: gke.gcr.io/csi-resizer
30+
newTag: "v0.4.0-gke.0"
31+
- name: gke.gcr.io/csi-snapshotter
32+
newName: gke.gcr.io/csi-snapshotter
33+
newTag: "v2.1.1-gke.0"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
kind: DaemonSet
2+
apiVersion: apps/v1
3+
metadata:
4+
name: csi-gce-pd-node
5+
spec:
6+
selector:
7+
matchLabels:
8+
app: gcp-compute-persistent-disk-csi-driver
9+
template:
10+
metadata:
11+
labels:
12+
app: gcp-compute-persistent-disk-csi-driver
13+
spec:
14+
priorityClassName: csi-gce-pd-node
15+
serviceAccountName: csi-gce-pd-node-sa
16+
nodeSelector:
17+
kubernetes.io/os: windows
18+
containers:
19+
- name: csi-driver-registrar
20+
image: gke.gcr.io/csi-node-driver-registrar
21+
args:
22+
- --v=5
23+
- --csi-address=unix://C:\\csi\\csi.sock
24+
- --kubelet-registration-path=C:\\var\\lib\\kubelet\\plugins\\pd.csi.storage.gke.io\\csi.sock
25+
env:
26+
- name: KUBE_NODE_NAME
27+
valueFrom:
28+
fieldRef:
29+
fieldPath: spec.nodeName
30+
volumeMounts:
31+
- name: plugin-dir
32+
mountPath: /csi
33+
- name: registration-dir
34+
mountPath: /registration
35+
- name: gce-pd-driver
36+
# Don't change base image without changing pdImagePlaceholder in
37+
# test/k8s-integration/main.go
38+
image: gke.gcr.io/gcp-compute-persistent-disk-csi-driver-win
39+
args:
40+
- "--v=5"
41+
- "--endpoint=unix:/csi/csi.sock"
42+
volumeMounts:
43+
- name: kubelet-dir
44+
mountPath: C:\var\lib\kubelet
45+
mountPropagation: "None"
46+
- name: plugin-dir
47+
mountPath: C:\csi
48+
- name: csi-proxy-disk-pipe
49+
mountPath: \\.\pipe\csi-proxy-disk-v1alpha1
50+
- name: csi-proxy-volume-pipe
51+
mountPath: \\.\pipe\csi-proxy-volume-v1alpha1
52+
- name: csi-proxy-filesystem-pipe
53+
mountPath: \\.\pipe\csi-proxy-filesystem-v1alpha1
54+
volumes:
55+
- name: csi-proxy-disk-pipe
56+
hostPath:
57+
path: \\.\pipe\csi-proxy-disk-v1alpha1
58+
type: ""
59+
- name: csi-proxy-volume-pipe
60+
hostPath:
61+
path: \\.\pipe\csi-proxy-volume-v1alpha1
62+
type: ""
63+
- name: csi-proxy-filesystem-pipe
64+
hostPath:
65+
path: \\.\pipe\csi-proxy-filesystem-v1alpha1
66+
type: ""
67+
- name: registration-dir
68+
hostPath:
69+
path: \var\lib\kubelet\plugins_registry
70+
- name: kubelet-dir
71+
hostPath:
72+
path: \var\lib\kubelet
73+
- name: plugin-dir
74+
hostPath:
75+
path: \var\lib\kubelet\plugins\pd.csi.storage.gke.io
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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: csi-driver-registrar
10+
args:
11+
- --v=5
12+
- --csi-address=unix://C:\\csi\\csi.sock
13+
- --kubelet-registration-path=C:\\var\\lib\\kubelet\\plugins\\pd.csi.storage.gke.io\\csi.sock
14+
lifecycle:
15+
preStop:
16+
exec:
17+
command: ["cmd", "/c", "del C:\\registration\\pd.csi.storage.gke.io-reg.sock"]

0 commit comments

Comments
 (0)