Skip to content

Add Solr 10 compatibility support#827

Open
danielmeint wants to merge 4 commits intoapache:mainfrom
danielmeint:solr-10-compat
Open

Add Solr 10 compatibility support#827
danielmeint wants to merge 4 commits intoapache:mainfrom
danielmeint:solr-10-compat

Conversation

@danielmeint
Copy link
Copy Markdown

@danielmeint danielmeint commented Apr 27, 2026

Add Solr 10 compatibility support

Adds version-conditional Solr 10 support to the operator while preserving Solr 9.x behavior. All major operator-managed flows (bootstrap, scaling, security, TLS, backups, ingress, rolling upgrades) work against Solr 10.0.

Builds on #826 and addresses #821. Prometheus exporter is out of scope: solr-exporter was removed in Solr 10 (#820).

Warning

Breaking change: introduces a new required field spec.solrMajorVersion (int, 8–10). Existing SolrCloud CRs must add it (e.g. solrMajorVersion: 9) before upgrading the operator; CRD validation rejects CRs that omit it. This is intentional: implicit detection from image tags was unreliable for custom/internal tags. The Helm chart values/templates are updated in this PR so chart users aren't broken.

What changed

Version detection is driven by (*SolrCloud).IsSolr10OrLater(), which reads spec.solrMajorVersion. No image-tag parsing.

Area Change
solr.xml New DefaultSolrXMLForSolr10 template, drops genericCoreNodeNames, hostContext, allowPaths, metricsEnabled; switches host to ${solr.host.advertise:}
Host advertise SOLR_HOST_ADVERTISE env var (replaces deprecated host sysprop)
Modules SOLR_MODULES env var; sharedLib skips removed /opt/solr/contrib/<module>/lib and /opt/solr/dist
hostPort sysprop Skipped on Solr 10
TLS cluster prop setUrlSchemeClusterPropCmd uses solr zk cp instead of removed cloud-scripts/zkcli.sh
Secure probes useSecureProbe uses solr api --solr-url … instead of removed -get
E2E helpers callSolrApiInPod uses --solr-url and --credentials user:pass (Solr 10 dropped -Dbasicauth=… via JAVA_TOOL_OPTIONS)

Test plan

  • Unit tests: IsSolr10OrLater, both solr.xml templates, both branches of useSecureProbe
  • E2E against Solr 10.0.0: Basic, Scale Down/Up (with and without replica migration), Security JSON (provided + bootstrapped), TLS Secrets (No Client TLS, Client TLS, ClientAuth Need/Want, CheckPeerName, VerifyClientHostname), TLS Mounted Dir (ClientAuth Want), Local-directory backups (recurring + single), Ingress, Managed Rolling Upgrades
  • Solr 9.8.0 Basic regression baseline
  • Prometheus Exporter: fails as expected, exporter removed in Solr 10 (Support new metrics format for 10.0 #820)

Notes

Solr 10 logs a "deprecated system property host" warning at startup. After investigation this is a Solr-side false positive (bin/solr in 10 doesn't translate SOLR_HOST to -Dhost, and Solr 10's stock solr.xml ships with the same <str name="host">${solr.host.advertise:}</str>). Removing SOLR_HOST from the pod spec doesn't silence it. Left as-is.

Solr 10 introduced several breaking changes that prevent the operator
from successfully starting and managing SolrClouds. This change adds
version-conditional behavior for Solr 10 while preserving full backwards
compatibility with Solr 9.x.

Major changes covered:

* solr.xml — Solr 10 removed several `<solrcloud>` parameters
  (genericCoreNodeNames, hostContext, allowPaths, metricsEnabled).
  A new `DefaultSolrXMLForSolr10` template, mirroring the stock Solr 10
  template, is selected when the image tag indicates Solr 10+.

* Host advertise — the `host` system property was renamed to
  `solr.host.advertise`. A `SOLR_HOST_ADVERTISE` env var is now set on
  Solr 10 pods.

* Modules — Solr 10 removed `/opt/solr/contrib/<module>/lib` and
  `/opt/solr/dist`. Modules are now loaded via the `SOLR_MODULES` env
  var, and the operator no longer emits contrib paths in `sharedLib`
  for Solr 10.

* hostPort sysprop — `-DhostPort` is no longer needed in Solr 10 and
  is skipped.

* zkcli.sh removed — `setUrlSchemeClusterPropCmd` (TLS setup) now uses
  `solr cluster --property` and `solr zk cp` for Solr 10 instead of
  the removed `cloud-scripts/zkcli.sh`.

* `solr api` CLI — `-get URL` was replaced with `--solr-url URL`.
  Secure probes (`useSecureProbe`) and the e2e helper
  (`callSolrApiInPod`) emit the new flag for Solr 10.

* Basic auth — Solr 10 no longer honors the deprecated
  `-Dbasicauth=user:pass` JAVA_TOOL_OPTIONS path. The e2e helper now
  uses the native `--credentials user:pass` flag for Solr 10.

Version detection lives on the `SolrCloud` type as
`(*SolrCloud).IsSolr10OrLater()`, which parses the major version from
the image tag and treats unparseable tags (e.g. "latest", "nightly")
and a nil `SolrImage` as pre-10 for backwards compatibility. A
package-level `IsSolr10OrLater(imageTag string)` is also exported for
callers that only have a raw image string.

Unit tests cover the version parser, both `solr.xml` templates,
`setUrlSchemeClusterPropCmd` for both branches, the env vars emitted
by `GenerateStatefulSet` for Solr 9 vs Solr 10, and both branches of
`useSecureProbe`. End-to-end tests have been verified against
Solr 10.0.0 across Basic, Scaling (with replica migration),
Security JSON (provided + bootstrapped), TLS (Secrets and Mounted Dir,
including ClientAuth Need/Want, CheckPeerName, VerifyClientHostname),
Local-directory backups (recurring + single), Ingress, and Managed
Rolling Upgrades. Solr 9.8.0 Basic was verified as a regression
baseline.

The Prometheus exporter is not covered: `solr-exporter` was removed
from the Solr distribution in 10, and metrics are now expected to be
scraped from Solr's built-in endpoint. That work is tracked separately
in apache#820.

Refs apache#821, apache#826.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@danielmeint danielmeint marked this pull request as ready for review April 29, 2026 12:42
@danielmeint danielmeint marked this pull request as draft April 29, 2026 14:34
Remove SolrMajorVersion(tag) and standalone IsSolr10OrLater(tag) functions.
Version detection is now driven entirely by the required solrMajorVersion
CRD field (validated 8–10), eliminating misdetection of custom image tags
like '261.162.1' as Solr 261.
@danielmeint danielmeint marked this pull request as ready for review May 1, 2026 18:22
@ArbitraryCritter
Copy link
Copy Markdown

This looks great, I'll see if I can give it a whirl in our test cluster.

danielmeint and others added 2 commits May 5, 2026 09:55
Adds a new `solrMajorVersion` value (default 9, matching the default
image.tag of 9.10.0) and renders it under spec.solrMajorVersion. Uses
Helm's `required` so the chart fails fast with a clear message if a
user explicitly unsets it. Documents the new value in the chart README
and adds a v0.10.0 upgrade note covering both the CRD field and the
new chart value.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ction

Drops "Required by the operator" from the chart README row since the
table already shows a default of 9, which reads as contradictory at
the chart layer. The CRD field is still required at the API layer;
the chart just hands it a default.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants