You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
func (l*localManagerTraceWrapper) PreStart(gadgetCtx operators.GadgetContext) error {
// hack - this makes it possible to use the Attacher interfacevarokbooll.gadgetInstance, ok=gadgetCtx.GetVar("ebpfInstance")
if!ok {
returnfmt.Errorf("getting ebpfInstance")
}
compat.Subscribe(
l.eventWrappers,
l.manager.igManager.ContainerCollection.EnrichEventByMntNs,
l.manager.igManager.ContainerCollection.EnrichEventByNetNs,
0,
)
Presumably, l.manager.igManager.ContainerCollection is nil. The function PreStart should check this.
go run -exec 'sudo -E' ./cmd/ig/... trace exec --host -c mycontainer
So I get the warnings:
WARN[0000] Failed to create container-collection
WARN[0000] container-collection isn't available: container enrichment and filtering won't work
But localManagerTraceWrapper.PreStart is not called in my tests. PreStart has the same interface as other PreStart functions. In fact, when I add a panic() in GadgetContext.run, it is not called.
I am not sure of the differences between LocalManager, localManagerTrace and localManagerTraceWrapper.
Description
ig panics when it fails to create container-collection
Impact
Environment and steps to reproduce
I don't have the steps or the environment, I'll try to find more details.
Start ig in a Kubernetes pod:
Expected behavior
ig should not panic.
Additional information
https://github.com/inspektor-gadget/inspektor-gadget/blob/v0.27.0/pkg/operators/localmanager/localmanager.go#L532
Presumably,
l.manager.igManager.ContainerCollection
isnil
. The functionPreStart
should check this.cc @flyth
The text was updated successfully, but these errors were encountered: