Skip to content

Conversation

@Diaphteiros
Copy link
Contributor

@Diaphteiros Diaphteiros commented Jul 22, 2025

What this PR does / why we need it:
Fixes a bug in the condition updater that could lead to a condition's LastTransitionTime wrongfully being updated if the status did not change. The bug would occur if the same condition was updated multiple times, with any update changing the status and the last update reverting it back to the original value.

Also ensures that conditions always have a non-empty reason set, because the metav1.Condition type requires that and updating the k8s resource will fail if any condition is lacking the reason. If the reason is missing, the condition updater now sets a dummy value that is a concatenation of the condition's type and its status.

Adds a GenerateCreateConditionFunc to the pkg/controller package.

Which issue(s) this PR fixes:
None

Special notes for your reviewer:
This PR includes a patch release.

Release note:

Fixed a bug in the condition updater that could lead to a condition's `LastTransitionTime` wrongfully being updated if the status did not change.
The condition updater now ensures that each condition has a non-empty reason. If the reason is empty during the update, it is set to a concatenation of the condition's type and status.
The `pkg/controller` package now contains a convenience function named `GenerateCreateConditionFunc` which takes a `ReconcileResult` and returns a function that can be used to easily add new conditions to it.

@Diaphteiros Diaphteiros changed the title fix bug in condition updater fix condition updater Jul 23, 2025
@robertgraeff robertgraeff merged commit f3cce33 into main Jul 23, 2025
9 checks passed
@robertgraeff robertgraeff deleted the fix-con-time branch July 23, 2025 10:56
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