Open arsoni20 opened 1 year ago
Hi @arsoni20,
Currently, I'm doing the following:
Here's the code I'm using:
from diagrams import Cluster, Diagram
from diagrams.k8s.compute import Pod, StatefulSet
from diagrams.k8s.network import Service
from diagrams.k8s.storage import PV, PVC, StorageClass
from graphviz2drawio import graphviz2drawio
filename = "my_diagram"
with Diagram("Stateful Architecture", show=False, outformat=["dot"], filename=filename):
with Cluster("Apps"):
svc = Service("svc")
sts = StatefulSet("sts")
apps = []
for _ in range(3):
pod = Pod("pod")
pvc = PVC("pvc")
pod - sts - pvc
apps.append(svc >> pod >> pvc)
apps << PV("pv") << StorageClass("sc")
xml = graphviz2drawio.convert(f"{filename}.dot")
with open(f"{filename}.xml", "w") as xml_file:
xml_file.write(xml)
If you have any improvements or suggestions, please share!
@matzmz
when I export it to xml and open it in draw.io, I dont see the cluster box. Is there a way to retain the box for the cluster also?
@ravening Same issue here, the box is not drawn.
First off, thanks for creating this amazing package, it makes idea to diagram journey so simple, without me fiddling with edges in the initial phases of incubation. I was wondering if there is a way we can export the image as XML so it can be edited in draw.io ?