question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: how to customize the zfs/nfs generated dataset name to include namespace+ pvc name?

See original GitHub issue

Q:

  • is there a way to configure the name of the created zfs dataset name (and derived nfs share) to include the namespace/pvc related name?
  • if so why. democratic-csi is installed via Helm

Currently the name of the zfs volume is"pvc-<pv uuid>" I know it is possible to change the static prefix “pvc-” by some static string I would like to have the dataset name to be "<namespace>-<pvc name>-<uuid>" (of course truncated to the max possible length)

Current config:

  • Truenas v13.0-U3
  • OpenShift v4.11 (k8s v1.24.6)
  • democratic-csi image v1.7, csi-provisioner v3.1.0…

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
travisghansencommented, Dec 9, 2022

Yeah, iscsi has different limits for sizes etc (none of which are directly impacted by csi limits) making it less of an issue. In that case I use zfs props to store all that info as a quasi database, but I need to know the exact volume/dataset before I can get the props.

Regarding the volumeidfromname code, that works but the other methods which pass the id around don’t pass in the same parameters so I can’t deconstruct it 😦 the id must be the dataset name by my own convention (due to not having any kind of database).

I’m happy to leave this open. I would even be open to perhaps an entirely new ‘driver’ being introduced in the codebase which could meet your needs. I’m also open to introducing a soft delete to the existing drivers (although that normally would just be setting retain on storage class).

Also if it’s easier you can hit me up on slack/discord/whatever to have a more thorough discussion!

0reactions
titou10titou10commented, Dec 8, 2022

Thanks for your answer

I naively thought that generating avolume_idbased onshorten(pvc_namespace+pvc_name+name)in theCreateVolume method executed when the volume is created would do the trick as this isvolume_idthat is received with the other lifecycle calls (egDeleteVolume) by the CSI engine after the volume is created. There is already adriver.getVolumeIdFromNamemethod that take care of generating a volume_id:

https://github.com/democratic-csi/democratic-csi/blob/7233bde497271c6a5bac13e757103313ef442359/src/driver/freenas/api.js#L2180

Also theiscsiimplementation do that via theiscsi.nameTemplateparameter that dynamically sets the name of the iSCSI extents/target/zvol in TrueNAS

iscsi:
    nameTemplate: "{{ parameters.[csi.storage.k8s.io/pvc/namespace] }}-{{ parameters.[csi.storage.k8s.io/pvc/name] }}

Anyway, thanks for your answer.

I’ll close soon this issue except if you want to keep it as a feature request…

I’m currently evaluating the possibility to create on my side a very specialized TrueNAS v13+/k8s v1.23+/Filesystem only/NFS CSI driver with this feature and some others from my current non-CSI provisionner: nfs-subdir-external-provisioner (like the possibility to ‘archive’ -ie rename instead of delete- the dataset when deleted)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to bind PVC · Issue #6 · democratic-csi ... - GitHub
k get sc test-csi NAME PROVISIONER RECLAIMPOLICY ... This fails to create the dataset. pvc is created but waiting for volume to be...
Read more >
Creating the persistent volume claims (PVC) using storage ...
Create a file for configuring the persistent volume claim, iccsap-instance-pvc. ... metadata: name: iccsap-instance-pvc namespace: <NAMESPACE> spec: ...
Read more >
Using TrueNAS to provide persistent storage for Kubernetes
I've got various things on my TrueNAS box so under hdd I created a dataset k8s . I wanted to provide both iSCSI...
Read more >
Learn how to recreate an existing PVC in a new namespace ...
NOTE: The CLI will show the name of the PVC bound to the PV. Use Case. I was working on a ticket to...
Read more >
Persistent Volumes | Kubernetes
When none of the static PVs the administrator created match a user's ... kubectl describe pvc hostpath Name: hostpath Namespace: default ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found