Skip to content

Commit

Permalink
fix: fetch reports in inmemory for all namespaces
Browse files Browse the repository at this point in the history
Signed-off-by: Vishal Choudhary <[email protected]>
  • Loading branch information
vishal-chdhry committed Jun 13, 2024
1 parent 63682ed commit e4b20c7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/storage/inmemory/ephr.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (e *ephrdb) List(ctx context.Context, namespace string) ([]reportsv1.Epheme
res := make([]reportsv1.EphemeralReport, 0)

for _, k := range e.db.Keys() {
if strings.HasPrefix(k, fmt.Sprintf("ephr/%s/", namespace)) {
if namespace == "" || strings.HasPrefix(k, fmt.Sprintf("ephr/%s/", namespace)) {
v, _ := e.db.Get(k)
res = append(res, *v)
klog.Infof("value found for prefix:%s, key:%s", namespace, k)
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/inmemory/polr.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (p *polrdb) List(ctx context.Context, namespace string) ([]v1alpha2.PolicyR
res := make([]v1alpha2.PolicyReport, 0)

for _, k := range p.db.Keys() {
if strings.HasPrefix(k, fmt.Sprintf("polr/%s/", namespace)) {
if namespace == "" || strings.HasPrefix(k, fmt.Sprintf("polr/%s/", namespace)) {
klog.Infof("value found for prefix:%s, key:%s", namespace, k)
v, err := p.db.Get(k)
if err != nil {
Expand Down

0 comments on commit e4b20c7

Please sign in to comment.