|
| 1 | +@startuml |
| 2 | +'https://plantuml.com/sequence-diagram |
| 3 | + |
| 4 | +autonumber |
| 5 | + |
| 6 | +actor User |
| 7 | +participant limactl |
| 8 | +participant "lima hostagent" |
| 9 | +participant qemu |
| 10 | +participant "guest os" |
| 11 | +participant "lima guestagent" |
| 12 | +participant nerdctl |
| 13 | + |
| 14 | +== start == |
| 15 | + |
| 16 | +User -> limactl: start |
| 17 | +activate limactl |
| 18 | +limactl -> "lima hostagent": launch host agent |
| 19 | +activate "lima hostagent" |
| 20 | +deactivate limactl |
| 21 | +"lima hostagent" -> "lima hostagent": find free ports |
| 22 | +"lima hostagent" -> "lima hostagent": generate cloud-init data & CD-ROM image |
| 23 | +"lima hostagent" -> "lima hostagent": generate QEMU command line |
| 24 | +"lima hostagent" -> "lima hostagent": set up port forwarding |
| 25 | +"lima hostagent" -> qemu: start |
| 26 | +activate qemu |
| 27 | +qemu -> "guest os": boot |
| 28 | +activate "guest os" |
| 29 | +"guest os" -> "guest os": run setup commands from CD-ROM |
| 30 | +"guest os" -> "lima guestagent": start |
| 31 | +activate "lima guestagent" |
| 32 | +"lima hostagent" -> "guest os": set up sshfs mounts |
| 33 | +"lima hostagent" -> "guest os": set up socket forwarding with SSH |
| 34 | +loop periodically |
| 35 | +"lima guestagent" -> "guest os": read /proc/net/tcp* and iptables |
| 36 | +end loop |
| 37 | +loop periodically |
| 38 | +"lima hostagent" -> "lima guestagent": connect to guest agent (query info) |
| 39 | +"lima guestagent" -> "lima hostagent": IP/port pairs (from /proc/net/tcp* and iptables) |
| 40 | +"lima hostagent" -> "lima guestagent": subscribe to port add/remove events |
| 41 | +"lima guestagent" -> "lima hostagent": (ongoing) return port add/remove events |
| 42 | +end loop |
| 43 | +"lima hostagent" -> "guest os": query for requirements/boot status/readiness probes |
| 44 | + |
| 45 | +== command execution == |
| 46 | + |
| 47 | +User -> limactl: shell "command" |
| 48 | +activate limactl |
| 49 | +limactl -> "guest os": ssh "command" |
| 50 | +"guest os" -> limactl: command output |
| 51 | +limactl -> User: command output |
| 52 | +deactivate limactl |
| 53 | + |
| 54 | +== nerdctl run == |
| 55 | + |
| 56 | +User -> limactl: "nerdctl run" |
| 57 | +activate limactl |
| 58 | +limactl -> "guest os": ssh "nerdctl run" |
| 59 | +"guest os" -> nerdctl: run container |
| 60 | +activate nerdctl |
| 61 | +loop periodically |
| 62 | +"lima guestagent" -> "guest os": read /proc/net/tcp* and iptables |
| 63 | +end loop |
| 64 | +loop periodically |
| 65 | +"lima hostagent" -> "lima guestagent": query events |
| 66 | +"lima guestagent" -> "lima hostagent": return port add/remove events |
| 67 | +"lima hostagent" -> "lima hostagent": set up new port forwarding |
| 68 | +end loop |
| 69 | +nerdctl -> nerdctl: container exits |
| 70 | +nerdctl -> limactl: container output |
| 71 | +deactivate nerdctl |
| 72 | +limactl -> User: container output |
| 73 | +deactivate limactl |
| 74 | +loop periodically |
| 75 | +"lima guestagent" -> "guest os": read /proc/net/tcp* and iptables |
| 76 | +end loop |
| 77 | +loop periodically |
| 78 | +"lima hostagent" -> "lima guestagent": query events |
| 79 | +"lima guestagent" -> "lima hostagent": return port add/remove events |
| 80 | +"lima hostagent" -> "lima hostagent": remove old port forwarding |
| 81 | +end loop |
| 82 | + |
| 83 | +== stop == |
| 84 | + |
| 85 | +User -> limactl: stop |
| 86 | +activate limactl |
| 87 | +limactl -> "lima hostagent": SIGINT |
| 88 | +"lima hostagent" -> qemu: ACPI shutdown |
| 89 | +qemu -> "guest os": ACPI shutdown |
| 90 | +"guest os" -> "lima guestagent": SIGTERM |
| 91 | +deactivate "lima guestagent" |
| 92 | +deactivate "guest os" |
| 93 | +"lima hostagent" -> "lima hostagent": wait up to 3 minutes for shutdown |
| 94 | +deactivate qemu |
| 95 | +"lima hostagent" -> limactl: emit exit event |
| 96 | +deactivate "lima hostagent" |
| 97 | +limactl -> User: stopped |
| 98 | +deactivate limactl |
| 99 | +@enduml |
0 commit comments