Skip to content

Commit 0457f83

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 0457f83

29 files changed

+3182
-58
lines changed

deploy/kubernetes/base/node.yaml

+3-55
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 Windodws, might be an issue
19+
# when deploying on GKE windows node. See related issue https://buganizer.corp.google.com/issues/156382455
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,11 @@ spec:
4134
- name: registration-dir
4235
mountPath: /registration
4336
- name: gce-pd-driver
44-
securityContext:
45-
privileged: true
46-
# Don't change base image without changing pdImagePlaceholder in
47-
# test/k8s-integration/main.go
4837
image: gke.gcr.io/gcp-compute-persistent-disk-csi-driver
4938
args:
5039
- "--v=5"
5140
- "--endpoint=unix:/csi/csi.sock"
5241
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
7242
volumes:
7343
- name: registration-dir
7444
hostPath:
@@ -82,28 +52,6 @@ spec:
8252
hostPath:
8353
path: /var/lib/kubelet/plugins/pd.csi.storage.gke.io/
8454
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
10755
# https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
10856
# See "special case". This will tolerate everything. Node component should
10957
# 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

+3-2
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()
@@ -51,7 +52,7 @@ function check_service_account()
5152
# Grepping for a line with client email returning anything quoted after the colon
5253
readonly IAM_NAME=$(grep -Po '"client_email": *\K"[^"]*"' ${GCE_PD_SA_DIR}/cloud-sa.json | tr -d '"')
5354
readonly PROJECT=$(grep -Po '"project_id": *\K"[^"]*"' ${GCE_PD_SA_DIR}/cloud-sa.json | tr -d '"')
54-
readonly GOTTEN_BIND_ROLES=$(gcloud projects get-iam-policy ${PROJECT} --flatten="bindings[].members" --format='table(bindings.role)' --filter="bindings.members:${IAM_NAME}")
55+
readonly GOTTEN_BIND_ROLES=$(gcloud projects get-iam-policy $PROJECT --flatten="bindings[].members" --format='table(bindings.role)' --filter="bindings.members:${IAM_NAME}")
5556
readonly BIND_ROLES=$(get_needed_roles)
5657
MISSING_ROLES=false
5758
for role in ${BIND_ROLES}
@@ -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,3 @@
1+
WARNING: DO NOT USE THE ALPHA VERSION OF THE DRIVER FOR PRODUCTION
2+
3+
Alpha features are unsupported and may be unstable and have breaking changes across releases.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
bases:
4+
- ../stable
5+

0 commit comments

Comments
 (0)