@@ -156,7 +156,7 @@ func (mainHandler *MainHandler) HandleWatchers(ctx context.Context) {
156
156
logger .L ().Ctx (ctx ).Fatal (fmt .Sprintf ("Unable to initialize the storage client: %v" , err ))
157
157
}
158
158
eventQueue := watcher .NewCooldownQueue ()
159
- watchHandler := watcher .NewWatchHandler (ctx , mainHandler .config , mainHandler .k8sAPI , ksStorageClient , eventQueue )
159
+ watchHandler := watcher .NewWatchHandler (mainHandler .config , mainHandler .k8sAPI , ksStorageClient , eventQueue )
160
160
161
161
commandWatchHandler := watcher .NewCommandWatchHandler (mainHandler .k8sAPI , mainHandler .config )
162
162
registryCommandsHandler := watcher .NewRegistryCommandsHandler (ctx , mainHandler .k8sAPI , commandWatchHandler , mainHandler .config )
@@ -168,7 +168,11 @@ func (mainHandler *MainHandler) HandleWatchers(ctx context.Context) {
168
168
waitFunc (mainHandler .config )
169
169
170
170
// start watching
171
- go watchHandler .PodWatch (ctx , mainHandler .eventWorkerPool )
171
+ if mainHandler .config .NodeSbomGenerationEnabled () {
172
+ go watchHandler .SBOMWatch (ctx , mainHandler .eventWorkerPool )
173
+ } else {
174
+ go watchHandler .PodWatch (ctx , mainHandler .eventWorkerPool )
175
+ }
172
176
go watchHandler .SBOMFilteredWatch (ctx , mainHandler .eventWorkerPool )
173
177
go commandWatchHandler .CommandWatch (ctx )
174
178
}
@@ -240,7 +244,7 @@ func (actionHandler *ActionHandler) runCommand(ctx context.Context, sessionObj *
240
244
case apis .TypeScanImages :
241
245
return actionHandler .scanImage (ctx , sessionObj )
242
246
case utils .CommandScanFilteredSBOM :
243
- actionHandler .scanFilteredSBOM (ctx , sessionObj )
247
+ return actionHandler .scanFilteredSBOM (ctx , sessionObj )
244
248
case apis .TypeRunKubescape , apis .TypeRunKubescapeJob :
245
249
return actionHandler .kubescapeScan (ctx )
246
250
case apis .TypeSetKubescapeCronJob :
@@ -368,7 +372,7 @@ func (mainHandler *MainHandler) HandleImageScanningScopedRequest(ctx context.Con
368
372
return
369
373
}
370
374
371
- labels := sessionObj .Command .GetLabels ()
375
+ lbls := sessionObj .Command .GetLabels ()
372
376
fields := sessionObj .Command .GetFieldSelector ()
373
377
namespaces , err := mainHandler .getNamespaces (ctx , sessionObj )
374
378
if err != nil {
@@ -377,12 +381,12 @@ func (mainHandler *MainHandler) HandleImageScanningScopedRequest(ctx context.Con
377
381
return
378
382
}
379
383
380
- info := fmt .Sprintf ("%s: id: '%s', namespaces: '%v', labels: '%v', fieldSelector: '%v'" , sessionObj .Command .CommandName , sessionObj .Command .GetID (), namespaces , labels , fields )
384
+ info := fmt .Sprintf ("%s: id: '%s', namespaces: '%v', labels: '%v', fieldSelector: '%v'" , sessionObj .Command .CommandName , sessionObj .Command .GetID (), namespaces , lbls , fields )
381
385
logger .L ().Info (info )
382
386
sessionObj .Reporter .SendDetails (info , mainHandler .sendReport )
383
387
384
388
listOptions := metav1.ListOptions {
385
- LabelSelector : k8sinterface .SelectorToString (labels ),
389
+ LabelSelector : k8sinterface .SelectorToString (lbls ),
386
390
FieldSelector : k8sinterface .SelectorToString (fields ),
387
391
}
388
392
0 commit comments