Skip to content

Commit

Permalink
csi: add missing mount-info volumeMount for cephfs
Browse files Browse the repository at this point in the history
This file provides functionality to store various mount information
in a file. It's currently used to restore ceph-fuse mounts.
Mount info is stored in `/csi/mountinfo`.

Signed-off-by: Praveen M <[email protected]>
  • Loading branch information
iPraveenParihar committed Feb 25, 2025
1 parent e58debc commit c9625fd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/controller/driver_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,9 @@ func (r *driverReconcile) reconcileNodePluginDeamonSet() error {
if r.driver.Spec.Encryption != nil {
mounts = append(mounts, utils.KmsConfigVolumeMount)
}
if r.isCephFsDriver() {
mounts = append(mounts, utils.CsiMountInfoVolumeMount)
}
if r.isRdbDriver() {
mounts = append(mounts, utils.OidcTokenVolumeMount)
}
Expand Down Expand Up @@ -1250,6 +1253,12 @@ func (r *driverReconcile) reconcileNodePluginDeamonSet() error {
utils.PodsMountDirVolume(kubeletDirPath),
utils.RegistrationDirVolume(kubeletDirPath),
)
if r.isCephFsDriver() {
volumes = append(
volumes,
utils.CsiMountInfoVolume(kubeletDirPath, r.driver.Name),
)
}
if ptr.Deref(pluginSpec.EnableSeLinuxHostMount, false) {
volumes = append(
volumes,
Expand Down
16 changes: 16 additions & 0 deletions internal/utils/csi.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const (
csiAddonsEndpoint = "unix://" + SocketDir + "/csi-addons.sock"

kmsConfigVolumeName = "ceph-csi-kms-config"
csiMountInfoVolumeName = "ceph-csi-mountinfo"
registrationVolumeName = "registration-dir"
pluginDirVolumeName = "plugin-dir"
podsMountDirVolumeName = "pods-mount-dir"
Expand Down Expand Up @@ -126,6 +127,17 @@ var EtcSelinuxVolume = corev1.Volume{
},
}

func CsiMountInfoVolume(kubeletDirPath string, driverName string) corev1.Volume {
return corev1.Volume{
Name: csiMountInfoVolumeName,
VolumeSource: corev1.VolumeSource{
HostPath: &corev1.HostPathVolumeSource{
Path: fmt.Sprintf("%s/plugins/%s/mountinfo", kubeletDirPath, driverName),
Type: ptr.To(corev1.HostPathDirectoryOrCreate),
},
},
}
}
func KmsConfigVolume(configRef *corev1.LocalObjectReference) corev1.Volume {
return corev1.Volume{
Name: kmsConfigVolumeName,
Expand Down Expand Up @@ -245,6 +257,10 @@ var CsiConfigVolumeMount = corev1.VolumeMount{
Name: CsiConfigVolume.Name,
MountPath: "/etc/ceph-csi-config",
}
var CsiMountInfoVolumeMount = corev1.VolumeMount{
Name: csiMountInfoVolumeName,
MountPath: "/csi/mountinfo",
}
var KmsConfigVolumeMount = corev1.VolumeMount{
Name: kmsConfigVolumeName,
MountPath: "/etc/ceph-csi-encryption-kms-config/",
Expand Down

0 comments on commit c9625fd

Please sign in to comment.