types: Fix excessive condition change logs
@@ -27,9 +27,12 @@ func getUnknownCondition(conditionType string) Condition {
func SetConditionAndRecord(conditions map[string]Condition, conditionType string, conditionValue ConditionStatus,
reason, message string, eventRecorder record.EventRecorder, obj runtime.Object, eventtype string) {
- SetCondition(conditions, conditionType, conditionValue, reason, message)
+ condition := GetCondition(conditions, conditionType)
+ if condition.Status != conditionValue {
eventRecorder.Event(obj, eventtype, conditionType, message)
}
+ SetCondition(conditions, conditionType, conditionValue, reason, message)
+}
func SetCondition(conditions map[string]Condition, conditionType string, conditionValue ConditionStatus, reason, message string) {
condition := GetCondition(conditions, conditionType)
