diff --git a/mainhandler/handlerequests.go b/mainhandler/handlerequests.go index b2957ee..7b50f7a 100644 --- a/mainhandler/handlerequests.go +++ b/mainhandler/handlerequests.go @@ -405,6 +405,12 @@ func (mainHandler *MainHandler) HandleImageScanningScopedRequest(ctx context.Con continue } + noContainerSlug, _ := instanceID.GetSlug(true) + if ok := slugs[noContainerSlug]; ok { + // container profile already scanned for this workload, skip remaining containers + continue + } + // get container data containerData, err := utils.PodToContainerData(mainHandler.k8sAPI, pod, instanceID, mainHandler.config.ClusterName()) if err != nil { @@ -412,7 +418,6 @@ func (mainHandler *MainHandler) HandleImageScanningScopedRequest(ctx context.Con continue } - noContainerSlug, _ := instanceID.GetSlug(true) if profile := utils.GetContainerProfileForRelevancyScan(ctx, mainHandler.ksStorageClient, noContainerSlug, ns); profile != nil { cmd := utils.GetContainerProfileScanCommand(profile, pod) diff --git a/utils/containerprofile.go b/utils/containerprofile.go index 502d39f..dd375cf 100644 --- a/utils/containerprofile.go +++ b/utils/containerprofile.go @@ -26,6 +26,9 @@ func SkipContainerProfile(annotations map[string]string) (bool, error) { return true, fmt.Errorf("no annotations") // skip } + if _, ok := annotations[helpersv1.ReportSeriesIdMetadataKey]; ok { + return true, nil // skip TS profiles + } if status, ok := annotations[helpersv1.StatusMetadataKey]; ok && !slices.Contains(ann, status) { return true, fmt.Errorf("invalid status") }