Skip to content

Commit be5068e

Browse files
committed
feat: add inline volume support
fix yaml refine tests
1 parent f9faadf commit be5068e

File tree

13 files changed

+149
-3
lines changed

13 files changed

+149
-3
lines changed

.github/workflows/static.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Run linter
1313
uses: golangci/golangci-lint-action@v2
1414
with:
15-
version: v1.29
15+
version: v1.31
1616
args: -E=gofmt,deadcode,unused,varcheck,ineffassign,golint,misspell --timeout=30m0s
1717
verify-helm:
1818
name: Verify Helm

charts/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ The following table lists the configurable parameters of the latest NFS CSI Driv
4040
| `driver.name` | alternative driver name | `nfs.csi.k8s.io` |
4141
| `driver.mountPermissions` | mounted folder permissions name | `0777`
4242
| `feature.enableFSGroupPolicy` | enable `fsGroupPolicy` on a k8s 1.20+ cluster | `false` |
43+
| `feature.enableInlineVolume` | enable inline volume | `true` |
4344
| `image.nfs.repository` | csi-driver-nfs image | `mcr.microsoft.com/k8s/csi/nfs-csi` |
4445
| `image.nfs.tag` | csi-driver-nfs image tag | `latest` |
4546
| `image.nfs.pullPolicy` | csi-driver-nfs image pull policy | `IfNotPresent` |
24 Bytes
Binary file not shown.

charts/latest/csi-driver-nfs/templates/csi-nfs-driverinfo.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ spec:
66
attachRequired: false
77
volumeLifecycleModes:
88
- Persistent
9+
{{- if .Values.feature.enableInlineVolume}}
10+
- Ephemeral
11+
{{- end}}
912
{{- if .Values.feature.enableFSGroupPolicy}}
1013
fsGroupPolicy: File
1114
{{- end}}

charts/latest/csi-driver-nfs/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ driver:
3030

3131
feature:
3232
enableFSGroupPolicy: false
33+
enableInlineVolume: true
3334

3435
controller:
3536
name: csi-nfs-controller

deploy/csi-nfs-driverinfo.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ spec:
77
attachRequired: false
88
volumeLifecycleModes:
99
- Persistent
10+
- Ephemeral
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
kind: Pod
3+
apiVersion: v1
4+
metadata:
5+
name: nginx-nfs-inline-volume
6+
spec:
7+
nodeSelector:
8+
"kubernetes.io/os": linux
9+
containers:
10+
- image: mcr.microsoft.com/oss/nginx/nginx:1.19.5
11+
name: nginx-nfs
12+
command:
13+
- "/bin/bash"
14+
- "-c"
15+
- set -euo pipefail; while true; do echo $(date) >> /mnt/nfs/outfile; sleep 1; done
16+
volumeMounts:
17+
- name: persistent-storage
18+
mountPath: "/mnt/nfs"
19+
volumes:
20+
- name: persistent-storage
21+
csi:
22+
driver: nfs.csi.k8s.io
23+
volumeAttributes:
24+
server: nfs-server.default.svc.cluster.local # required
25+
share: / # required

hack/verify-examples.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ EXAMPLES+=(\
3939
if [[ "$#" -gt 0 ]]&&[[ "$1" == *"ephemeral"* ]]; then
4040
EXAMPLES+=(\
4141
deploy/example/daemonset-nfs-ephemeral.yaml \
42+
deploy/example/nginx-pod-inline-volume.yaml \
4243
)
4344
fi
4445

test/e2e/dynamic_provisioning_test.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,32 @@ var _ = ginkgo.Describe("Dynamic Provisioning", func() {
257257
}
258258
test.Run(cs, ns)
259259
})
260+
261+
ginkgo.It("should create a CSI inline volume [nfs.csi.k8s.io]", func() {
262+
pods := []testsuites.PodDetails{
263+
{
264+
Cmd: convertToPowershellCommandIfNecessary("echo 'hello world' > /mnt/test-1/data && grep 'hello world' /mnt/test-1/data"),
265+
Volumes: []testsuites.VolumeDetails{
266+
{
267+
ClaimSize: "10Gi",
268+
VolumeMount: testsuites.VolumeMountDetails{
269+
NameGenerate: "test-volume-",
270+
MountPathGenerate: "/mnt/test-",
271+
},
272+
},
273+
},
274+
},
275+
}
276+
277+
test := testsuites.DynamicallyProvisionedInlineVolumeTest{
278+
CSIDriver: testDriver,
279+
Pods: pods,
280+
Server: nfsServerAddress,
281+
Share: nfsShare,
282+
ReadOnly: false,
283+
}
284+
test.Run(cs, ns)
285+
})
260286
})
261287

262288
func restClient(group string, version string) (restclientset.Interface, error) {

test/e2e/e2e_suite_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,17 @@ import (
3737
const (
3838
kubeconfigEnvVar = "KUBECONFIG"
3939
testWindowsEnvVar = "TEST_WINDOWS"
40+
nfsServerAddress = "nfs-server.default.svc.cluster.local"
41+
nfsShare = "/"
4042
)
4143

4244
var (
4345
nodeID = os.Getenv("NODE_ID")
4446
nfsDriver *nfs.Driver
4547
isWindowsCluster = os.Getenv(testWindowsEnvVar) != ""
4648
defaultStorageClassParameters = map[string]string{
47-
"server": "nfs-server.default.svc.cluster.local",
48-
"share": "/",
49+
"server": nfsServerAddress,
50+
"share": nfsShare,
4951
"csi.storage.k8s.io/provisioner-secret-name": "mount-options",
5052
"csi.storage.k8s.io/provisioner-secret-namespace": "default",
5153
}

0 commit comments

Comments
 (0)