diff --git a/operators/pkg/controller/elasticsearch/remotecluster/elasticsearch.go b/operators/pkg/controller/elasticsearch/remotecluster/elasticsearch.go index 0fcfe393ff..ded51028fb 100644 --- a/operators/pkg/controller/elasticsearch/remotecluster/elasticsearch.go +++ b/operators/pkg/controller/elasticsearch/remotecluster/elasticsearch.go @@ -75,7 +75,14 @@ func UpdateRemoteCluster( } } // Update state - reconcileState.UpdateRemoteClusters(currentRemoteClusters) + // If the map is empty then it must be stored as nil, not an empty map. It is retrieved as a nil value from the API + // and it could lead to some reconcile loops that never converge on Openshift. + if len(currentRemoteClusters) > 0 { + reconcileState.UpdateRemoteClusters(currentRemoteClusters) + } else { + // ensure that map is nil in the status if empty + reconcileState.UpdateRemoteClusters(nil) + } return nil }