Skip to content

Commit

Permalink
tetragon: initialize host namespaces info early
Browse files Browse the repository at this point in the history
Signed-off-by: Djalal Harouni <[email protected]>
  • Loading branch information
tixxdz committed Oct 16, 2023
1 parent 7c94c6a commit 09a10b3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/tetragon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
"github.com/cilium/tetragon/pkg/option"
"github.com/cilium/tetragon/pkg/process"
"github.com/cilium/tetragon/pkg/ratelimit"
"github.com/cilium/tetragon/pkg/reader/namespace"
"github.com/cilium/tetragon/pkg/rthooks"
"github.com/cilium/tetragon/pkg/sensors/base"
"github.com/cilium/tetragon/pkg/sensors/program"
Expand Down Expand Up @@ -176,6 +177,12 @@ func tetragonExecute() error {
defaults.NetnsDir = viper.GetString(option.KeyNetnsDir)
}

// We need host namespaces info, so initialize here and fail on errors
ns := namespace.GetHostNamespace()
if ns.Mnt.Inum == 0 || ns.Pid.Inum == 0 {
log.Fatalf("Failed to read host mount and pid namespaces")
}

checkprocfs.Check()

// Setup file system mounts
Expand Down

0 comments on commit 09a10b3

Please sign in to comment.