Skip to content

Commit

Permalink
test/e2e/storage: replace mock driver with hostpath driver
Browse files Browse the repository at this point in the history
This is a first step towards removing the mock CSI driver completely from
e2e testing in favor of hostpath plugin. With the recent hostpath plugin
changes(PR kubernetes#260, kubernetes#269), it supports all the features supported by the mock
csi driver.

Using hostpath-plugin for testing also covers CSI persistent feature
usecases.
  • Loading branch information
avalluri authored and pohly committed Dec 2, 2021
1 parent 2ac6a41 commit e68c9f3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
6 changes: 3 additions & 3 deletions test/e2e/storage/drivers/csi.go
Original file line number Diff line number Diff line change
Expand Up @@ -618,10 +618,10 @@ func (m *mockCSIDriver) PrepareTest(f *framework.Framework) (*storageframework.P
} else {
// When using the mock driver inside the cluster it has to be reconfigured
// via command line parameters.
containerArgs = append(containerArgs, "--name=csi-mock-"+f.UniqueName)
containerArgs = append(containerArgs, "--drivername=csi-mock-"+f.UniqueName)

if !m.attachable {
containerArgs = append(containerArgs, "--disable-attach")
if m.attachable {
containerArgs = append(containerArgs, "--enable-attach")
}

if m.enableTopology {
Expand Down
15 changes: 12 additions & 3 deletions test/e2e/testing-manifests/storage-csi/mock/csi-mock-driver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,13 @@ spec:
- mountPath: /registration
name: registration-dir
- name: mock
image: k8s.gcr.io/sig-storage/mock-driver:v4.1.0
image: k8s.gcr.io/sig-storage/hostpathplugin:v1.7.3
args:
- "--name=mock.storage.k8s.io"
- "-v=3" # enabled the gRPC call logging
- "--drivername=mock.storage.k8s.io"
- "--nodeid=$(KUBE_NODE_NAME)"
- "--endpoint=/csi/csi.sock"
- "--statedir=/tmp/csi-hotpath-data"
- "-v=5" # enabled the gRPC call logging
env:
- name: CSI_ENDPOINT
value: /csi/csi.sock
Expand All @@ -74,6 +77,8 @@ spec:
name: kubelet-pods-dir
- mountPath: /var/lib/kubelet/plugins/kubernetes.io/csi
name: kubelet-csi-dir
- mountPath: /dev
name: dev-dir
volumes:
- hostPath:
path: /var/lib/kubelet/plugins/csi-mock
Expand All @@ -93,3 +98,7 @@ spec:
path: /var/lib/kubelet/plugins_registry
type: Directory
name: registration-dir
- hostPath:
path: /dev
type: Directory
name: dev-dir
14 changes: 9 additions & 5 deletions test/e2e/testing-manifests/storage-csi/mock/csi-mock-proxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,20 @@ spec:
- mountPath: /registration
name: registration-dir
- name: mock
image: k8s.gcr.io/sig-storage/mock-driver:v4.1.0
image: k8s.gcr.io/sig-storage/hostpathplugin:v1.7.3
args:
# -v3 shows when connections get established. Higher log levels print information about
# transferred bytes, but cannot print message content (no gRPC parsing), so this is usually
# not interesting.
- -v=3
- -v=5
- -nodeid=$(KUBE_NODE_NAME)
- -endpoint=/csi/csi.sock
- -proxy-endpoint=tcp://:9000
env:
- name: CSI_ENDPOINT
value: /csi/csi.sock
- name: KUBE_NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
ports:
- containerPort: 9000
name: socat
Expand Down

0 comments on commit e68c9f3

Please sign in to comment.