Skip to content

Commit

Permalink
Merge pull request #114 from dasmeta/DMVP-5249-have-option-to-set-per…
Browse files Browse the repository at this point in the history
…sistent-volumeClass

fix(DMVP-5249): have option to setup nfs provisioner withpreexist persistent storage class
  • Loading branch information
mrdntgrn authored Sep 12, 2024
2 parents 419190b + 9f38b88 commit 59758d9
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
10 changes: 4 additions & 6 deletions charts/nfs-provisioner/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
apiVersion: v1
name: nfs-provisioner
home: https://github.com/kubernetes-incubator/nfs-provisioner
version: 1.0.0
home: https://github.com/dasmeta/helm/blob/main/charts/nfs-provisioner
version: 1.0.1
description: nfs-provisioner Chart for Kubernetes.
sources:
- https://github.com/kubernetes-incubator/nfs-provisioner
maintainers:
- name: Maxime FRANCK
email: [email protected]
- https://github.com/kubernetes-incubator/nfs-provisioner # the original/base repo/chart
- https://github.com/dasmeta/helm/blob/main/charts/nfs-provisioner # the refactored/current repo/chart
13 changes: 13 additions & 0 deletions charts/nfs-provisioner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ helm repo add dasmeta https://dasmeta.github.io/helm/
helm install nfs-provisioner dasmeta/nfs-provisioner -f custom-values.yaml --version 1.0.0 --create-namespace -n nfs-provisioner
```

!IMPORTANT NOTE!:
If no options set for persistentVolumeClass field the nfs-provisioner will store volumes data on same node where the provisioner statefulset placed,
and when by some reason provisioner pod getting moved to another node all data in pv will got lost and cluster-local-nfs storage using application pods will fail to start on next deploy as they cant attach volumes.
Only pvc recreate help in that case. So that this way we having imitation of persistent volume by using cluster-local-nfs storage class.

To prevent this you have to configure the nfs provisioner to use an existing(another) storage class to store its provisioned volumes data there to have persistance.
Its more like the nfc-provisioner and its storage class cluster-local-nfs are acting as an layer over the existing storage class.
Here is how configuration being set:
```file custom-values.yaml
persistentVolumeClass: hcloud-volumes # the existing/other pvc storage class that is actually persistent
persistentVolumeSize: 500Gi # the total size of volume that will be provisioned to be used in nfs provisioner to store its volumes data
```

## Persistent Volumes
When deploying the NFS Provisioner, you can create Persistent Volumes (PVs) dynamically. Here is an example Persistent Volume Claim (PVC) that requests storage from the NFS Provisioner:
```
Expand Down
12 changes: 12 additions & 0 deletions charts/nfs-provisioner/templates/statefulSet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,19 @@ spec:
volumeMounts:
- name: export-volume
mountPath: /export
{{ if .Values.persistentVolumeClass }}
volumeClaimTemplates:
- metadata:
name: export-volume
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: {{.Values.persistentVolumeClass}}
resources:
requests:
storage: {{.Values.persistentVolumeSize}}
{{ else }}
volumes:
- name: export-volume
hostPath:
path: {{ .Values.hostPath }}
{{ end }}
2 changes: 2 additions & 0 deletions charts/nfs-provisioner/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ provisionerName: "cluster.local/nfs"
storageClass: cluster-local-nfs
defaultClass: false
hostPath: /srv
persistentVolumeClass:
persistentVolumeSize: 100Gi

clusterRole:
apiGroups:
Expand Down

0 comments on commit 59758d9

Please sign in to comment.