Skip to content

Commit

Permalink
Merge pull request #307 from BSWANG/main
Browse files Browse the repository at this point in the history
fix sidecar mode
  • Loading branch information
BSWANG authored Jul 16, 2024
2 parents e24c6c0 + b6b2f73 commit 1028cc1
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions pkg/exporter/nettop/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ func initDefaultEntity(sidecarMode bool) error {
namespace: namespace,
name: name,
}
ent := []*Entity{defaultEntity}
entities.Store(&ent)
addEntityToCache(defaultEntity, false)
}

return nil
Expand Down Expand Up @@ -208,11 +211,13 @@ func (e *Entity) GetPids() []int {
}

func StartCache(ctx context.Context, sidecarMode bool) error {
if err := initCriClient(runtimeEndpoints); err != nil {
return err
}
if err := initCriInfo(); err != nil {
return err
if !sidecarMode {
if err := initCriClient(runtimeEndpoints); err != nil {
return err
}
if err := initCriInfo(); err != nil {
return err
}
}

if err := initDefaultEntity(sidecarMode); err != nil {
Expand Down

0 comments on commit 1028cc1

Please sign in to comment.