This is an automated email from the ASF dual-hosted git repository.

HoustonPutman pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr-operator.git


The following commit(s) were added to refs/heads/main by this push:
     new 9ae20a5  Fix two logic bugs reported in #822 (#825)
9ae20a5 is described below

commit 9ae20a51753db976e6f45897f9e950926f44a0ba
Author: oyjhl <[email protected]>
AuthorDate: Tue Jun 16 18:02:01 2026 -0500

    Fix two logic bugs reported in #822 (#825)
    
    Fixes https://github.com/apache/solr-operator/issues/822
---
 controllers/solrcloud_controller.go | 2 +-
 controllers/util/solr_scale_util.go | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/controllers/solrcloud_controller.go 
b/controllers/solrcloud_controller.go
index 5a09b62..cc0b249 100644
--- a/controllers/solrcloud_controller.go
+++ b/controllers/solrcloud_controller.go
@@ -716,7 +716,7 @@ func (r *SolrCloudReconciler) 
cleanupUnconfiguredServices(ctx context.Context, s
                return
        }
        for _, pod := range podList {
-               if pod.Annotations == nil && 
pod.Annotations[util.ServiceTypeAnnotation] != "" {
+               if pod.Annotations != nil && 
pod.Annotations[util.ServiceTypeAnnotation] != "" {
                        if onlyServiceTypeInUse != 
pod.Annotations[util.ServiceTypeAnnotation] {
                                // Only remove services if all pods are using 
the same, and configured, type of service.
                                // Otherwise, we are in transition between 
service types and need to wait to delete anything.
diff --git a/controllers/util/solr_scale_util.go 
b/controllers/util/solr_scale_util.go
index 3f556af..e10c6da 100644
--- a/controllers/util/solr_scale_util.go
+++ b/controllers/util/solr_scale_util.go
@@ -35,7 +35,7 @@ import (
 func BalanceReplicasForCluster(ctx context.Context, solrCloud *solr.SolrCloud, 
statefulSet *appsv1.StatefulSet, balanceReason string, balanceCmdUniqueId 
string, logger logr.Logger) (balanceComplete bool, requestInProgress bool, 
retryLaterDuration time.Duration, err error) {
        logger = logger.WithValues("balanceReason", balanceReason)
        // If the Cloud has 1 or zero pods, there is no reason to balance 
replicas.
-       if statefulSet.Spec.Replicas == nil || *statefulSet.Spec.Replicas < 1 {
+       if statefulSet.Spec.Replicas == nil || *statefulSet.Spec.Replicas <= 1 {
                balanceComplete = true
        } else {
                requestId := "balance-replicas-" + balanceCmdUniqueId

Reply via email to