|
2 | 2 | @startuml machinehealthcheck-controller |
3 | 3 |
|
4 | 4 | start; |
5 | | -:Machine Health Check controller; |
| 5 | +:MachineHealthCheck controller; |
6 | 6 | repeat |
7 | | - repeat |
8 | | - :MachineHealthCheck controller enqueues a Reconcile call; |
9 | | - if (Nodes being watched in remote cluster) then (no) |
| 7 | + :MachineHealthCheck controller enqueues a Reconcile call; |
| 8 | + |
| 9 | + if (Nodes being watched in remote cluster?) then (no) |
10 | 10 | :Watch nodes in remote cluster; |
11 | 11 | else (yes) |
12 | 12 | endif |
13 | | - :Find targets: Machines matched by selector plus respective Nodes; |
14 | | - :Health check targets: Determine which Machines require remediation; |
15 | | - repeat while (Remediations are allowed (current unhealthy <= max unhealthy)) is (no) |
16 | | - -> yes; |
17 | | - repeat |
18 | | - if (Target requires remediation) then (yes) |
19 | | - if (Machine is owned by a MachineSet) then (yes) |
20 | | - if (Machine is a Control Plane Machine) then (no) |
21 | | - #LightBlue:Delete Machine; |
22 | | - else (yes) |
| 13 | + |
| 14 | + :Find targets: Machines matched by selector; |
| 15 | + :Update ExpectedMachines and Targets in status; |
| 16 | + |
| 17 | + #LightBlue:Health check targets: Determine healthy/unhealthy machines; |
| 18 | + :Update CurrentHealthy in status; |
| 19 | + |
| 20 | + if (Remediation allowed?\n(conditions in spec.triggerIf met)) then (no) |
| 21 | + :Set RemediationsAllowed = 0; |
| 22 | + #LightBlue:Mark RemediationAllowedCondition as False; |
| 23 | + :Emit RemediationRestricted event; |
| 24 | + else (yes) |
| 25 | + :Calculate RemediationsAllowed count; |
| 26 | + #LightBlue:Mark RemediationAllowedCondition as True; |
| 27 | + |
| 28 | + repeat |
| 29 | + if (Target is unhealthy?) then (yes) |
| 30 | + if (ExternalRemediationTemplate defined?) then (yes) |
| 31 | + if (External remediation request exists?) then (no) |
| 32 | + #LightBlue:Create external remediation request; |
| 33 | + #LightBlue:Set MachineExternallyRemediatedCondition; |
| 34 | + else (yes) |
| 35 | + endif |
| 36 | + else (no) |
| 37 | + if (Machine not in deletion AND\n(OwnerRemediated missing OR completed)?) then (yes) |
| 38 | + #LightBlue:Set MachineOwnerRemediatedCondition to False; |
| 39 | + else (no) |
| 40 | + endif |
23 | 41 | endif |
| 42 | + :Emit MachineMarkedUnhealthy event; |
24 | 43 | else (no) |
| 44 | + if (ExternalRemediationTemplate defined\nAND request exists?) then (yes) |
| 45 | + #LightBlue:Delete external remediation request; |
| 46 | + else (no) |
| 47 | + endif |
25 | 48 | endif |
26 | | - else (no) |
27 | | - endif |
28 | | - repeat while (more Targets) is (yes) |
29 | | - -> no; |
30 | | -repeat while (Targets likely to go unhealthy) is (yes: requeue with minimum |
31 | | - time before timeout as delay) |
| 49 | + repeat while (More targets?) is (yes) |
| 50 | + -> no; |
| 51 | + endif |
| 52 | +repeat while (Any target likely to go unhealthy soon?) is (yes: requeue with\nminimum timeout delay) |
32 | 53 | -> no; |
33 | 54 | stop; |
34 | 55 |
|
|
0 commit comments