Skip to content

Commit e583f69

Browse files
feat: implement CreateVolume and DeleteVolume
Signed-off-by: Mayank Shah <[email protected]>
1 parent bf4d6bb commit e583f69

File tree

11 files changed

+557
-13
lines changed

11 files changed

+557
-13
lines changed

.github/workflows/sanity.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ jobs:
1313
uses: actions/checkout@v2
1414
- name: Run tests
1515
run: |
16-
make sanity-test
16+
sudo make sanity-test

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ local-k8s-uninstall:
4343
kubectl delete -f $(DEPLOY_FOLDER)/csi-nfs-node.yaml --ignore-not-found
4444
kubectl delete -f $(DEPLOY_FOLDER)/csi-nfs-driverinfo.yaml --ignore-not-found
4545
kubectl delete -f $(DEPLOY_FOLDER)/rbac-csi-nfs-controller.yaml --ignore-not-found
46-
echo "Uninstalled NFS driver"
46+
echo "Uninstalled NFS driver"

deploy/kubernetes/csi-nfs-controller.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ spec:
7070
allowPrivilegeEscalation: true
7171
imagePullPolicy: IfNotPresent
7272
args:
73+
- "-v=5"
7374
- "--nodeid=$(NODE_ID)"
7475
- "--endpoint=$(CSI_ENDPOINT)"
7576
env:
@@ -104,4 +105,4 @@ spec:
104105
path: /var/lib/kubelet/pods
105106
type: Directory
106107
- name: socket-dir
107-
emptyDir: {}
108+
emptyDir: {}

deploy/kubernetes/csi-nfs-node.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ spec:
4343
allowPrivilegeEscalation: true
4444
image: quay.io/k8scsi/nfsplugin:v2.0.0
4545
args :
46+
- "-v=5"
4647
- "--nodeid=$(NODE_ID)"
4748
- "--endpoint=$(CSI_ENDPOINT)"
4849
env:

examples/kubernetes/statefulset.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: StatefulSet
4+
metadata:
5+
name: statefulset-nfs
6+
labels:
7+
app: nginx
8+
spec:
9+
serviceName: statefulset-nfs
10+
replicas: 1
11+
template:
12+
metadata:
13+
labels:
14+
app: nginx
15+
spec:
16+
nodeSelector:
17+
"kubernetes.io/os": linux
18+
containers:
19+
- name: statefulset-nfs
20+
image: mcr.microsoft.com/oss/nginx/nginx:1.17.3-alpine
21+
command:
22+
- "/bin/sh"
23+
- "-c"
24+
- while true; do echo $(date) >> /mnt/nfs/outfile; sleep 1; done
25+
volumeMounts:
26+
- name: persistent-storage
27+
mountPath: /mnt/nfs
28+
updateStrategy:
29+
type: RollingUpdate
30+
selector:
31+
matchLabels:
32+
app: nginx
33+
volumeClaimTemplates:
34+
- metadata:
35+
name: persistent-storage
36+
annotations:
37+
volume.beta.kubernetes.io/storage-class: nfs-csi
38+
spec:
39+
accessModes: ["ReadWriteOnce"]
40+
resources:
41+
requests:
42+
storage: 10Gi
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
apiVersion: storage.k8s.io/v1
3+
kind: StorageClass
4+
metadata:
5+
name: nfs-csi
6+
provisioner: nfs.csi.k8s.io
7+
parameters:
8+
server: nfs-server.default.svc.cluster.local
9+
share: /
10+
reclaimPolicy: Retain # only retain is supported
11+
volumeBindingMode: Immediate
12+
mountOptions:
13+
- hard
14+
- nfsvers=4.1

0 commit comments

Comments
 (0)