Skip to content
This repository has been archived by the owner on Jan 19, 2023. It is now read-only.

Add root node to resource viewer schema #1944

Closed
GuessWhoSamFoo opened this issue Feb 3, 2021 · 2 comments · Fixed by #2343
Closed

Add root node to resource viewer schema #1944

GuessWhoSamFoo opened this issue Feb 3, 2021 · 2 comments · Fixed by #2343
Labels
bug Something isn't working help wanted Extra attention is needed resourceviewer
Projects

Comments

@GuessWhoSamFoo
Copy link
Contributor

GuessWhoSamFoo commented Feb 3, 2021

What steps did you take and what happened:
The resource viewer uses an adjacency list without a root node to generate the graph. As a result, it is possible to generate functionally identical lists that are rendered differently by graphvis. The video below shows a Service (uid: 61e5de4c-963c-4d8d-92e5-74dbad1dc881) that changes positions because it switches between being an edge and a node for the pod.

I suspect this is due to the traversal order from the typed visitors PodsForService and ServicesForPod where the goroutine that wins decides whether a given service is added as an edge or node:

https://github.com/vmware-tanzu/octant/blob/ba9a2da77e7538a5bbe205452e0161dfe1ba98d8/internal/objectvisitor/pod.go#L68
https://github.com/vmware-tanzu/octant/blob/1c57c1ef580f93630e5358814be98872c1f72100/internal/objectvisitor/service.go#L62)

The resource viewer needs to ensure the object in the view is the first object recorded in the adjacency list.

Screencast.2021-02-02.18.18.27.mp4

Initial:

                     "9434ab7a-46cc-49d3-a089-ac9f0663e54c":[...],
                     "simple-app-bd79cf945 pods":[
                        {
                           "node":"53bd91ba-6865-46ee-b678-3dad03d8d7d9",
                           "edge":"explicit"
                        },
                        {
                           "node":"61e5de4c-963c-4d8d-92e5-74dbad1dc881",
                           "edge":"explicit"
                        },
                        {
                           "node":"9434ab7a-46cc-49d3-a089-ac9f0663e54c",
                           "edge":"explicit"
                        },
                        {
                           "node":"9a99ecc8-69c8-44ac-9167-5a3dff21b340",
                           "edge":"explicit"
                        }
                     ]
                  },
                  "nodes":{
                     "53bd91ba-6865-46ee-b678-3dad03d8d7d9":{},
                     "61e5de4c-963c-4d8d-92e5-74dbad1dc881":{},
                     "9434ab7a-46cc-49d3-a089-ac9f0663e54c":{},
                     "9a99ecc8-69c8-44ac-9167-5a3dff21b340":{},
                     "b05ca455-e4d5-40eb-8350-9a2cd4c6d8bd":{},
                     "simple-app-bd79cf945 pods":{}
                  }

Changed:

                     "61e5de4c-963c-4d8d-92e5-74dbad1dc881":[...],
                     "9434ab7a-46cc-49d3-a089-ac9f0663e54c":[...],
                     "simple-app-bd79cf945 pods":[
                        {
                           "node":"53bd91ba-6865-46ee-b678-3dad03d8d7d9",
                           "edge":"explicit"
                        },
                        {
                           "node":"9434ab7a-46cc-49d3-a089-ac9f0663e54c",
                           "edge":"explicit"
                        },
                        {
                           "node":"9a99ecc8-69c8-44ac-9167-5a3dff21b340",
                           "edge":"explicit"
                        }
                     ]
                  },
                  "nodes":{
                     "53bd91ba-6865-46ee-b678-3dad03d8d7d9":{},
                     "61e5de4c-963c-4d8d-92e5-74dbad1dc881":{},
                     "9434ab7a-46cc-49d3-a089-ac9f0663e54c":{},
                     "9a99ecc8-69c8-44ac-9167-5a3dff21b340":{},
                     "b05ca455-e4d5-40eb-8350-9a2cd4c6d8bd":{},
                     "simple-app-bd79cf945 pods":{}
                  }
@GuessWhoSamFoo GuessWhoSamFoo added bug Something isn't working help wanted Extra attention is needed resourceviewer labels Feb 3, 2021
@wwitzel3 wwitzel3 added this to To do in 0.18 via automation Feb 3, 2021
@wwitzel3 wwitzel3 added this to Unsorted in Resource Viewer Feb 3, 2021
@wwitzel3 wwitzel3 added this to Incoming in Product Excellence Feb 17, 2021
@lenriquez
Copy link
Contributor

lenriquez commented Feb 23, 2021

@wwitzel3 I am taking this one :)

@wwitzel3 wwitzel3 moved this from To do to In progress in 0.18 Mar 8, 2021
@lenriquez
Copy link
Contributor

Environment Replication

To replicate this issue the context "gke_cnabu-wwitzel3_us-central1-c_octant-dev-cluster" has used with the namespace mink-system and the pod dataplane
http:https://127.0.0.1:7777/#/workloads/namespace/mink-system/detail/dataplane

Test Race Condition

It was expecting to see the race condition on objectvisitor.go since each typedVisitors use go routines to load the information and are only sync on the function level on not on the objectVisitior level

Sidenote: These go routines does not seem to be necessary, removing them just increase the loading time by a 100 to 200 ms in the worst case tested where the total time was 15 segs using go routines and 15 segs and 200 ms without them

But removing all the typedVisitors from https://github.com/vmware-tanzu/octant/blob/master/internal/objectvisitor/objectvisitor.go#L89 but NewPod it is still posible to see the change on the diagram

Conclusion race condition test: the problem is not a race condition due to lack of sync on objectvisitot.go

Empty array return by default

After more testing it was posible to see the double rendering is because the first time the dynamic cache return and empty array for the services and others "resources" is still no clear why is this happening

@wwitzel3 wwitzel3 moved this from In progress to To do in 0.18 Mar 18, 2021
@wwitzel3 wwitzel3 added this to To do in 0.19 via automation Mar 22, 2021
@wwitzel3 wwitzel3 removed this from To do in 0.18 Mar 22, 2021
@wwitzel3 wwitzel3 removed this from To do in 0.19 Apr 8, 2021
@wwitzel3 wwitzel3 added this to To do in 0.20 via automation Apr 8, 2021
@wwitzel3 wwitzel3 moved this from Incoming to Groomed in Product Excellence Apr 12, 2021
@lenriquez lenriquez mentioned this issue Apr 12, 2021
6 tasks
Product Excellence automation moved this from Groomed to Done Apr 25, 2021
0.20 automation moved this from To do to Done Apr 25, 2021
@wwitzel3 wwitzel3 removed this from Unsorted in Resource Viewer Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working help wanted Extra attention is needed resourceviewer
Projects
No open projects
0.20
Done
2 participants