Copilot commented on code in PR #894:
URL: https://github.com/apache/solr-operator/pull/894#discussion_r4558285141


##########
controllers/solrcloud_controller.go:
##########
@@ -703,6 +725,28 @@ func (r *SolrCloudReconciler) Reconcile(ctx 
context.Context, req ctrl.Request) (
                return requeueOrNot, serviceCleanupError
        }
 
+       // Keep the replica placement plugin in sync with the spec, once there 
is a pod to talk to.
+       // The cluster plugin API only exists on newer Solr versions, so 
neither applying nor removing a
+       // plugin is attempted below that floor. The applied hash is kept in 
that case, so that a cloud
+       // moved back onto a supported version still has its plugin corrected.
+       newStatus.AppliedSettings = instance.Status.AppliedSettings
+       supportsClusterPlugins := 
instance.SolrVersionAtLeast(util.MinSolrVersionForClusterPlugins)
+       if instance.Spec.ReplicaPlacementFactory != nil && 
!supportsClusterPlugins {
+               r.Recorder.Eventf(instance, corev1.EventTypeWarning, 
"ReplicaPlacementPluginUnsupported",
+                       "Ignoring replicaPlacementFactory, which requires Solr 
%d or later", util.MinSolrVersionForClusterPlugins)
+       } else if hasReadyPod && supportsClusterPlugins {
+               appliedHash, placementErr := 
util.ReconcileReplicaPlacementPlugin(
+                       ctx, instance, 
newStatus.ZookeeperConnectionInfo.ZkConnectionString(),
+                       
instance.Status.AppliedSettings[solrv1beta1.ReplicaPlacementFactorySetting], 
logger)
+               
newStatus.SetAppliedSetting(solrv1beta1.ReplicaPlacementFactorySetting, 
appliedHash)

Review Comment:
   When the ZooKeeper ensemble or chroot changes, the common Service can still 
route plugin requests to old pods while `newStatus` already identifies the new 
target. A successful request then checkpoints the new target's hash despite 
updating the old cluster, so subsequent reconciles skip applying the plugin to 
the new cluster. Defer application until all eligible Service endpoints use the 
desired ZooKeeper configuration, or send both discovery and mutation to a ready 
pod verified to use that target.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to