Skip to main content
When two diagrams describe the same components, keep their shared IDs and labels in one authored inventory, then generate each view’s diagram document. Give each view its own relationship rules. This avoids renaming a component in one picture while leaving another picture behind. 中文. The runnable shared-inventory example implements this pattern with a Kubernetes request view and an ownership view. Its small Python generator belongs to the example repository; iso-topology itself does not provide automatic synchronization between arbitrary diagram files or import a live cluster.

Separate shared identity from view-specific relationships

The Kubernetes tutorial explains why a Service-to-Pod request edge differs from a ReplicaSet-to-Pod ownership edge. The two views share the same conceptual Pods but answer different questions. The example’s inventory.json owns the Pod IDs, labels, scope and state. scripts/views.py supplies the fixed objects, edges and placement for each view. It generates two JSON diagram documents and a scope note; the renderer then produces two SVGs. The inventory is an example-specific format. The generated files are diagram documents, not Kubernetes manifests. Keep scope notes separate from DSL fields that the renderer does not recognize.

Run the example

Clone the example repository. Use Python 3.10 or later and the renderer revision pinned in its shared-inventory workflow. Then run:
The generator uses only Python’s standard library. --check detects missing or changed generated models without writing. The render script regenerates the models, validates both, and redraws the SVGs. Rename a Pod label in multi-view/inventory.json, keeping its ID. Re-run the render script and review the inventory, both generated documents, and both SVGs together. If there are fewer than three Pods, add another with a unique ID. The compact example deliberately accepts one to three Pods; this is a limit of its teaching layout, not the renderer.

Review the CI artifact before merging

The example’s workflow tests identity propagation, stale-file detection and invalid IDs. It builds a pinned renderer and publishes a shared-inventory-views artifact with the inventory, generated models, scope note and images. Pull requests do not push generated changes. After a source-only inventory change reaches main, the workflow can commit both updated models and images. Branch protection may reject that bot commit; use the artifact through the repository’s normal review process in that case. This pipeline synchronizes authored inventory → diagram documents → images. It does not synchronize application code or cluster state into the inventory. See diagrams from code for that separate evidence-gathering step.

Choose where the next edit belongs

Editing a generated JSON document directly creates a change the generator will overwrite. If a view needs a reusable rule, change the generator. If you want an independent drawing, copy the document outside the generated directory, then edit the copy in Studio. That copy becomes a new source of truth and no longer follows this inventory automatically. Consistency is also narrower than correctness. The views can agree on a Pod that does not exist in your system. Review actual selectors, ownership and state separately; tests for shared labels cannot establish them. Edit an AI-generated diagram · Choose a diagram format · Publish diagrams If the views describe different points in time, keep their states explicit: current and target architecture.