Skip to content

Commit 6e1c39c

Browse files
authored
Merge pull request #207 from iPraveenParihar/fix/add-mountinfo-volumemount
csi: add missing mount-info volumeMount for cephfs
2 parents e58debc + c9625fd commit 6e1c39c

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

internal/controller/driver_controller.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,9 @@ func (r *driverReconcile) reconcileNodePluginDeamonSet() error {
10761076
if r.driver.Spec.Encryption != nil {
10771077
mounts = append(mounts, utils.KmsConfigVolumeMount)
10781078
}
1079+
if r.isCephFsDriver() {
1080+
mounts = append(mounts, utils.CsiMountInfoVolumeMount)
1081+
}
10791082
if r.isRdbDriver() {
10801083
mounts = append(mounts, utils.OidcTokenVolumeMount)
10811084
}
@@ -1250,6 +1253,12 @@ func (r *driverReconcile) reconcileNodePluginDeamonSet() error {
12501253
utils.PodsMountDirVolume(kubeletDirPath),
12511254
utils.RegistrationDirVolume(kubeletDirPath),
12521255
)
1256+
if r.isCephFsDriver() {
1257+
volumes = append(
1258+
volumes,
1259+
utils.CsiMountInfoVolume(kubeletDirPath, r.driver.Name),
1260+
)
1261+
}
12531262
if ptr.Deref(pluginSpec.EnableSeLinuxHostMount, false) {
12541263
volumes = append(
12551264
volumes,

internal/utils/csi.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const (
3030
csiAddonsEndpoint = "unix://" + SocketDir + "/csi-addons.sock"
3131

3232
kmsConfigVolumeName = "ceph-csi-kms-config"
33+
csiMountInfoVolumeName = "ceph-csi-mountinfo"
3334
registrationVolumeName = "registration-dir"
3435
pluginDirVolumeName = "plugin-dir"
3536
podsMountDirVolumeName = "pods-mount-dir"
@@ -126,6 +127,17 @@ var EtcSelinuxVolume = corev1.Volume{
126127
},
127128
}
128129

130+
func CsiMountInfoVolume(kubeletDirPath string, driverName string) corev1.Volume {
131+
return corev1.Volume{
132+
Name: csiMountInfoVolumeName,
133+
VolumeSource: corev1.VolumeSource{
134+
HostPath: &corev1.HostPathVolumeSource{
135+
Path: fmt.Sprintf("%s/plugins/%s/mountinfo", kubeletDirPath, driverName),
136+
Type: ptr.To(corev1.HostPathDirectoryOrCreate),
137+
},
138+
},
139+
}
140+
}
129141
func KmsConfigVolume(configRef *corev1.LocalObjectReference) corev1.Volume {
130142
return corev1.Volume{
131143
Name: kmsConfigVolumeName,
@@ -245,6 +257,10 @@ var CsiConfigVolumeMount = corev1.VolumeMount{
245257
Name: CsiConfigVolume.Name,
246258
MountPath: "/etc/ceph-csi-config",
247259
}
260+
var CsiMountInfoVolumeMount = corev1.VolumeMount{
261+
Name: csiMountInfoVolumeName,
262+
MountPath: "/csi/mountinfo",
263+
}
248264
var KmsConfigVolumeMount = corev1.VolumeMount{
249265
Name: kmsConfigVolumeName,
250266
MountPath: "/etc/ceph-csi-encryption-kms-config/",

0 commit comments

Comments
 (0)