skydive icon indicating copy to clipboard operation
skydive copied to clipboard

gremlin: shortestPathTo from pod to lookback failing

Open hunchback opened this issue 5 years ago • 4 comments

The context of this is connecting k8s.pod to flows by using the following sequance:

k8s.pod --> k8s.container --> docker.container --> docker.namespace --> lo (flows)

Using Gremlin I would like to be able to highlight the path from a pod to its' respective lo device.

When attempting to do so I was able to get path when providing the lo TID:

g.V().Has("Type", "pod", "Name", "wordpress-7bdfd5557c-svxpg").ShortestPathTo(Metadata("TID", "a4d94097-0920-5ce1-6b13-c1ba87b183d6"))

Yielding:

image

But when I try to provide a generic gremlin:

g.V().Has("Type", "pod", "Name", "wordpress-7bdfd5557c-svxpg").ShortestPathTo(Metadata("Name", "lo"))

I get following (yellow marking the path I was expecting ...):

image

When running as the filter I notice two issues: (1) path uses the k8s.node --> host association (I would like to mark that this should not be used) (2) query returns a non-stable result, even when the actual topology is stable

image

hunchback avatar Mar 27 '19 14:03 hunchback

The reason is that shortestpath doesn't support n to n path but provide only 1 to 1 path. We need to work on a fix.

safchain avatar Mar 27 '19 14:03 safchain

So do we want to change ShortestPathTo() or add a new gremlin step ?

hunchback avatar Mar 27 '19 14:03 hunchback

I think can handle the n to n thing as the current API leads to think that is possible to do n to n.

safchain avatar Mar 27 '19 14:03 safchain

ok ... any guidance in case I want to attempt to extend it myself ?

hunchback avatar Mar 27 '19 14:03 hunchback