controller: add precedence-aware setPoolDegraded helper#112
Merged
Conversation
alicefr
reviewed
Jul 16, 2026
| // RolloutHalted from overwriting NodeConflict. Unknown reasons get precedence | ||
| // 0 (map zero-value), so they silently no-op. Keep poolDegradedPrecedence in | ||
| // sync with the API constants. | ||
| func setPoolDegraded(pool *bootcv1alpha1.BootcNodePool, reason, message string) { |
Collaborator
There was a problem hiding this comment.
We don't have unit tests for such helpers functions yet, but it might be helpful to add some. The function is relatively straightforward so up to you. But it might be good to introduce it as a good habit
Collaborator
Author
There was a problem hiding this comment.
We do have a few function-level unit tests though I skipped adding one for this one because it just didn't seem worth it for the complexity.
Collaborator
|
Looks good to me but you need to rebase :) |
It's annoying right now how there's unclear precedence rules on the PoolDegraded reasons. Rather than trying to encode this in the imperative businesss logic, let's add a clear precedence map and helper where the source of truth for this stuff lives. Of course, the larger issue there is that it's even possible to have multiple degraded reasons coexist, which suggests we should actually split out into more condition types. Otherwise, sysadmins have to fix one, and then wait for the next reconcile, fix the next issue, etc... But at the same time... fully splitting them out would be quite a lot, and I think in practice it'll be quite rare to have a pool with more than e.g. 2 categories of bad things going on. I also think once we start emitting Events, that will help a lot with this visibility issue. So the API complexity of multiple condition types might not be worth it. Assisted-by: Pi (Claude Opus 4.6) Signed-off-by: Jonathan Lebon <jonathan@jlebon.com>
alicefr
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It's annoying right now how there's unclear precedence rules on the
PoolDegraded reasons. Rather than trying to encode this in the
imperative businesss logic, let's add a clear precedence map and helper
where the source of truth for this stuff lives.
Of course, the larger issue there is that it's even possible to have
multiple degraded reasons coexist, which suggests we should actually
split out into more condition types. Otherwise, sysadmins have to fix
one, and then wait for the next reconcile, fix the next issue, etc...
But at the same time... fully splitting them out would be quite a lot,
and I think in practice it'll be quite rare to have a pool with more
than e.g. 2 categories of bad things going on.
I also think once we start emitting Events, that will help a lot with
this visibility issue. So the API complexity of multiple condition types
might not be worth it.
Assisted-by: Pi (Claude Opus 4.6)