Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
omris94 committed Dec 9, 2024
1 parent 37b4de1 commit 8d98a0c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/mapper/pkg/kubefinder/kubefinder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions src/mapper/pkg/resolvers/schema.helpers.resolvers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 8d98a0c

Please sign in to comment.