Merge pull request #95961 from KnicKnic/set_condition

SetCondtion updates generation
This commit is contained in:
Kubernetes Prow Robot 2020-11-02 23:16:15 -08:00 committed by GitHub
commit a69a4a4bf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -51,6 +51,7 @@ func SetStatusCondition(conditions *[]metav1.Condition, newCondition metav1.Cond
existingCondition.Reason = newCondition.Reason existingCondition.Reason = newCondition.Reason
existingCondition.Message = newCondition.Message existingCondition.Message = newCondition.Message
existingCondition.ObservedGeneration = newCondition.ObservedGeneration
} }
// RemoveStatusCondition removes the corresponding conditionType from conditions. // RemoveStatusCondition removes the corresponding conditionType from conditions.

View File

@ -68,10 +68,10 @@ func TestSetStatusCondition(t *testing.T) {
{Type: "second", Status: metav1.ConditionTrue, LastTransitionTime: metav1.Time{Time: oneHourBefore}}, {Type: "second", Status: metav1.ConditionTrue, LastTransitionTime: metav1.Time{Time: oneHourBefore}},
{Type: "third"}, {Type: "third"},
}, },
toAdd: metav1.Condition{Type: "second", Status: metav1.ConditionTrue, LastTransitionTime: metav1.Time{Time: oneHourAfter}, Reason: "reason", Message: "message"}, toAdd: metav1.Condition{Type: "second", Status: metav1.ConditionTrue, LastTransitionTime: metav1.Time{Time: oneHourAfter}, Reason: "reason", Message: "message", ObservedGeneration: 3},
expected: []metav1.Condition{ expected: []metav1.Condition{
{Type: "first"}, {Type: "first"},
{Type: "second", Status: metav1.ConditionTrue, LastTransitionTime: metav1.Time{Time: oneHourBefore}, Reason: "reason", Message: "message"}, {Type: "second", Status: metav1.ConditionTrue, LastTransitionTime: metav1.Time{Time: oneHourBefore}, Reason: "reason", Message: "message", ObservedGeneration: 3},
{Type: "third"}, {Type: "third"},
}, },
}, },