Documentation
¶
Overview ¶
Package composegraph renders a docker-compose file's or a Kubernetes manifest's dependency graph as a Mermaid flowchart, then hands that off to go-mermaid for SVG/PNG rendering — no headless browser, no Node, no Graphviz.
svg, err := composegraph.Render(src)
The input format is detected automatically. For a compose file, nodes are services; edges come from `depends_on` (labeled with any non-default condition) and `volumes_from`; services sharing a `networks:` entry are grouped into a subgraph. For a Kubernetes manifest, nodes are Deployments/StatefulSets/DaemonSets, Services, Ingresses, ConfigMaps, and Secrets; edges come from ownerReferences, Service selector → workload label matching, Ingress backend → Service name matching, and workload → ConfigMap/Secret references; resources sharing a namespace are grouped into a subgraph.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Render ¶
Render parses a docker-compose or Kubernetes manifest YAML document and renders its dependency graph straight to SVG via go-mermaid. opts are passed through to mermaid.Render (theme, padding, spacing, ...).
func RenderMerged ¶ added in v0.1.1
RenderMerged is like ToMermaidMerged but renders straight to SVG.
func ToMermaid ¶
ToMermaid parses a docker-compose or Kubernetes manifest YAML document and returns the equivalent Mermaid flowchart source.
func ToMermaidMerged ¶ added in v0.1.1
ToMermaidMerged merges two or more docker-compose documents — the docker-compose.yml + docker-compose.override.yml pattern — and returns the Mermaid flowchart source for the combined graph. See [mergeComposeFiles] in compose.go for exactly what "merge" means here.
Kubernetes manifests don't need this: ToMermaid already reads a `---`-separated multi-document stream directly, so concatenating files is enough.
Types ¶
type Edge ¶
type Edge struct {
From, To string
// Label is shown on the edge; empty for a plain relationship.
Label string
}
Edge is a directed relationship between two nodes.
type Graph ¶
Graph is the dependency graph extracted from an input file. Nodes and Edges are in deterministic order.
func ParseGraph ¶ added in v0.1.2
ParseGraph parses a docker-compose or Kubernetes manifest YAML document into its dependency Graph and reports which format was detected ("compose" or "k8s"). Most callers want ToMermaid or Render; this is for callers that want the structured graph itself — e.g. to report node/ edge counts, or build a different renderer entirely.
type Node ¶
type Node struct {
// Key uniquely identifies the node (used for edge endpoints and as the
// basis for its Mermaid ID); Name is what's displayed.
Key, Name string
// Group is the subgraph this node is clustered under (a compose
// network, or a Kubernetes namespace). Empty if ungrouped.
Group string
// Shape selects the Mermaid shape: "" (rectangle), "stadium", "rounded",
// "hexagon", or "cylinder".
Shape string
}
Node is one resource in the dependency graph.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
composegraph
command
Command composegraph renders a docker-compose file's or a Kubernetes manifest's dependency graph to SVG (or Mermaid source, or PNG).
|
Command composegraph renders a docker-compose file's or a Kubernetes manifest's dependency graph to SVG (or Mermaid source, or PNG). |