Skip to content

Conversation

@notandy
Copy link
Contributor

@notandy notandy commented Oct 23, 2025

This PR modifies the Code of #161 to improve following points:

  1. no need for extra error-log since instead of dropping Reconcile
    Errors, we format them nicely with the Encoder.
  2. Function (like rewritten setErrorCondition) should not return the
    errors the've been invoked with - but only return errors if they
    fail. Also, it's an uneeded roundtrip to return the same error that
    has been passed by the caller.
  3. Introduce utils.LifecycleEnabledPredicate, a predicate that will
    filter event's for hypervisors with LifecycleEnabled == True.
  • Aggregates: Use GenerationChangedPredicate and join errors
  • Use zapEncoder for removing stacktrace of reconcilerrors, fixups

Prior to this change, we would have to exit the reconcile function on
each status update, and continue there. Now with the filter,
we only retry on either an error or RequeueAfter.

Joining the errors allows us to complete at least some of the changes,
and not always abort on the first.

Return kubernetes errors directly, and return a RequeueAfter on an error
from Openstack for now, until the logging situation has been cleared.
This PR modifies the Code of #161 to improve following points:
1. no need for extra error-log since instead of dropping Reconcile
   Errors, we format them nicely with the Encoder.
2. Function (like rewritten `setErrorCondition`) should not return the
   errors the've been invoked with - but only return errors if they
   fail. Also, it's an uneeded roundtrip to return the same error that
   has been passed by the caller.
3. Introduce `utils.LifecycleEnabledPredicate`, a predicate that will
   filter event's for hypervisors with LifecycleEnabled == True.
@notandy notandy force-pushed the AggregateLoggingProposal branch from dcda67e to 0aebca4 Compare October 23, 2025 20:23
@github-actions
Copy link

Merging this branch will decrease overall coverage

Impacted Packages Coverage Δ 🤖
github.com/cobaltcore-dev/openstack-hypervisor-operator/cmd 0.00% (ø)
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller 36.82% (-0.43%) 👎
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/logger 0.00% (ø)
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/utils 0.00% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/cobaltcore-dev/openstack-hypervisor-operator/cmd/main.go 0.00% (ø) 0 0 0
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller/aggregates_controller.go 60.67% (-6.80%) 89 (+6) 54 (-2) 35 (+8) 👎
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/logger/logger.go 0.00% (ø) 0 0 0
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/utils/lifecycle_enabled.go 0.00% (ø) 3 (+3) 0 3 (+3)

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.

@fwiesel fwiesel merged commit 9bfc3e0 into main Oct 24, 2025
7 checks passed
@fwiesel fwiesel deleted the AggregateLoggingProposal branch October 24, 2025 07:16
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