From 8d98a0cb99b62314e4afff8b4a06d44fc88144ef Mon Sep 17 00:00:00 2001 From: "omri.s" Date: Mon, 9 Dec 2024 19:06:57 +0200 Subject: [PATCH] fixup --- src/mapper/pkg/kubefinder/kubefinder.go | 13 ++++++++++--- .../pkg/resolvers/schema.helpers.resolvers.go | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/mapper/pkg/kubefinder/kubefinder.go b/src/mapper/pkg/kubefinder/kubefinder.go index 34e91556..6afc5152 100644 --- a/src/mapper/pkg/kubefinder/kubefinder.go +++ b/src/mapper/pkg/kubefinder/kubefinder.go @@ -436,12 +436,18 @@ func (k *KubeFinder) ResolveOtterizeIdentityForService(ctx context.Context, svc return model.OtterizeServiceIdentity{}, false, errors.Wrap(err) } + resolutionData := model.IdentityResolutionData{ + IsService: lo.ToPtr(true), + ExtraInfo: lo.ToPtr("ResolveOtterizeIdentityForService"), + } + if len(pods) == 0 { if ServiceIsAPIServer(svc.Name, svc.Namespace) { return model.OtterizeServiceIdentity{ Name: svc.Name, Namespace: svc.Namespace, KubernetesService: &svc.Name, + ResolutionData: &resolutionData, }, true, nil } @@ -463,9 +469,10 @@ func (k *KubeFinder) ResolveOtterizeIdentityForService(ctx context.Context, svc } dstSvcIdentity := model.OtterizeServiceIdentity{ - Name: dstService.Name, - Namespace: pod.Namespace, - Labels: PodLabelsToOtterizeLabels(&pod), + Name: dstService.Name, + Namespace: pod.Namespace, + Labels: PodLabelsToOtterizeLabels(&pod), + ResolutionData: &resolutionData, } if dstService.OwnerObject != nil { diff --git a/src/mapper/pkg/resolvers/schema.helpers.resolvers.go b/src/mapper/pkg/resolvers/schema.helpers.resolvers.go index ac5ef896..53e9c347 100644 --- a/src/mapper/pkg/resolvers/schema.helpers.resolvers.go +++ b/src/mapper/pkg/resolvers/schema.helpers.resolvers.go @@ -147,6 +147,8 @@ func (r *Resolver) addSocketScanServiceIntent(ctx context.Context, srcSvcIdentit if !ok { return nil } + dstSvcIdentity.ResolutionData.Host = lo.ToPtr(dest.Destination) + dstSvcIdentity.ResolutionData.Port = dest.DestinationPort intent := model.Intent{ Client: &srcSvcIdentity,