Skip to content

Commit 6be420a

Browse files
committed
tracejob: Mount /usr/src in pod template
Ensure that /usr/src is mounted, since several common distributions link /lib/modules/$(uname -r)/build to /usr/src/kernels/$(uname -r) or /usr/src/linux-headers-$(uname -r). Fixes: #76 Signed-off-by: Joe Stringer <[email protected]>
1 parent 84e4f0c commit 6be420a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pkg/tracejob/job.go

+13
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,14 @@ func (t *TraceJobClient) CreateJob(nj TraceJob) (*batchv1.Job, error) {
237237
},
238238
},
239239
},
240+
apiv1.Volume{
241+
Name: "usr-src-host",
242+
VolumeSource: apiv1.VolumeSource{
243+
HostPath: &apiv1.HostPathVolumeSource{
244+
Path: "/usr/src",
245+
},
246+
},
247+
},
240248
apiv1.Volume{
241249
Name: "modules-host",
242250
VolumeSource: apiv1.VolumeSource{
@@ -409,6 +417,11 @@ func (t *TraceJobClient) CreateJob(nj TraceJob) (*batchv1.Job, error) {
409417
} else {
410418
// If we aren't downloading headers, unconditionally used the ones linked in /lib/modules
411419
job.Spec.Template.Spec.Containers[0].VolumeMounts = append(job.Spec.Template.Spec.Containers[0].VolumeMounts,
420+
apiv1.VolumeMount{
421+
Name: "usr-src-host",
422+
MountPath: "/usr/src",
423+
ReadOnly: true,
424+
},
412425
apiv1.VolumeMount{
413426
Name: "modules-host",
414427
MountPath: "/lib/modules",

0 commit comments

Comments
 (0)