Skip to content

Commit

Permalink
feat: implement CreateVolume and DeleteVolume
Browse files Browse the repository at this point in the history
Signed-off-by: Mayank Shah <mayankshah1614@gmail.com>
  • Loading branch information
mayankshah1607 committed Oct 14, 2020
1 parent 974337e commit 6029bba
Show file tree
Hide file tree
Showing 12 changed files with 541 additions and 14 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/sanity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install nfs-common
run: |
sudo apt-get install -y nfs-common
- name: Run tests
run: |
make sanity-test
sudo make sanity-test
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ local-k8s-uninstall:
kubectl delete -f $(DEPLOY_FOLDER)/csi-nfs-node.yaml --ignore-not-found
kubectl delete -f $(DEPLOY_FOLDER)/csi-nfs-driverinfo.yaml --ignore-not-found
kubectl delete -f $(DEPLOY_FOLDER)/rbac-csi-nfs-controller.yaml --ignore-not-found
echo "Uninstalled NFS driver"
echo "Uninstalled NFS driver"
3 changes: 2 additions & 1 deletion deploy/kubernetes/csi-nfs-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ spec:
allowPrivilegeEscalation: true
imagePullPolicy: IfNotPresent
args:
- "-v=5"
- "--nodeid=$(NODE_ID)"
- "--endpoint=$(CSI_ENDPOINT)"
env:
Expand Down Expand Up @@ -104,4 +105,4 @@ spec:
path: /var/lib/kubelet/pods
type: Directory
- name: socket-dir
emptyDir: {}
emptyDir: {}
1 change: 1 addition & 0 deletions deploy/kubernetes/csi-nfs-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ spec:
allowPrivilegeEscalation: true
image: quay.io/k8scsi/nfsplugin:v2.0.0
args :
- "-v=5"
- "--nodeid=$(NODE_ID)"
- "--endpoint=$(CSI_ENDPOINT)"
env:
Expand Down
42 changes: 42 additions & 0 deletions examples/kubernetes/statefulset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: statefulset-nfs
labels:
app: nginx
spec:
serviceName: statefulset-nfs
replicas: 1
template:
metadata:
labels:
app: nginx
spec:
nodeSelector:
"kubernetes.io/os": linux
containers:
- name: statefulset-nfs
image: mcr.microsoft.com/oss/nginx/nginx:1.17.3-alpine
command:
- "/bin/sh"
- "-c"
- while true; do echo $(date) >> /mnt/nfs/outfile; sleep 1; done
volumeMounts:
- name: persistent-storage
mountPath: /mnt/nfs
updateStrategy:
type: RollingUpdate
selector:
matchLabels:
app: nginx
volumeClaimTemplates:
- metadata:
name: persistent-storage
annotations:
volume.beta.kubernetes.io/storage-class: nfs-csi
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 10Gi
14 changes: 14 additions & 0 deletions examples/kubernetes/storageclass-nfs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: nfs-csi
provisioner: nfs.csi.k8s.io
parameters:
server: nfs-server.default.svc.cluster.local
share: /
reclaimPolicy: Retain # only retain is supported
volumeBindingMode: Immediate
mountOptions:
- hard
- nfsvers=4.1
Loading

0 comments on commit 6029bba

Please sign in to comment.