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

Allow any Node to behave as a Cluster #34

Open
ringods opened this issue Feb 22, 2020 · 6 comments
Open

Allow any Node to behave as a Cluster #34

ringods opened this issue Feb 22, 2020 · 6 comments
Labels
kind/feature New feature or request question Further information is requested

Comments

@ringods
Copy link

ringods commented Feb 22, 2020

In the diagrams library, there is a distinction between Clusters and Nodes. A node is a single entity, while a cluster is to group things. As an improvement, I would like to use any Node defined in the libraries as a Cluster too.

Let me elaborate based on the AWS VPC architecture diagram:

VPC Design

The VPC (diagrams.aws.network.VPC) is the outer entity here, but drawn as a cluster in which other entities can be placed. In the image, you see Subnets, Network ACLs, Elastic IPs nested within each other.

In diagrams code, this could be written as:

from diagrams.aws.network import VPC
from diagrams.aws.compute import EC2

with VPC("production") as prodVPC:
   EC2("bastion")

If each node could be used as a cluster too, it would immediately solve #17. 😉

@mingrammer
Copy link
Owner

mingrammer commented Feb 22, 2020

This would be a great feature. But I have no ideas about how to represent the group container with tab icons like VPC container in your diagram.

Do you know any options for adding a tab image to a subgraph of Graphviz?

@mingrammer mingrammer added kind/feature New feature or request question Further information is requested labels Feb 23, 2020
@aaronsteers
Copy link
Contributor

I was thinking similarly as OP in regards to wanting nodes such as VPC to also be containers - I'm not sure how to do this in Graphviz though.

I'm curious also if this could be broken out into two phases:

1: If a node is used as a cluster, it "just works" as a container and perhaps uses some text-only representation of it's status as a "VPC". For the code sample above, it might be as simple as production (VPC) or 'production' VPC. (Downside of this step in the implementation is that the cluster view loses the special icons/symbols when used as a cluster. When not used as a cluster, it would work identical as today.)
2: Later on, when a solution is found for rendering the image on top of the rectangle, this could replace or be added in addition to the text VPC description on the container node.

Something like this interesting? In my opinion, I'd rather be labeling my clusters as 'VPC's if that's what they are, rather than using a generic cluster object.

@clayms
Copy link

clayms commented Nov 6, 2020

possible hacks to get the approximate results you are after

#279 (comment)
#181 (comment)

@aaronsteers
Copy link
Contributor

Thanks, @clayms. the comment on #279 seems very close to what I was looking for. Ideally, this would be a property of the cluster instead of having to declare the additional minified node. Very close though, and the link to #90 also looks like it's heading in the same direction.

@bkmeneguello
Copy link

@ringods

The #407 is doing that, not the theme part, but allowing any Node to be a Cluster (actually, it makes the Cluster class just an alias of Node)

@aaronsteers
Copy link
Contributor

I just took a look at #407 and WOW - I love it. Exactly what I was hoping for, personally.

@mingrammer mingrammer pinned this issue Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants