Skip to content

Set TraitsUpdated when the recorded traits match the spec - #377

Merged
fwiesel merged 1 commit into
ssa-traitsfrom
traits-handover-fix
Oct 30, 2026
Merged

fwiesel merged 1 commit into
ssa-traitsfrom
traits-handover-fix

Conversation

@fwiesel

@fwiesel fwiesel commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

When the desired and the recorded custom traits matched, the traits controller returned early without ever setting TraitsUpdated — and that condition gates the handover phase, so hypervisors without custom traits could never finish onboarding.

  • Report success from the recorded state when it matches the spec, without contacting placement.
  • Query placement only when the spec and the recorded traits diverge — the same trigger as before, now order-insensitive.
  • During a sync, read the applied set from placement instead of the status cache, so a stray custom trait is removed in a single pass.

Adds specs for the no-custom-traits and already-matching cases.

@fwiesel
fwiesel force-pushed the traits-handover-fix branch from 01c702a to fb25866 Compare October 30, 2026 13:58
@fwiesel fwiesel changed the title Set TraitsUpdated on no-op reconciles so onboarding can complete Enforce desired custom traits on every reconcile Oct 30, 2026
@fwiesel
fwiesel force-pushed the traits-handover-fix branch from fb25866 to cb252b0 Compare October 30, 2026 14:08
@fwiesel fwiesel changed the title Enforce desired custom traits on every reconcile Set TraitsUpdated when the recorded traits match the spec Oct 30, 2026
@fwiesel
fwiesel force-pushed the traits-handover-fix branch from cb252b0 to d0c5c3b Compare October 30, 2026 14:16
@fwiesel
fwiesel added this pull request to stack #378 October 30, 2026 14:42
@fwiesel
fwiesel force-pushed the traits-handover-fix branch 2 times, most recently from c4d9098 to ea27890 Compare October 30, 2026 14:46
The reconcile returned early when the desired and the recorded custom
traits matched, without ever setting TraitsUpdated. That condition gates
the handover phase, so hypervisors without custom traits could never
finish onboarding.

Report success from the recorded state in that case. Placement is only
queried when the spec and the recorded traits diverge, as before, and
the comparison is now order-insensitive. While such a sync runs, the
applied set is read from placement instead of the status cache, so
stray custom traits are removed in a single pass.

Signed-off-by: Fabian Wiesel <fabian.wiesel@sap.com>
@fwiesel
fwiesel force-pushed the traits-handover-fix branch from ea27890 to 0dc7aa4 Compare October 30, 2026 14:52
@fwiesel
fwiesel marked this pull request as ready for review October 30, 2026 14:52
@github-actions

Copy link
Copy Markdown

Caution

No coverage for base commit eef6ad6 was found, so this report compares against its ancestor 8f1100d (1 commit earlier)

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller 74.77% (+0.26%) 👍
Coverage details

Compared to commit 8f1100d (run #40940906890)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller/traits_controller.go 76.92% (+3.49%) 65 (+1) 50 (+3) 15 (-2) 👍

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files:

  • github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller/traits_controller_test.go

@fwiesel
fwiesel merged commit f4b1369 into main Oct 30, 2026
7 checks passed
@fwiesel
fwiesel deleted the traits-handover-fix branch October 30, 2026 15:55
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.

3 participants