Commit 91f8548
committed
Fix Healthy condition not updating from Ironic health data
Four bugs prevented the Healthy condition from working correctly
on provisioned hosts:
1. computeConditions was only called inside the actResult.Dirty()
block. For steady-state provisioned hosts where nothing changes
during reconciliation, conditions were never recomputed. This
meant the Healthy condition (populated from Ironic's health
monitoring API) stayed at its initial Unknown value forever,
since health status changes externally in Ironic and doesn't
trigger state machine transitions.
2. ChooseMicroversion() capped at 1.95, but the Ironic health
field on the Node resource requires microversion 1.109. With a
lower microversion, Ironic does not include the health field in
responses, so GetHealth always returned an empty string and the
Healthy condition was never set. Added HasHealthAPI() feature
detection and bumped ChooseMicroversion() to return 1.109 when
the Ironic endpoint supports it.
3. Empty health from GetHealth (e.g. when the node is not yet
registered) was treated as "unknown" via the default switch
case, overwriting a previously valid Healthy=True on every idle
reconcile. Now empty health means "no data, leave the existing
condition unchanged" — only non-empty values from Ironic update
the condition.
4. conditionsBefore used a slice reference sharing the same backing
array as host.Status.Conditions. In-place modifications by
conditions.Set were visible through both references, making
reflect.DeepEqual always return true. Deep copy the slice before
comparing so condition-only changes trigger a status save.
Also suppress ErrNeedsRegistration log noise in GetHealth, which
fires on every reconcile before the node is registered in Ironic.
Assisted-By: Claude Opus 4.6
Signed-off-by: Jacob Anders <jacob-anders-dev@proton.me>1 parent fb6a6d5 commit 91f8548
5 files changed
Lines changed: 69 additions & 27 deletions
File tree
- internal/controller/metal3.io
- pkg/provisioner/ironic
- clients
Lines changed: 21 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
243 | 252 | | |
244 | 253 | | |
245 | 254 | | |
246 | 255 | | |
247 | | - | |
248 | | - | |
| 256 | + | |
249 | 257 | | |
250 | 258 | | |
251 | 259 | | |
252 | | - | |
253 | 260 | | |
254 | 261 | | |
255 | 262 | | |
| |||
2304 | 2311 | | |
2305 | 2312 | | |
2306 | 2313 | | |
2307 | | - | |
2308 | | - | |
2309 | | - | |
2310 | | - | |
2311 | | - | |
2312 | | - | |
2313 | | - | |
2314 | | - | |
2315 | | - | |
| 2314 | + | |
| 2315 | + | |
| 2316 | + | |
| 2317 | + | |
| 2318 | + | |
| 2319 | + | |
| 2320 | + | |
| 2321 | + | |
| 2322 | + | |
| 2323 | + | |
| 2324 | + | |
2316 | 2325 | | |
2317 | 2326 | | |
2318 | 2327 | | |
| |||
Lines changed: 17 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3187 | 3187 | | |
3188 | 3188 | | |
3189 | 3189 | | |
3190 | | - | |
3191 | | - | |
3192 | | - | |
3193 | | - | |
3194 | | - | |
3195 | | - | |
3196 | 3190 | | |
3197 | 3191 | | |
3198 | 3192 | | |
| |||
3232 | 3226 | | |
3233 | 3227 | | |
3234 | 3228 | | |
| 3229 | + | |
| 3230 | + | |
| 3231 | + | |
| 3232 | + | |
| 3233 | + | |
| 3234 | + | |
| 3235 | + | |
| 3236 | + | |
| 3237 | + | |
| 3238 | + | |
| 3239 | + | |
3235 | 3240 | | |
3236 | 3241 | | |
3237 | 3242 | | |
| |||
3331 | 3336 | | |
3332 | 3337 | | |
3333 | 3338 | | |
3334 | | - | |
3335 | | - | |
| 3339 | + | |
| 3340 | + | |
| 3341 | + | |
| 3342 | + | |
| 3343 | + | |
| 3344 | + | |
3336 | 3345 | | |
3337 | 3346 | | |
3338 | 3347 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
59 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
60 | 69 | | |
61 | 70 | | |
62 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
| |||
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
26 | | - | |
| 25 | + | |
27 | 26 | | |
28 | 27 | | |
29 | 28 | | |
30 | | - | |
| 29 | + | |
31 | 30 | | |
32 | 31 | | |
33 | | - | |
| 32 | + | |
34 | 33 | | |
35 | 34 | | |
36 | 35 | | |
37 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
38 | 51 | | |
39 | 52 | | |
40 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2004 | 2004 | | |
2005 | 2005 | | |
2006 | 2006 | | |
2007 | | - | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
2008 | 2010 | | |
2009 | 2011 | | |
2010 | 2012 | | |
| |||
0 commit comments