diff --git a/pkg/resmgr/nri.go b/pkg/resmgr/nri.go index 536b11283..59d1f44ee 100644 --- a/pkg/resmgr/nri.go +++ b/pkg/resmgr/nri.go @@ -333,7 +333,6 @@ func (p *nriPlugin) CreateContainer(ctx context.Context, podSandbox *api.PodSand c.UpdateState(cache.ContainerStateStale) return nil, nil, fmt.Errorf("failed to allocate resources: %w", err) } - c.UpdateState(cache.ContainerStateCreated) c.InsertMount(&cache.Mount{ Destination: "/.nri-resource-policy", @@ -342,6 +341,8 @@ func (p *nriPlugin) CreateContainer(ctx context.Context, podSandbox *api.PodSand Options: []string{"bind", "ro", "rslave"}, }) + c.UpdateState(cache.ContainerStateCreated) + if err := p.runPostAllocateHooks(event, c); err != nil { m.Error("%s: failed to run post-allocate hooks for %s: %v", event, container.GetName(), err)