Skip to content

Commit

Permalink
tracejob: Mount /usr/src in pod template
Browse files Browse the repository at this point in the history
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 <joe@wand.net.nz>
  • Loading branch information
joestringer committed Aug 9, 2019
1 parent 84e4f0c commit 6be420a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/tracejob/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,14 @@ func (t *TraceJobClient) CreateJob(nj TraceJob) (*batchv1.Job, error) {
},
},
},
apiv1.Volume{
Name: "usr-src-host",
VolumeSource: apiv1.VolumeSource{
HostPath: &apiv1.HostPathVolumeSource{
Path: "/usr/src",
},
},
},
apiv1.Volume{
Name: "modules-host",
VolumeSource: apiv1.VolumeSource{
Expand Down Expand Up @@ -409,6 +417,11 @@ func (t *TraceJobClient) CreateJob(nj TraceJob) (*batchv1.Job, error) {
} else {
// If we aren't downloading headers, unconditionally used the ones linked in /lib/modules
job.Spec.Template.Spec.Containers[0].VolumeMounts = append(job.Spec.Template.Spec.Containers[0].VolumeMounts,
apiv1.VolumeMount{
Name: "usr-src-host",
MountPath: "/usr/src",
ReadOnly: true,
},
apiv1.VolumeMount{
Name: "modules-host",
MountPath: "/lib/modules",
Expand Down

0 comments on commit 6be420a

Please sign in to comment.