diff --git a/README.md b/README.md index dd7bacd4..8159deae 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,7 @@ To disable leader election, define an env variable named ENABLE_LEADER_ELECTION | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------: | | onDelete | If it exists and has a delete value, delete the directory, if it exists and has a retain value, save the directory. | will be archived with name on the share: `archived-` | | archiveOnDelete | If it exists and has a false value, delete the directory. if `onDelete` exists, `archiveOnDelete` will be ignored. | will be archived with name on the share: `archived-` | -| pathPattern | Specifies a template for creating a directory path via PVC metadata's such as labels, annotations, name or namespace. To specify metadata use `${.PVC.}`: `${PVC.namespace}` | n/a | +| pathPattern | Specifies a template for creating a directory path via PVC metadata's such as labels, annotations, name or namespace. To specify metadata use `${.PVC.}`. Example: If folder should be named like `-`, use `${.PVC.namespace}-${.PVC.name}` as pathPattern. | n/a | This is `deploy/class.yaml` which defines the NFS subdir external provisioner's Kubernetes Storage Class: diff --git a/charts/nfs-subdir-external-provisioner/README.md b/charts/nfs-subdir-external-provisioner/README.md index ac692969..d097e7fb 100644 --- a/charts/nfs-subdir-external-provisioner/README.md +++ b/charts/nfs-subdir-external-provisioner/README.md @@ -61,6 +61,7 @@ The following tables lists the configurable parameters of this chart and their d | `storageClass.reclaimPolicy` | Method used to reclaim an obsoleted volume | `Delete` | | `storageClass.provisionerName` | Name of the provisionerName | null | | `storageClass.archiveOnDelete` | Archive pvc when deleting | `true` | +| `storageClass.pathPattern` | Specifies a template for the directory name | null | | `storageClass.accessModes` | Set access mode for PV | `ReadWriteOnce` | | `leaderElection.enabled` | Enables or disables leader election | `true` | | `nfs.server` | Hostname of the NFS server (required) | null (ip or hostname) | diff --git a/charts/nfs-subdir-external-provisioner/templates/storageclass.yaml b/charts/nfs-subdir-external-provisioner/templates/storageclass.yaml index e3bc69c2..22576c57 100644 --- a/charts/nfs-subdir-external-provisioner/templates/storageclass.yaml +++ b/charts/nfs-subdir-external-provisioner/templates/storageclass.yaml @@ -17,6 +17,9 @@ allowVolumeExpansion: {{ .Values.storageClass.allowVolumeExpansion }} reclaimPolicy: {{ .Values.storageClass.reclaimPolicy }} parameters: archiveOnDelete: "{{ .Values.storageClass.archiveOnDelete }}" + {{- if .Values.storageClass.pathPattern }} + pathPattern: "{{ .Values.storageClass.pathPattern }}" + {{- end }} {{- if .Values.nfs.mountOptions }} mountOptions: {{- range .Values.nfs.mountOptions }} diff --git a/charts/nfs-subdir-external-provisioner/values.yaml b/charts/nfs-subdir-external-provisioner/values.yaml index 95c23038..cd03acc5 100644 --- a/charts/nfs-subdir-external-provisioner/values.yaml +++ b/charts/nfs-subdir-external-provisioner/values.yaml @@ -35,6 +35,10 @@ storageClass: # When set to false your PVs will not be archived by the provisioner upon deletion of the PVC. archiveOnDelete: true + # Specifies a template for creating a directory path via PVC metadata's such as labels, annotations, name or namespace. + # Ignored if value not set. + pathPattern: + # Set access mode - ReadWriteOnce, ReadOnlyMany or ReadWriteMany accessModes: ReadWriteOnce