Skip to content

controller: add precedence-aware setPoolDegraded helper#112

Merged
jlebon merged 1 commit into
bootc-dev:mainfrom
jlebon:pr/precedence
Jul 16, 2026
Merged

controller: add precedence-aware setPoolDegraded helper#112
jlebon merged 1 commit into
bootc-dev:mainfrom
jlebon:pr/precedence

Conversation

@jlebon

@jlebon jlebon commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

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)

// 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) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@alicefr

alicefr commented Jul 16, 2026

Copy link
Copy Markdown
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>
@jlebon
jlebon merged commit 701e54e into bootc-dev:main Jul 16, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants