Skip to content

Commit d257ce5

Browse files
authored
Ignore OperationResult 'unchanged' (#307)
Prevent unchanged resources from being logged.
1 parent 80160b2 commit d257ce5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

controllers/rabbitmqcluster_controller.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,14 @@ func (r *RabbitmqClusterReconciler) exec(namespace, podName, containerName strin
423423
// logAndRecordOperationResult - helper function to log and record events with message and error
424424
// it logs and records 'updated' and 'created' OperationResult, and ignores OperationResult 'unchanged'
425425
func (r *RabbitmqClusterReconciler) logAndRecordOperationResult(rmq runtime.Object, resource runtime.Object, operationResult controllerutil.OperationResult, err error) {
426+
if operationResult == controllerutil.OperationResultNone && err == nil {
427+
return
428+
}
429+
426430
var operation string
427431
if operationResult == controllerutil.OperationResultCreated {
428432
operation = "create"
429433
}
430-
431434
if operationResult == controllerutil.OperationResultUpdated {
432435
operation = "update"
433436
}

0 commit comments

Comments
 (0)