Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 37 additions & 31 deletions charts/aws-ebs-csi-driver/templates/node-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ kind: DaemonSet
apiVersion: apps/v1
metadata:
name: ebs-csi-node-windows
namespace: kube-system
labels:
{{- include "aws-ebs-csi-driver.labels" . | nindent 4 }}
spec:
Expand All @@ -15,8 +14,12 @@ spec:
labels:
app: ebs-csi-node
{{- include "aws-ebs-csi-driver.labels" . | nindent 8 }}
{{- if .Values.node.podAnnotations }}
annotations: {{ toYaml .Values.node.podAnnotations | nindent 8 }}
{{- if .Values.node.podLabels }}
{{- toYaml .Values.node.podLabels | nindent 8 }}
{{- end }}
{{- with .Values.node.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
affinity:
Expand All @@ -31,10 +34,10 @@ spec:
nodeSelector:
kubernetes.io/os: windows
{{- with .Values.node.nodeSelector }}
{{ toYaml . | indent 8 }}
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ .Values.node.serviceAccount.name }}
priorityClassName: {{ .Values.node.priorityClassName | default "system-cluster-critical" }}
priorityClassName: {{ .Values.node.priorityClassName | default "system-node-critical" }}
tolerations:
{{- if .Values.node.tolerateAllTaints }}
- operator: Exists
Expand All @@ -46,7 +49,7 @@ spec:
tolerationSeconds: 300
{{- end }}
{{- with .Values.node.tolerations }}
{{ toYaml . | indent 8 }}
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: ebs-plugin
Expand All @@ -62,26 +65,28 @@ spec:
env:
- name: CSI_ENDPOINT
value: unix:/csi/csi.sock
{{- if .Values.proxy.http_proxy }}
- name: HTTP_PROXY
value: {{ .Values.proxy.http_proxy | quote }}
- name: HTTPS_PROXY
value: {{ .Values.proxy.http_proxy | quote }}
- name: NO_PROXY
value: {{ .Values.proxy.no_proxy | quote }}
{{- end }}
- name: CSI_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
{{- if .Values.proxy.http_proxy }}
{{- include "aws-ebs-csi-driver.http-proxy" . | nindent 12 }}
{{- end }}
{{- with .Values.node.env }}
{{- . | toYaml | nindent 12 }}
{{- end }}
volumeMounts:
- name: kubelet-dir
mountPath: C:\var\lib\kubelet
mountPropagation: "None"
- name: plugin-dir
mountPath: C:\csi
- name: csi-proxy-disk-pipe
mountPath: \\.\pipe\csi-proxy-disk-v1beta2
mountPath: \\.\pipe\csi-proxy-disk-v1
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does the mount path have a version in it?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is the way csi-proxy works, it drops a socket at a path for each api it serves

- name: csi-proxy-volume-pipe
mountPath: \\.\pipe\csi-proxy-volume-v1beta2
mountPath: \\.\pipe\csi-proxy-volume-v1
- name: csi-proxy-filesystem-pipe
mountPath: \\.\pipe\csi-proxy-filesystem-v1beta1
mountPath: \\.\pipe\csi-proxy-filesystem-v1
ports:
- name: healthz
containerPort: 9808
Expand All @@ -95,7 +100,8 @@ spec:
periodSeconds: 10
failureThreshold: 5
{{- with .Values.node.resources }}
resources: {{ toYaml . | nindent 12 }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
- name: node-driver-registrar
image: {{ printf "%s:%s" .Values.sidecars.nodeDriverRegistrar.image.repository .Values.sidecars.nodeDriverRegistrar.image.tag }}
Expand All @@ -108,21 +114,20 @@ spec:
value: unix:/csi/csi.sock
- name: DRIVER_REG_SOCK_PATH
value: C:\var\lib\kubelet\plugins\ebs.csi.aws.com\csi.sock
{{- if .Values.proxy.http_proxy }}
- name: HTTP_PROXY
value: {{ .Values.proxy.http_proxy | quote }}
- name: HTTPS_PROXY
value: {{ .Values.proxy.http_proxy | quote }}
- name: NO_PROXY
value: {{ .Values.proxy.no_proxy | quote }}
{{- end }}
{{- if .Values.proxy.http_proxy }}
{{- include "aws-ebs-csi-driver.http-proxy" . | nindent 12 }}
{{- end }}
{{- with .Values.sidecars.nodeDriverRegistrar.env }}
{{- . | toYaml | nindent 12 }}
{{- end }}
volumeMounts:
- name: plugin-dir
mountPath: C:\csi
- name: registration-dir
mountPath: C:\registration
{{- with default .Values.node.resources .Values.sidecars.nodeDriverRegistrar.resources }}
resources: {{ toYaml . | nindent 12 }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
- name: liveness-probe
image: {{ printf "%s:%s" .Values.sidecars.livenessProbe.image.repository .Values.sidecars.livenessProbe.image.tag }}
Expand All @@ -132,7 +137,8 @@ spec:
- name: plugin-dir
mountPath: C:\csi
{{- with default .Values.node.resources .Values.sidecars.livenessProbe.resources }}
resources: {{ toYaml . | nindent 12 }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
Expand All @@ -155,13 +161,13 @@ spec:
type: Directory
- name: csi-proxy-disk-pipe
hostPath:
path: \\.\pipe\csi-proxy-disk-v1beta2
path: \\.\pipe\csi-proxy-disk-v1
type: ""
- name: csi-proxy-volume-pipe
hostPath:
path: \\.\pipe\csi-proxy-volume-v1beta2
path: \\.\pipe\csi-proxy-volume-v1
type: ""
- name: csi-proxy-filesystem-pipe
hostPath:
path: \\.\pipe\csi-proxy-filesystem-v1beta1
path: \\.\pipe\csi-proxy-filesystem-v1
type: ""
6 changes: 3 additions & 3 deletions examples/kubernetes/windows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ This example shows how to create a EBS volume and consume it from a Windows cont
## Prerequisites

1. A 1.18+ Windows node. Windows support has only been tested on 1.18 EKS Windows nodes. https://docs.aws.amazon.com/eks/latest/userguide/windows-support.html
2. [csi-proxy](https://github.com/kubernetes-csi/csi-proxy) built from commit c201c0afb8f12ceac6d5d778270c2702ca563889 or newer installed on the Windows node.
3. The driver vX.Y.Z+ (TODO: no such version exists yet) Node plugin (DaemonSet) installed on the Windows node.
4. The driver vX.Y.Z+ (TODO: no such version exists yet) Controller plugin (Deployment) installed on a Linux node. The Controller hasn't been tested on Windows.
2. [csi-proxy](https://github.com/kubernetes-csi/csi-proxy) v1.0.0+ installed on the Windows node.
3. The driver v1.2.0+ Node plugin (DaemonSet) installed on the Windows node.
4. The driver v1.2.0+ Controller plugin (Deployment) installed on a Linux node (as it cannot run on a Windows node).

## Usage

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/golang/mock v1.5.0
github.com/golang/protobuf v1.4.3
github.com/imdario/mergo v0.3.7 // indirect
github.com/kubernetes-csi/csi-proxy/client v0.2.2
github.com/kubernetes-csi/csi-proxy/client v1.0.0-rc.1
github.com/kubernetes-csi/csi-test v2.0.0+incompatible
github.com/kubernetes-csi/external-snapshotter/client/v4 v4.0.0
github.com/onsi/ginkgo v1.11.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym
github.com/GoogleCloudPlatform/k8s-cloud-provider v0.0.0-20200415212048-7901bc822317/go.mod h1:DF8FZRxMHMGv/vP2lQP6h+dYzzjpuRn24VeRiYn3qjQ=
github.com/JeffAshton/win_pdh v0.0.0-20161109143554-76bb4ee9f0ab/go.mod h1:3VYc5hodBMJ5+l/7J4xAyMeuM2PNuepvHlGs8yilUCA=
github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd/go.mod h1:64YHyfSL2R96J44Nlwm39UHepQbyR5q10x7iYa1ks2E=
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw=
github.com/Microsoft/go-winio v0.4.15 h1:qkLXKzb1QoVatRyd/YlXZ/Kg0m5K3SPuoD82jjSOaBc=
github.com/Microsoft/go-winio v0.4.15/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw=
github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk=
github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0=
github.com/Microsoft/hcsshim v0.8.10-0.20200715222032-5eafd1556990/go.mod h1:ay/0dTb7NsG8QMDfsRfLHgZo/6xAJShLe1+ePPflihk=
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c=
Expand Down Expand Up @@ -377,8 +377,8 @@ github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kubernetes-csi/csi-proxy/client v0.2.2 h1:VpMddHnbYA1oBeU5nrisdyrpOAAT0HqME7fsTi6BG2w=
github.com/kubernetes-csi/csi-proxy/client v0.2.2/go.mod h1:6ptQQmti5QHwBxSsh8Cy00oGdogj0JXewFnu8FFjgOs=
github.com/kubernetes-csi/csi-proxy/client v1.0.0-rc.1 h1:rWwsNUTbgFfUMYGe/w4N+AJAR8Z/wQ1QMgf5JdTlv8g=
github.com/kubernetes-csi/csi-proxy/client v1.0.0-rc.1/go.mod h1:URLOkEbRhOwKVvGvug6HSKRTpLSFuQ/Gt3xahDag8qc=
github.com/kubernetes-csi/csi-test v2.0.0+incompatible h1:ia04uVFUM/J9n/v3LEMn3rEG6FmKV5BH9QLw7H68h44=
github.com/kubernetes-csi/csi-test v2.0.0+incompatible/go.mod h1:YxJ4UiuPWIhMBkxUKY5c267DyA0uDZ/MtAimhx/2TA0=
github.com/kubernetes-csi/external-snapshotter/client/v4 v4.0.0 h1:ipLtV9ubLEYx42YvwDa12eVPQvjuGZoPdbCozGzVNRc=
Expand Down
15 changes: 14 additions & 1 deletion hack/e2e/eksctl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function eksctl_create_cluster() {
KUBECONFIG=${8}
EKSCTL_PATCH_FILE=${9}
EKSCTL_ADMIN_ROLE=${10}
WINDOWS=${11}

generate_ssh_key "${SSH_KEY_PATH}"

Expand Down Expand Up @@ -58,13 +59,25 @@ function eksctl_create_cluster() {
loudecho "Getting cluster ${CLUSTER_NAME}"
${BIN} get cluster "${CLUSTER_NAME}"

if [ -n "$EKSCTL_ADMIN_ROLE" ]; then
if [[ -n "$EKSCTL_ADMIN_ROLE" ]]; then
AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
ADMIN_ARN="arn:aws:iam::${AWS_ACCOUNT_ID}:role/${EKSCTL_ADMIN_ROLE}"
loudecho "Granting ${ADMIN_ARN} admin access to the cluster"
${BIN} create iamidentitymapping --cluster "${CLUSTER_NAME}" --arn "${ADMIN_ARN}" --group system:masters --username admin
fi

if [[ "$WINDOWS" == true ]]; then
${BIN} create nodegroup \
--cluster="${CLUSTER_NAME}" \
--node-ami-family=WindowsServer2019FullContainer \
-n ng-windows \
-m 1 \
-M 1 \
--ssh-access \
--ssh-public-key "${SSH_KEY_PATH}".pub
${BIN} utils install-vpc-controllers --cluster="${CLUSTER_NAME}" --approve
fi

return $?
}

Expand Down
6 changes: 5 additions & 1 deletion hack/e2e/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ KOPS_PATCH_NODE_FILE=${KOPS_PATCH_NODE_FILE:-./hack/kops-patch-node.yaml}
EKSCTL_VERSION=${EKSCTL_VERSION:-0.56.0-rc.1}
EKSCTL_PATCH_FILE=${EKSCTL_PATCH_FILE:-./hack/eksctl-patch.yaml}
EKSCTL_ADMIN_ROLE=${EKSCTL_ADMIN_ROLE:-}
# Creates a windows node group. The windows ami doesn't (yet) install csi-proxy
# so that has to be done separately.
WINDOWS=${WINDOWS:-"false"}

HELM_VALUES_FILE=${HELM_VALUES_FILE:-./hack/values.yaml}
HELM_EXTRA_FLAGS=${HELM_EXTRA_FLAGS:-}
Expand Down Expand Up @@ -139,7 +142,8 @@ elif [[ "${CLUSTER_TYPE}" == "eksctl" ]]; then
"$CLUSTER_FILE" \
"$KUBECONFIG" \
"$EKSCTL_PATCH_FILE" \
"$EKSCTL_ADMIN_ROLE"
"$EKSCTL_ADMIN_ROLE" \
"$WINDOWS"
if [[ $? -ne 0 ]]; then
exit 1
fi
Expand Down
9 changes: 5 additions & 4 deletions pkg/driver/node_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ import (
"context"
"errors"
"fmt"
"strconv"
"strings"

diskapi "github.com/kubernetes-csi/csi-proxy/client/api/disk/v1beta2"
diskclient "github.com/kubernetes-csi/csi-proxy/client/groups/disk/v1beta2"
diskapi "github.com/kubernetes-csi/csi-proxy/client/api/disk/v1"
diskclient "github.com/kubernetes-csi/csi-proxy/client/groups/disk/v1"
"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/mounter"
"k8s.io/klog"
)
Expand All @@ -49,10 +50,10 @@ func (d *nodeService) findDevicePath(devicePath, volumeID, _ string) (string, er

foundDiskNumber := ""
for diskNumber, diskID := range diskIDs {
serialNumber := diskID.Identifiers["serialNumber"]
serialNumber := diskID.GetSerialNumber()
cleanVolumeID := strings.ReplaceAll(volumeID, "-", "")
if strings.Contains(serialNumber, cleanVolumeID) {
foundDiskNumber = diskNumber
foundDiskNumber = strconv.Itoa(int(diskNumber))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was the prior behavior broken?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

previously the map was map[string], now it's map[uint32]

break
}
}
Expand Down
Loading