From 671f8fc633b8f12fc535099d26ed0f094797cc6f Mon Sep 17 00:00:00 2001 From: Michelle Au Date: Wed, 11 Nov 2020 21:30:29 -0800 Subject: [PATCH] Add kubelet directories to mock driver manifest, fix bug in NodeStageVolume that verifies staging path. --- .../deploy/csi-mock-driver-deployment.yaml | 19 +++++++++++++++++-- mock/service/node.go | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/mock/example/deploy/csi-mock-driver-deployment.yaml b/mock/example/deploy/csi-mock-driver-deployment.yaml index 8535bdbc..cc23b671 100644 --- a/mock/example/deploy/csi-mock-driver-deployment.yaml +++ b/mock/example/deploy/csi-mock-driver-deployment.yaml @@ -86,9 +86,11 @@ spec: securityContext: privileged: true - name: mock-driver - image: k8s.gcr.io/sig-storage/mock-driver:v3.1.0 + image: k8s.gcr.io/sig-storage/mock-driver:v4.1.0 args: - "--attach-limit=50" + # Required for e2e test log parsing + - "--v=5" env: - name: CSI_ENDPOINT value: /csi/csi.sock @@ -98,6 +100,10 @@ spec: volumeMounts: - name: socket-dir mountPath: /csi + - name: kubelet-pods-dir + mountPath: /var/lib/kubelet/pods + - name: kubelet-csi-dir + mountPath: /var/lib/kubelet/plugins/kubernetes.io/csi volumes: - name: socket-dir hostPath: @@ -107,7 +113,16 @@ spec: hostPath: path: /var/lib/kubelet/plugins_registry type: Directory - + - name: kubelet-pods-dir + hostPath: + path: /var/lib/kubelet/pods + type: Directory + # mock driver doesn't make mounts and therefore doesn't need mount propagation. + # mountPropagation: Bidirectional + - name: kubelet-csi-dir + hostPath: + path: /var/lib/kubelet/plugins/kubernetes.io/csi + type: DirectoryOrCreate --- apiVersion: storage.k8s.io/v1 kind: CSIDriver diff --git a/mock/service/node.go b/mock/service/node.go index e79d2561..e43d9b7b 100644 --- a/mock/service/node.go +++ b/mock/service/node.go @@ -67,7 +67,7 @@ func (s *service) NodeStageVolume( return nil, status.Error(codes.Internal, err.Error()) } if !exists { - status.Errorf(codes.Internal, "staging target path %s does not exist", req.StagingTargetPath) + return nil, status.Errorf(codes.Internal, "staging target path %s does not exist", req.StagingTargetPath) } s.volsRWL.Lock()