8
8
9
9
"github.com/nais/api/internal/activitylog"
10
10
"github.com/nais/api/internal/auth/authz"
11
+ "github.com/nais/api/internal/environmentmapper"
11
12
"github.com/nais/api/internal/graph/apierror"
12
13
"github.com/nais/api/internal/graph/ident"
13
14
"github.com/nais/api/internal/graph/model"
@@ -347,7 +348,8 @@ func getFilteredVulnerabilitySummaries(ctx context.Context, s slug.Slug, filter
347
348
it := iterator .New (ctx , 100 , func (limit , offset int32 ) (* vulnerabilities.ListVulnerabilitySummariesResponse , error ) {
348
349
opts := make ([]vulnerabilities.Option , 0 )
349
350
if filter != nil && len (filter .Environments ) == 1 {
350
- opts = append (opts , vulnerabilities .ClusterFilter (filter .Environments [0 ]))
351
+ cluster := environmentmapper .ClusterName (filter .Environments [0 ])
352
+ opts = append (opts , vulnerabilities .ClusterFilter (cluster ))
351
353
}
352
354
opts = append (opts , vulnerabilities .NamespaceFilter (s .String ()))
353
355
opts = append (opts , vulnerabilities .Offset (offset ))
@@ -362,15 +364,16 @@ func getFilteredVulnerabilitySummaries(ctx context.Context, s slug.Slug, filter
362
364
}
363
365
364
366
wSum := it .Value ()
367
+ env := environmentmapper .EnvironmentName (wSum .Workload .Cluster )
365
368
if wSum .Workload .Type == "app" {
366
- _ , err := application .Get (ctx , s , wSum . Workload . Cluster , wSum .Workload .Name )
369
+ _ , err := application .Get (ctx , s , env , wSum .Workload .Name )
367
370
if err != nil {
368
371
continue
369
372
}
370
373
ret = append (ret , toWorkloadVulnerabilitySummary (wSum ))
371
374
}
372
375
if wSum .Workload .Type == "job" {
373
- _ , err := job .Get (ctx , s , wSum . Workload . Cluster , wSum .Workload .Name )
376
+ _ , err := job .Get (ctx , s , env , wSum .Workload .Name )
374
377
if err != nil {
375
378
continue
376
379
}
0 commit comments