Skip to content

Commit

Permalink
fix: IsConditionChanged will ignore lastTransitionTime to make it mor…
Browse files Browse the repository at this point in the history
…e usable
  • Loading branch information
danielfbm committed Feb 5, 2023
1 parent 16c12cf commit ed012e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions apis/meta/v1alpha1/condition.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,11 @@ func IsConditionChanged(current, old apis.ConditionAccessor, conditionType apis.
return false
}
return (currentCondition.Status != oldCondition.Status) ||
!currentCondition.LastTransitionTime.Inner.Equal(&oldCondition.LastTransitionTime.Inner) ||
currentCondition.Reason != oldCondition.Reason
currentCondition.Reason != oldCondition.Reason ||
currentCondition.Message != oldCondition.Message
// return (currentCondition.Status != oldCondition.Status) ||
// !currentCondition.LastTransitionTime.Inner.Equal(&oldCondition.LastTransitionTime.Inner) ||
// currentCondition.Reason != oldCondition.Reason
}

// GetCondition will return the first condition pointer filter by type in conditions
Expand Down
2 changes: 1 addition & 1 deletion apis/meta/v1alpha1/condition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func TestIsConditionChanged(t *testing.T) {
apis.Condition{Type: SomeCondition, Status: corev1.ConditionUnknown, LastTransitionTime: apis.VolatileTime{Inner: oneSecondAgo}},
}}},
conditionType: SomeCondition,
expected: true,
expected: false,
},
"Condition status is the same, last transition same, reason changed": {
current: &StatusTest{duckv1.Status{Conditions: duckv1.Conditions{
Expand Down

0 comments on commit ed012e0

Please sign in to comment.