rancher / local-path-provisioner

Dynamically provisioning persistent local storage with Kubernetes
Apache License 2.0
2.07k stars 439 forks source link

Add support for custom path patterns #385

Closed AlbanBedel closed 1 month ago

AlbanBedel commented 4 months ago

This PR implement support for configuring the name of the created volume directories using a template as requested in #302.

rpenziol commented 4 months ago

Thanks for implementing this! I built your branch and took this for a spin. It worked exactly like how I'd expect.

Here's a minimal example of a working config. This will create a new directory based on the directory-name annotation on the PersistentVolumeClaim

---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: local-path-test
provisioner: rancher.io/local-path
parameters:
  nodePath: /storage/container-data
  pathPattern: '{{ index .PVC.Annotations "directory-name" }}'
volumeBindingMode: WaitForFirstConsumer
reclaimPolicy: Retain

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  labels:
    app: test
  name: test-pvc
  annotations:
    directory-name: test-dir-name
spec:
  storageClassName: local-path-test
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 500Mi
vjm commented 1 month ago

any news on this?

derekbit commented 1 month ago

@AlbanBedel Can you help resolve the conflict and add a test case? Thank you. I will review it soon and include it in v0.0.27. Thanks.

vjm commented 1 month ago

did this build fail due to a CI issue? is this ready to be released?

derekbit commented 1 month ago

did this build fail due to a CI issue? is this ready to be released?

No worries. The failure is due to amd64 ci broken env. It's ready to be released in v0.0.27.

vjm commented 1 month ago

is there a timeline for this release?