Guides / Access and automation
Describe a network as a diagram
You can build a network by drawing it, on the console's canvas or in a YAML file. A Diagram is infrastructure drawn as blocks with typed ports. A controller creates the objects it describes, and when you delete a block it removes that object too.
Draw it in the console
- Open the Canvas (the second icon in the activity bar), choose New and name the diagram.
- Drag blocks from the palette onto the canvas. Categories collapse.
- Drag from an output dot to an input dot to connect them. Ports only connect when their types match; the editor says why when they do not.
- Select a block to set its name and values. The name becomes the name of the object it creates.
- Save. Switch to Monitor to watch status LEDs and live values.
Write it as a file
This diagram makes a VPC named lan and a DNS service named names on it, with the zone set from a string block.
apiVersion: flow.etorm.com/v1alpha1
kind: Diagram
metadata: {name: net}
spec:
blocks:
- {id: z, type: string, name: zone, x: 40, y: 40, params: {value: corp.test}}
- {id: v, type: vpc, name: lan, x: 330, y: 120, params: {}}
- {id: n, type: dns, name: names,x: 640, y: 120, params: {}}
links:
- {from: {block: v, port: vpc}, to: {block: n, port: vpc}}
- {from: {block: z, port: value}, to: {block: n, port: zone}}
Export on the canvas gives you a manifest like this one, and Import loads one back.
How ports are named
A block's inputs are the resource's spec fields (cidr, publicKey, leaseSeconds). Its outputs are its status fields (ipv6Prefix, ipv6Address, macAddress). The output that refers to the object itself is named after its kind (vpc, account). Services also report address, and every resource block has phase. The full block list is on the Canvas page.
Control what a diagram changes
- Set
spec.paused: trueto validate the diagram and see a plan instatus.planwithout changing anything. - With
spec.deletePolicy: Orphan, the diagram releases objects instead of deleting them when blocks or the diagram go away. - A diagram can do only what its author may do. Creating a block needs the right to create that kind in the project.
- A diagram never takes over an existing object with the same name that it did not create. The block reports
NameInUseinstead. - For repeated parts, use a module with
countorforEach. It creates one instance per item.
Read the diagram's phase, and the list of issues when it is Invalid.
kubectl ... get diagram net -o jsonpath='{.status.phase}' # Invalid | Progressing | Ready | Failed | Paused
kubectl ... get diagram net -o jsonpath='{.status.issues}' # why it is Invalid
Clean up
kubectl ... delete diagram net
This deletes everything the diagram built. To keep the objects, set spec.deletePolicy: Orphan first. Delete things safely has the rest of the order.
Next
Canvas lists every block with its ports. When a block does not become Ready, see Find out why something stays Pending.