Skip to content

Commit 998782b

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 ac1f8c0 commit 998782b

23 files changed

+225
-67
lines changed

deploy/kubernetes/base/node.yaml

+3-53
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,14 @@ spec:
1515
# Host network must be used for interaction with Workload Identity in GKE
1616
# since it replaces GCE Metadata Server with GKE Metadata Server. Remove
1717
# this requirement when issue is resolved and before any exposure of
18-
# metrics ports.
19-
hostNetwork: true
18+
# metrics ports. But hostNetwork is not working for Windows, might be an issue
19+
# when deploying on GKE Windows node.
20+
# hostNetwork: true
2021
priorityClassName: csi-gce-pd-node
2122
serviceAccountName: csi-gce-pd-node-sa
2223
containers:
2324
- name: csi-driver-registrar
2425
image: gke.gcr.io/csi-node-driver-registrar
25-
args:
26-
- "--v=5"
27-
- "--csi-address=/csi/csi.sock"
28-
- "--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"]
3326
env:
3427
- name: KUBE_NODE_NAME
3528
valueFrom:
@@ -41,34 +34,13 @@ spec:
4134
- name: registration-dir
4235
mountPath: /registration
4336
- name: gce-pd-driver
44-
securityContext:
45-
privileged: true
4637
# Don't change base image without changing pdImagePlaceholder in
4738
# test/k8s-integration/main.go
4839
image: gke.gcr.io/gcp-compute-persistent-disk-csi-driver
4940
args:
5041
- "--v=5"
5142
- "--endpoint=unix:/csi/csi.sock"
5243
volumeMounts:
53-
- name: kubelet-dir
54-
mountPath: /var/lib/kubelet
55-
mountPropagation: "Bidirectional"
56-
- name: plugin-dir
57-
mountPath: /csi
58-
- name: device-dir
59-
mountPath: /dev
60-
# The following mounts are required to trigger host udevadm from
61-
# container
62-
- name: udev-rules-etc
63-
mountPath: /etc/udev
64-
- name: udev-rules-lib
65-
mountPath: /lib/udev
66-
- name: udev-socket
67-
mountPath: /run/udev
68-
- name: sys
69-
mountPath: /sys
70-
nodeSelector:
71-
kubernetes.io/os: linux
7244
volumes:
7345
- name: registration-dir
7446
hostPath:
@@ -82,28 +54,6 @@ spec:
8254
hostPath:
8355
path: /var/lib/kubelet/plugins/pd.csi.storage.gke.io/
8456
type: DirectoryOrCreate
85-
- name: device-dir
86-
hostPath:
87-
path: /dev
88-
type: Directory
89-
# The following mounts are required to trigger host udevadm from
90-
# container
91-
- name: udev-rules-etc
92-
hostPath:
93-
path: /etc/udev
94-
type: Directory
95-
- name: udev-rules-lib
96-
hostPath:
97-
path: /lib/udev
98-
type: Directory
99-
- name: udev-socket
100-
hostPath:
101-
path: /run/udev
102-
type: Directory
103-
- name: sys
104-
hostPath:
105-
path: /sys
106-
type: Directory
10757
# https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
10858
# See "special case". This will tolerate everything. Node component should
10959
# be scheduled on all nodes.

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,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,67 @@
1+
kind: DaemonSet
2+
apiVersion: apps/v1
3+
metadata:
4+
name: csi-gce-pd-node
5+
spec:
6+
template:
7+
spec:
8+
nodeSelector:
9+
kubernetes.io/os: linux
10+
containers:
11+
- name: gce-pd-driver
12+
image: gke.gcr.io/gcp-compute-persistent-disk-csi-driver
13+
securityContext:
14+
privileged: true
15+
volumeMounts:
16+
- name: kubelet-dir
17+
mountPath: /var/lib/kubelet
18+
mountPropagation: "Bidirectional"
19+
- name: plugin-dir
20+
mountPath: /csi
21+
- name: device-dir
22+
mountPath: /dev
23+
# The following mounts are required to trigger host udevadm from
24+
# container
25+
- name: udev-rules-etc
26+
mountPath: /etc/udev
27+
- name: udev-rules-lib
28+
mountPath: /lib/udev
29+
- name: udev-socket
30+
mountPath: /run/udev
31+
- name: sys
32+
mountPath: /sys
33+
volumes:
34+
- name: registration-dir
35+
hostPath:
36+
path: /var/lib/kubelet/plugins_registry/
37+
type: Directory
38+
- name: kubelet-dir
39+
hostPath:
40+
path: /var/lib/kubelet
41+
type: Directory
42+
- name: plugin-dir
43+
hostPath:
44+
path: /var/lib/kubelet/plugins/pd.csi.storage.gke.io/
45+
type: DirectoryOrCreate
46+
- name: device-dir
47+
hostPath:
48+
path: /dev
49+
type: Directory
50+
# The following mounts are required to trigger host udevadm from
51+
# container
52+
- name: udev-rules-etc
53+
hostPath:
54+
path: /etc/udev
55+
type: Directory
56+
- name: udev-rules-lib
57+
hostPath:
58+
path: /lib/udev
59+
type: Directory
60+
- name: udev-socket
61+
hostPath:
62+
path: /run/udev
63+
type: Directory
64+
- name: sys
65+
hostPath:
66+
path: /sys
67+
type: Directory
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+
- gcepd.yaml
8+
- noderegistrar.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"
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,46 @@
1+
kind: DaemonSet
2+
apiVersion: apps/v1
3+
metadata:
4+
name: csi-gce-pd-node
5+
spec:
6+
template:
7+
spec:
8+
nodeSelector:
9+
kubernetes.io/os: windows
10+
containers:
11+
- name: gce-pd-driver
12+
image: gke.gcr.io/gcp-compute-persistent-disk-csi-driver-win
13+
volumeMounts:
14+
- name: kubelet-dir
15+
mountPath: C:\var\lib\kubelet
16+
mountPropagation: "None"
17+
- name: plugin-dir
18+
mountPath: C:\csi
19+
- name: csi-proxy-disk-pipe
20+
mountPath: \\.\pipe\csi-proxy-disk-v1alpha1
21+
- name: csi-proxy-volume-pipe
22+
mountPath: \\.\pipe\csi-proxy-volume-v1alpha1
23+
- name: csi-proxy-filesystem-pipe
24+
mountPath: \\.\pipe\csi-proxy-filesystem-v1alpha1
25+
volumes:
26+
- name: csi-proxy-disk-pipe
27+
hostPath:
28+
path: \\.\pipe\csi-proxy-disk-v1alpha1
29+
type: ""
30+
- name: csi-proxy-volume-pipe
31+
hostPath:
32+
path: \\.\pipe\csi-proxy-volume-v1alpha1
33+
type: ""
34+
- name: csi-proxy-filesystem-pipe
35+
hostPath:
36+
path: \\.\pipe\csi-proxy-filesystem-v1alpha1
37+
type: ""
38+
- name: registration-dir
39+
hostPath:
40+
path: C:\var\lib\kubelet\plugins_registry\
41+
- name: kubelet-dir
42+
hostPath:
43+
path: C:\var\lib\kubelet\
44+
- name: plugin-dir
45+
hostPath:
46+
path: C:\var\lib\kubelet\plugins\pd.csi.storage.gke.io\
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+
- gcepd.yaml
7+
- noderegistrar.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,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"]

test/k8s-integration/driver.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
)
1010

1111
func getOverlayDir(pkgDir, deployOverlayName string) string {
12-
return filepath.Join(pkgDir, "deploy", "kubernetes", "overlays", deployOverlayName)
12+
return filepath.Join(pkgDir, "deploy", "kubernetes", "overlays", "linux", deployOverlayName)
1313
}
1414

1515
func installDriver(goPath, pkgDir, stagingImage, stagingVersion, deployOverlayName string, doDriverBuild bool) error {

0 commit comments

Comments
 (0)