Repository navigation
Conversation
New SolrCloud option `availabilityZoneFromNodeLabel` sets the `availability_zone` system property from the pod's `topology.kubernetes.io/zone` label, which Kubernetes copies from the node since the PodTopologyLabels feature (default since v1.35). Solr's AffinityPlacementFactory uses that property to spread replicas across zones, which previously needed a hand-written init container with node-read RBAC. Closes apache#556
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
A side note, Solr should start using better SysVar names for this plugin, so that the EnvUtils code will auto convert envVars... Though we will want to support older versions, so this is great we can just remove |
|
I like this, but I'd like it even more if we could automatically detect if the setting is enabled in Kubernetes and just use it if it is, and don't if it isn't. Then users wouldn't have to enable it at all. |
That shuold be possible I suppose, do some introspection somewhere and default to true if supported. Related to this, I also thought about enabling affinity placement plugin as default, with disk warning set to 85% disk used (operator knows pvc size), see #894. But that can be a followup issue once each of the features are included. |
🤖 AI assisted 🤖
Closes #556
Solr's
AffinityPlacementFactoryspreads replicas across availability zones using each node'savailability_zonesystem property. Getting that value into a Solr pod used to mean a hand-written init container that queried the API server for node labels, which needs node-read RBAC. The gist in the issue is the workaround people have been copying.Kubernetes solved this: the
PodTopologyLabelsadmission plugin copies the node'stopology.kubernetes.io/zonelabel onto the pod at binding time, alpha in 1.33 and beta, on by default, since 1.35. So the value is now reachable through the Downward API with no RBAC and no init container.New opt-in SolrCloud field
availabilityZoneFromNodeLabel, exposed as the Helm valuesolrOptions.availabilityZoneFromNodeLabel. When set, the operator adds aSOLR_AVAILABILITY_ZONEenvVar from the pod label and appends-Davailability_zone=$(SOLR_AVAILABILITY_ZONE)toSOLR_OPTS.It is opt-in rather than automatic for two reasons: enabling it changes the pod spec, which costs a rolling restart, and on a cluster without the feature the label is absent so the property would be empty. Empty is harmless, since Solr then treats all nodes as one zone, exactly as it does today when no node reports a zone.
Only the zone label is wired up. Region and hostname are also copied by the plugin, but Solr's placement plugins have no use for them today.