oyjhl opened a new issue, #822:
URL: https://github.com/apache/solr-operator/issues/822

   I noticed two small logic issues. 
   
   ## 1. `cleanupUnconfiguredServices()` condition looks inverted
   
   Relevant code:
   
   
https://github.com/apache/solr-operator/blob/ca9d3c5c37a59f29570a6b49a8da5dc614aba75e/controllers/solrcloud_controller.go#L683-L716
   
   ```go
   if pod.Annotations == nil && pod.Annotations[util.ServiceTypeAnnotation] != 
"" {
   ```
   
   This condition looks inconsistent. If `pod.Annotations == nil`, then reading 
`pod.Annotations[...]` does not make sense. If `pod.Annotations != nil`, the 
left side is false, so the code falls into the else branch, but the else branch 
comment says it is for pods missing the annotation.
   
   
   
   ## 2. `BalanceReplicasForCluster()` comment and code do not match
   
   Relevant code:
   
   
https://github.com/apache/solr-operator/blob/ca9d3c5c37a59f29570a6b49a8da5dc614aba75e/controllers/util/solr_scale_util.go#L35-L41
   
   ```go
   // If the Cloud has 1 or zero pods, there is no reason to balance replicas.
   if statefulSet.Spec.Replicas == nil || *statefulSet.Spec.Replicas < 1 {
       balanceComplete = true
   }
   ```
   
   The comment says “1 or zero pods”, but the condition only matches < 1, not 
<= 1.
   
   


-- 
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