Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web view #18

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

Web view #18

wants to merge 5 commits into from

Conversation

janezkenda
Copy link

@janezkenda janezkenda commented Jul 18, 2019

Web view

Generates a svg image using viz.js, adds an option to pan it (using svg-pan-zoom library), and opens the graph in a browser.
Library was included in a similar way as in svgpan in pprof.

$ kubectl get sa,roles,rolebindings,clusterroles,clusterrolebindings --all-namespaces -o json | rback -web

Other changes

  • Fixed go module path, so it is go-gettable with GO111MODULE=on
  • Added GOOS=darwin and GOARCH=amd64 for macOS build

@mhausenblas
Copy link
Member

Thanks for this draft PR, much appreciate your contributions. Now, in general, before creating an PR it's a good practice to raise an issue to describe what you want to achieve. This issue allows us then to discuss the scope and validity of a feature. Like, in this case, I'm somewhat on the fence: on the one hand I like the feature a lot and think it would lead to a better UX, on the other hand it works against the do-one-thing-and-do-it-well nature. @luksa what are your thoughts?

@luksa
Copy link
Collaborator

luksa commented Jul 18, 2019

I was actually the one who suggested adding the option of opening the graph in the browser directly. But I expected this to be done as part of the kubectl-rback plugin, not in rback directly (exactly because of the do-one-thing philosophy).

Also, my idea was to remove the need to have graphviz installed and instead have the plugin just open the .dot file in http://magjac.com/graphviz-visual-editor/, since that editor has some nice interactive features (for our use-case I would remove the editor pane and show just the graph). The customized version of graphviz-visual-editor could also be integrated into the plugin itself, so the RBAC data doesn't leave the local machine.

I'm on vacation, so I can't do a proper review of this until next month.

@janezkenda
Copy link
Author

janezkenda commented Jul 19, 2019

Graph created with the example rules is too large to be used with http://magjac.com/graphviz-visual-editor/?dot=... - this results in 414 - URI too long error.

I made some modifications to the code. Graphs are rendered with viz.js (graphviz built using emscripten) - same library graphviz-visual-editor is using. Panning capabilities are added in the same way as before. The end result is similar as the visual editor with only the graph shown. The end result does not have any interactive features, but the trade-off is panning from the svg-pan-zoom, and a much smaller included library.

I also removed PNG export option, since it is not needed for the web view.

The changed feature is still a part of the rback binary, and not a part of the kubectl plugin.

Edit: I also tried to use dagrejs for rendering, but I did not manage to render any of the example graphs using it.

@janezkenda janezkenda changed the title PNG export, web view Web view Jul 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants