[Feature Request] [cinder-csi-plugin] support for SeLinuxMount
/kind feature
What happened: seLinuxMount is a property of CSIDriver added in Kubernetes 1.25. It declares the driver's ability to mount its volumes separately with different SELinux labels. The reason this matters is because workloads storing many small files on PVs will suffer from very slow startup otherwise.
What you expected to happen:
The CSIDriver to support passing the -o context=
How to reproduce it: Create a PVC with a huge amount of files. When restarting the Pod the container will be in ContainerCreating for quite some time, depending on underlying storage IO
Anything else we need to know?: For relevant context see:
- https://kubernetes.io/blog/2023/04/18/kubernetes-1-27-efficient-selinux-relabeling-beta/
- https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/1710-selinux-relabeling
Environment:
- openstack-cloud-controller-manager(or other related binary) version:
- OpenStack version:
- Others:
I looked at what this would take for cinder-csi-plugin:
- Neither
manifests/cinder-csi-plugin/csi-cinder-driver.yamlnor the chart'stemplates/cinder-csi-driver.yamlsetsseLinuxMounttoday. So kubelet never passes thecontext=mount option and falls back to recursive relabeling. - The node side already looks ready.
NodeStageVolumeappends the volume capability's mount flags to the staging mount options (collectMountOptionsinpkg/csi/cinder/nodeserver.go), and that is where kubelet puts-o context=...once the driver opts in.
So the change may be mostly declarative: add seLinuxMount: true to the CSIDriver (probably behind a chart value so it can be turned off), then test on an SELinux-enforcing node with both ext4 and xfs. In that test, it's worth checking that the bind mount in NodePublishVolume still works when kubelet passes the context option there too.