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

Command to display kuadrant topology #102

Open
eguzki opened this issue Dec 13, 2024 · 10 comments
Open

Command to display kuadrant topology #102

eguzki opened this issue Dec 13, 2024 · 10 comments
Labels
enhancement New feature or request

Comments

@eguzki
Copy link
Collaborator

eguzki commented Dec 13, 2024

Is your feature request related to a problem? Please describe.
I'm always frustrated when my kuadrant policies do not work as expected and I need to check all policies targetRefs and route's parentRefs to verify they are correct. I want visual verification.

Describe the solution you'd like
UI to read the topology created with Gateway API resources and kuadrant policies. This UI can be terminal based UI or some external GUI system existing in linux (debian based distributions or Fedora) and macOS systems. The tool should continually watch the topology for changes. Interacting with the topology is somewhat out of scope.

Describe alternatives you've considered

Additional context
Add any other context or screenshots about the feature request here.

@eguzki eguzki added the enhancement New feature or request label Dec 13, 2024
@eguzki
Copy link
Collaborator Author

eguzki commented Dec 13, 2024

@jasonmadigan I would love your thoughts about this. If this does not make sense, feel free to say so.

@eguzki
Copy link
Collaborator Author

eguzki commented Dec 13, 2024

cc @trepel

@jasonmadigan
Copy link
Member

Nice, I like this idea - I thought about something similar a while back, but sort of shied away from a cli as I thought maybe a large enough DAG would be really hard to render in a CLI. Perhaps instead of visualisation though, the CLI could focus on problem finding instead? e.g. missing policies, broken targetRefs etc.

One other thought, I did some hacking recently (please ignore the code) for a standalone policy-machinery web-UI that could be used on Kube - pushed an early version of it here: Kuadrant/react-policy-topology#7

@eguzki
Copy link
Collaborator Author

eguzki commented Dec 17, 2024

GUI

  • Cons: External application, run by the CLI... OS dependency
  • Pro: no need to "print".

Terminal based UI (ASCII [ART])

  • Cons: Read the DOT format (OR build the topology in memory) and draw the graph using asciiART library.
  • Pro: no need to integrate with external app, only with a external library

We can have both!! Terminal based UI and external APP

Common

  • Generation of the topology:
    • Build by the CLI (build the topology in memory). Would be required if more advanced interaction with the graph is implemented (like inspecting the topology nodes)
    • re-use existing graph in a configmap with DOT format. Probably better for starting.

@jasonmadigan
Copy link
Member

Like the idea of both!

@eguzki
Copy link
Collaborator Author

eguzki commented Dec 19, 2024

Discarding AsciiART.. the text of the resources is not readable

@eguzki
Copy link
Collaborator Author

eguzki commented Dec 19, 2024

The most promising tool to create ASCII graphviz graphs is http://search.cpan.org/~tels/Graph-Easy/bin/graph-easy (https://github.com/ironcamel/Graph-Easy). No activity in the last 14 years.

I tried it and fails with some unsupported DOT attribute:

❯ graph-easy /home/eguzki/tmp/topology.dot
Error in attribute: 'note' is not a valid shape for a node at /usr/bin/graph-easy line 90

The graph in dot format being

digraph  {
	
	n5[label="AuthConfig\nkuadrant-system/e2db39952dd3bc72e152330a2eb15abbd9675c7ac6b54a1a292f07f25f09f138",shape="ellipse"];
	n4[label="Authorino\nkuadrant-system/authorino",shape="ellipse"];
	n14[label="AuthPolicy\ndefault/toystore-authn",shape="note",style="dashed"];
	n2[label="ConfigMap\nkuadrant-system/topology",shape="ellipse"];
	n6[label="EnvoyFilter\ngateway-system/kuadrant-auth-kuadrant-ingressgateway",shape="ellipse"];
	n10[fillcolor="#e5e5e5",label="Gateway\ngateway-system/kuadrant-ingressgateway",shape="box",style="filled"];
	n12[fillcolor="#e5e5e5",label="Listener\ngateway-system/kuadrant-ingressgateway#http",shape="box",style="filled"];
	n9[fillcolor="#e5e5e5",label="GatewayClass\nistio",shape="box",style="filled"];
	n8[fillcolor="#e5e5e5",label="GatewayClass\nistio-remote",shape="box",style="filled"];
	n11[fillcolor="#e5e5e5",label="HTTPRoute\ndefault/toystore",shape="box",style="filled"];
	n13[fillcolor="#e5e5e5",label="HTTPRouteRule\ndefault/toystore#rule-1",shape="box",style="filled"];
	n1[label="Kuadrant\nkuadrant-system/kuadrant",shape="ellipse"];
	n3[label="Limitador\nkuadrant-system/limitador",shape="ellipse"];
	n7[label="WasmPlugin\ngateway-system/kuadrant-kuadrant-ingressgateway",shape="ellipse"];
	n14->n11[comment="Policy -> Target",style="dashed"];
	n10->n6[comment="Gateway -> EnvoyFilter"];
	n10->n7[comment="Gateway -> WasmPlugin"];
	n10->n12[comment="Gateway -> Listener"];
	n12->n11[comment="Listener -> HTTPRoute"];
	n9->n10[comment="GatewayClass -> Gateway"];
	n11->n13[comment="HTTPRoute -> HTTPRouteRule"];
	n13->n5[comment="HTTPRouteRule -> AuthConfig"];
	n1->n8[comment="Kuadrant -> GatewayClass"];
	n1->n9[comment="Kuadrant -> GatewayClass"];
	n1->n3[comment="Kuadrant -> Limitador"];
	n1->n4[comment="Kuadrant -> Authorino"];
	
}

@eguzki
Copy link
Collaborator Author

eguzki commented Dec 19, 2024

Discarding ascii visualization for now #105

@eguzki
Copy link
Collaborator Author

eguzki commented Dec 19, 2024

Next steps:

  • --watch optional flag to start listening to the cluster updates and update the topology whenever this changes in the cluster.

In the future:

  • Smart error reporting. Could be as part of this kuadrantctl topology command or maybe something else.

@trepel
Copy link
Contributor

trepel commented Dec 20, 2024

Current implementation (#104) is good enough to be merged IMO. A few suggestions to improve:

  • use the same format to describe the topology command as used for the other commands in README.md
  • output flag is required but i think it would be better if it is only required if dot flag is not used
  • the DOT output file is not checked for extension which is inconsistent with SVG output file. Make it consistent - either implement .dot extension check or remove the .svg extension check. I would slightly prefer latter to former.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants