Skip to content

Commit

Permalink
Support Kernel Build System (Debian 11)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Kvapil <[email protected]>
  • Loading branch information
kvaps committed May 23, 2023
1 parent 32403e9 commit 9a3169e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1260,12 +1260,18 @@ func daemonSetWithDRBDKernelModuleInjection(ds *apps.DaemonSet, satelliteSet *pi
MountPath: kubeSpec.ModulesDir,
},
)
volumeMounts = append(volumeMounts, corev1.VolumeMount{
Name: kubeSpec.UsrLibDirName,
MountPath: kubeSpec.UsrLibDirMountPath,
},
)

ds.Spec.Template.Spec.InitContainers = []corev1.Container{
{
Name: "kernel-module-injector",
Image: satelliteSet.Spec.KernelModuleInjectionImage,
ImagePullPolicy: satelliteSet.Spec.ImagePullPolicy,
Command: []string{"/bin/bash", "-c", "find /host/usr/lib -maxdepth 1 -mindepth 1 -exec ln -vs {} /usr/lib \\; 2>/dev/null; exec /entry.sh"},
SecurityContext: &corev1.SecurityContext{Privileged: &kubeSpec.Privileged},
Env: env,
VolumeMounts: volumeMounts,
Expand Down Expand Up @@ -1294,6 +1300,15 @@ func daemonSetWithDRBDKernelModuleInjection(ds *apps.DaemonSet, satelliteSet *pi
},
},
})
ds.Spec.Template.Spec.Volumes = append(ds.Spec.Template.Spec.Volumes, corev1.Volume{
Name: kubeSpec.UsrLibDirName,
VolumeSource: corev1.VolumeSource{
HostPath: &corev1.HostPathVolumeSource{
Path: kubeSpec.UsrLibDir,
Type: &kubeSpec.HostPathDirectoryType,
},
},
})
}

return ds
Expand Down
3 changes: 3 additions & 0 deletions pkg/k8s/spec/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ const (
LinstorCertDirName = "linstor-certs"
ModulesDir = "/lib/modules/" // "/usr/lib/modules/"
ModulesDirName = "modules-dir"
UsrLibDir = "/usr/lib"
UsrLibDirMountPath = "/host/usr/lib"
UsrLibDirName = "usr-lib-dir"
SrcDir = "/usr/src"
SrcDirName = "src-dir"
SysDir = "/sys/"
Expand Down

0 comments on commit 9a3169e

Please sign in to comment.