Skip to content

Commit

Permalink
Merge pull request kubescape#1027 from kubescape/hot-fix-v2.0.181
Browse files Browse the repository at this point in the history
setCloudMetadata only when scanning a cluster
  • Loading branch information
dwertent committed Jan 11, 2023
2 parents c396838 + 9a1cc33 commit 0a57153
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/pkg/policyhandler/handlenotification.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ func (policyHandler *PolicyHandler) CollectResources(policyIdentifier []cautils.
func (policyHandler *PolicyHandler) getResources(policyIdentifier []cautils.PolicyIdentifier, opaSessionObj *cautils.OPASessionObj, scanInfo *cautils.ScanInfo) error {
opaSessionObj.Report.ClusterAPIServerInfo = policyHandler.resourceHandler.GetClusterAPIServerInfo()

setCloudMetadata(opaSessionObj)
// set cloud metadata only when scanning a cluster
if opaSessionObj.Metadata.ScanMetadata.ScanningTarget == reportv2.Cluster {
setCloudMetadata(opaSessionObj)
}

resourcesMap, allResources, ksResources, err := policyHandler.resourceHandler.GetResources(opaSessionObj, &policyIdentifier[0].Designators)
if err != nil {
Expand Down

0 comments on commit 0a57153

Please sign in to comment.