Commit f068d1c
✨ Add support for checking Machine conditions in MachineHealthCheck (#12827)
* Add support for checking Machine conditions in MachineHealthCheck
MachineHealthCheck currently only allows checking Node conditions to
validate if a machine is healthy. However, machine conditions capture
conditions that do not exist on nodes, for example, control plane node
conditions such as EtcdPodHealthy, SchedulerPodHealthy that can indicate
if a controlplane machine has been created correctly.
Adding support for Machine conditions enables us to perform remediation
during control plane upgrades.
This PR introduces a new field as part of the MachineHealthCheckChecks:
- `UnhealthyMachineConditions`
This will mirror the behavior of `UnhealthyNodeConditions` but the
MachineHealthCheck controller will instead check the machine conditions.
This reimplements and extends earlier work originally proposed in a previous PR 12275.
Co-authored-by: Justin Miron <[email protected]>
Signed-off-by: Furkat Gofurov <[email protected]>
* Fix PR check Markdown links CI
Signed-off-by: Furkat Gofurov <[email protected]>
* Address review comments
Signed-off-by: Furkat Gofurov <[email protected]>
* Address review comments: rework node and machine checks in needsRemediation() method
If both a node condition and machine condition are unhealthy, pick one reason but
combine all the messages
Signed-off-by: Furkat Gofurov <[email protected]>
* Address Stefan comments (conversion)
Signed-off-by: Furkat Gofurov <[email protected]>
* Address review comments Fabrizio (mhc target, mhc controller code)
Refactors `needsRemediation`, specifically following changes were made:
- Move machine condition evaluation to always execute first, regardless of node state
- Ensure machine conditions are checked in ALL scenarios:
* When node is missing (t.nodeMissing)
* When node hasn't appeared yet (t.Node == nil)
* When node exists (t.Node != nil)
- Consistently merge node and machine condition messages in all failure scenarios
- Maintain backward compatibility with existing condition message formats
- Use appropriate condition reasons based on which conditions are unhealthy
Signed-off-by: Furkat Gofurov <[email protected]>
* Fix event message to reflect both machine and node condition checking
Signed-off-by: Furkat Gofurov <[email protected]>
* Simplify `needsRemediation` function further by using two sub functions: one for machineChecks and the other for nodeChecks.
Another benefit of this code struct, is that condition management is implemented only in one place.
Co-authored-by: Fabrizio Pandini
Signed-off-by: Furkat Gofurov <[email protected]>
* Add CEL validation to prevent disallowed UnhealthyMachineCondition types
Signed-off-by: Furkat Gofurov <[email protected]>
* Clarify `UnhealthyMachineConditionV1Beta1Reason` precedence over node reasons
Signed-off-by: Furkat Gofurov <[email protected]>
* Address review comments (Stefan)
Signed-off-by: Furkat Gofurov <[email protected]>
---------
Signed-off-by: Furkat Gofurov <[email protected]>
Co-authored-by: Justin Miron <[email protected]>1 parent 06aae54 commit f068d1c
File tree
33 files changed
+1755
-116
lines changed- api/core
- v1beta1
- v1beta2
- config/crd/bases
- docs/book/src/tasks
- automated-machine-management
- experimental-features/cluster-class
- exp/topology
- desiredstate
- scope
- internal
- api/core
- v1alpha3
- v1alpha4
- controllers
- machinehealthcheck
- topology/cluster
- webhooks
- test
- test
- e2e/data/infrastructure-docker/main
- infrastructure/docker/templates
- util/test/builder
33 files changed
+1755
-116
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
76 | 81 | | |
77 | 82 | | |
78 | 83 | | |
| |||
145 | 150 | | |
146 | 151 | | |
147 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
148 | 158 | | |
149 | 159 | | |
150 | 160 | | |
| |||
513 | 523 | | |
514 | 524 | | |
515 | 525 | | |
| 526 | + | |
| 527 | + | |
516 | 528 | | |
517 | 529 | | |
518 | 530 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
725 | 725 | | |
726 | 726 | | |
727 | 727 | | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
728 | 738 | | |
729 | 739 | | |
730 | 740 | | |
| |||
975 | 985 | | |
976 | 986 | | |
977 | 987 | | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
978 | 998 | | |
979 | 999 | | |
980 | 1000 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
284 | 294 | | |
285 | 295 | | |
286 | 296 | | |
| |||
542 | 552 | | |
543 | 553 | | |
544 | 554 | | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
545 | 565 | | |
546 | 566 | | |
547 | 567 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
290 | 294 | | |
291 | 295 | | |
292 | 296 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
114 | 124 | | |
115 | 125 | | |
116 | 126 | | |
| |||
227 | 237 | | |
228 | 238 | | |
229 | 239 | | |
230 | | - | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
231 | 267 | | |
232 | 268 | | |
233 | 269 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
160 | 165 | | |
161 | 166 | | |
162 | 167 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments