Skip to content

Support for devAttribs - #75

Open
pavels wants to merge 2 commits into
SynologyOpenSource:mainfrom
pavels:main
Open

Support for devAttribs#75
pavels wants to merge 2 commits into
SynologyOpenSource:mainfrom
pavels:main

Conversation

@pavels

@pavels pavels commented Dec 19, 2023

Copy link
Copy Markdown

Allow to set DevAttribs for LUN creation.

This allows user to set for example emulate_tpu and enable space reclamation.

Example storage class would look like this:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: nas-iscsi
provisioner: csi.san.synology.com
parameters:
  dsm: 'my-nas'
  location: '/volume1'
  fsType: 'xfs'
  formatOptions: '-K'
  devAttribs: 'emulate_tpu'
reclaimPolicy: Retain
allowVolumeExpansion: true

I also added support to explicitly set flag to 0 (the strange syntax with - suffix is actually similar to how labels and annotations are set using kubectl)

@gjrtimmer

Copy link
Copy Markdown

@chihyuwu Could you please look at this, I hope it gets merged soon.

@gjrtimmer

Copy link
Copy Markdown

@pavels Would it be possible to also set the directory chmod with this? So, containers like PostgreSQL use a separate user. I would like the ability for the mounted folder to be set to 777 so that containers like PostgreSQL do not need an initializing task that sets the permissions.

I was thinking, can it be related to the func createTargetMountPath which sets 0750 on the mounted folder. Unfortunately I do not know yet how to turn it into a parameter. Can you give some advice?

@pavels

pavels commented Feb 22, 2024

Copy link
Copy Markdown
Author

@pavels Would it be possible to also set the directory chmod with this? So, containers like PostgreSQL use a separate user. I would like the ability for the mounted folder to be set to 777 so that containers like PostgreSQL do not need an initializing task that sets the permissions.

I was thinking, can it be related to the func createTargetMountPath which sets 0750 on the mounted folder. Unfortunately I do not know yet how to turn it into a parameter. Can you give some advice?

This PR is specifically about creation flags, which are specific to the Synology CSI driver and therefore must be configured on driver level (StorageClass config gets written to PersistentVolume object on creation and from there, it is picked up by the specific CSI driver)

Permissions on the other hand is handled by kubernetes itself - see https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#configure-volume-permission-and-ownership-change-policy-for-pods

There is an option to delegate ownership change to CSI driver if the driver supports it - if you take a look at

// csi.NodeServiceCapability_RPC_VOLUME_MOUNT_GROUP,
- NodeServiceCapability_RPC_VOLUME_MOUNT_GROUP is commented out, therefore kubernetes will use internal mechanism to set permissions (which is probably fine, this as i understand is primarily intended for drivers, that doesn't support changing permission using chown / chmod and where permissions must be set as mount parameters or something similar - or some kind of optimizations on CSI driver level)

the 0750 in createTargetMountPath is probably just a conservative default and should be overwritten om pod startup when securityContext is set

@xphyr

xphyr commented Jul 11, 2025

Copy link
Copy Markdown

I have created a fork of the synology driver here: github.com/xphyr/synology-csi and I have merged this PR request into it. I am actually working on updating the driver and slowly patching issues. Please feel free to take a look, and if you want contribute to that fork. If/When synology resumes maintenance of this project they can choose to pull in all the work I have done and continue it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants