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


##########
controllers/util/solr_util.go:
##########
@@ -453,6 +453,18 @@ func GenerateStatefulSet(solrCloud *solr.SolrCloud, 
solrCloudStatus *solr.SolrCl
                podAnnotations[SolrXmlMd5Annotation] = 
reconcileConfigInfo[SolrXmlMd5Annotation]
        }
 
+       if solrCloud.Spec.AvailabilityZoneFromNodeLabel != nil && 
*solrCloud.Spec.AvailabilityZoneFromNodeLabel {
+               envVars = append(envVars, corev1.EnvVar{
+                       Name: "SOLR_AVAILABILITY_ZONE",
+                       ValueFrom: &corev1.EnvVarSource{
+                               FieldRef: &corev1.ObjectFieldSelector{
+                                       FieldPath: 
fmt.Sprintf("metadata.labels['%s']", corev1.LabelTopologyZone),

Review Comment:
   Please set `APIVersion: "v1"` on this field selector, as the other Downward 
API env vars do. Kubernetes defaults the omitted value to `"v1"` in the stored 
StatefulSet, but `CopyPodContainers` compares the entire env list without 
normalizing that default (`controllers/util/common.go:598`). Consequently, 
enabling this option makes every subsequent reconciliation detect an env change 
and issue an unnecessary StatefulSet update, even when the SolrCloud spec is 
unchanged.



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