Skip to content

Commit b7acbff

Browse files
authored
[Developer Documentation] Illustrate the Agent upgrade process (#2858)
* init checkin * Update comment * Change user to actor * Resolve TODOs
1 parent 729636a commit b7acbff

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

docs/upgrades.md

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
## Agent Upgrades
2+
3+
### Communications amongst components
4+
The following sequence diagram illustrates the process of upgrading a
5+
Fleet-managed Agent. The diagram focusses on the communications that occur
6+
amongst the various components involved in the upgrade process.
7+
8+
This diagram is accurate as of version `8.9.0` of every component shown.
9+
10+
```mermaid
11+
sequenceDiagram
12+
actor U as User
13+
participant UI as Fleet UI
14+
participant ES
15+
participant FS as Fleet Server
16+
participant A as Agent
17+
participant UW as Upgrade Watcher
18+
participant UM as Upgrader Marker
19+
20+
U->>UI: Initiate upgrade
21+
UI->>ES: Update Agent doc in `.fleet-agents`<br />set `upgrade_started_at`
22+
UI->>UI: Show Agent status as "updating"
23+
UI->>ES: Create new doc in `.fleet-actions` for `UPGRADE` action
24+
A->>FS: Check-in request
25+
FS->>ES: Read pending actions from .fleet-actions
26+
FS->>A: Check-in response
27+
A->>A: Queue upgrade action
28+
alt If upgrade start fails
29+
A->>FS: Ack failed upgrade
30+
FS->>ES: Update Agent doc in `.fleet-agents`<br />set `upgrade_status` = "failed"
31+
UI->>UI: Agent status remains as "updating" (bug)
32+
else
33+
opt If previous upgrades found
34+
A->>FS: Ack previous upgrades
35+
A->>A: Remove previous upgrades from queue
36+
end
37+
A->>A: Download new Agent artifact
38+
A->>A: Extract new Agent artifact
39+
A->>A: Replace current Agent artifact with new one
40+
A->>UM: Create
41+
A->>UW: Start
42+
A->>A: Rexec to start new Agent artifact
43+
A->>FS: Ack successful upgrade
44+
UW->>UM: Remove
45+
FS->>ES: Write successful ack in `.fleet-actions-results`
46+
FS->>ES: Update Agent doc in `.fleet-agents`<br />set `upgrade_status` = null<br />`upgraded_at` = <now><br />`upgrade_started_at` = null
47+
UI->>UI: Show Agent status as "healthy"
48+
end
49+
opt Rollback
50+
UW->>A: Start
51+
A->>FS: Ack failed upgrade
52+
FS->>ES: Update Agent doc in `.fleet-agents`<br />set `upgrade_status` = null<br />`upgraded_at = <now>
53+
UI->>UI: Show Agent status as "healthy"
54+
UW->>UM: Remove
55+
end
56+
```

0 commit comments

Comments
 (0)