Skip to content

Add Solr 10 compatibility support#827

Draft
danielmeint wants to merge 1 commit intoapache:mainfrom
danielmeint:solr-10-compat
Draft

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

Conversation

@danielmeint
Copy link
Copy Markdown

Summary

Adds version-conditional support for Solr 10 to the operator while preserving full backwards compatibility with Solr 9.x. With this change, all major operator-managed flows (cluster bootstrap, scaling, security, TLS, backups, ingress, rolling upgrades) work against a Solr 10.0 image.

This builds on the partial fix proposed in #826 and addresses #821 ("Solr 10.0 - No tests pass"). The Prometheus exporter is intentionally out of scope — solr-exporter was removed from the Solr distribution in 10, see #820.

What changed

Version detection is centralized on the SolrCloud type:

  • (*SolrCloud).IsSolr10OrLater() — parses the major version from the configured image tag, handles a nil SolrImage, and treats unparseable tags (latest, nightly, custom) as pre-10 for backwards compatibility.
  • A package-level IsSolr10OrLater(imageTag string) is also exported for the few call sites that only have a raw image string.

Areas updated for Solr 10:

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

Test plan

  • Unit tests for the version parser (SolrMajorVersion, IsSolr10OrLater — including unparseable / nil-image cases)
  • Unit tests for both solr.xml templates (Solr 9 and Solr 10)
  • Unit tests for both branches of useSecureProbe
  • E2E against Solr 10.0.0:
    • Basic
    • Scale Down / Scale Up with replica migration
    • Security JSON — Provided + Bootstrapped
    • TLS — Secrets (No Client TLS, Client TLS, ClientAuth Need/Want, CheckPeerName, VerifyClientHostname)
    • TLS — Mounted Dir (ClientAuth Want)
    • Backups — Local Directory (Recurring + Single)
    • Ingress (addressability change)
    • Rolling Upgrades (Managed Update)
    • Prometheus Exporter — fails as expected, exporter removed in Solr 10 (Support new metrics format for 10.0 #820)
  • E2E regression baseline against Solr 9.8.0 — Basic suite passes

Notes

  • Marked draft — happy to split into smaller commits, rework the API surface, or scope down based on review feedback.
  • One open cosmetic item: Solr 10 logs a \"deprecated system property host\" warning at startup. After investigation this appears to be a Solr-side false positive (bin/solr in 10 doesn't translate SOLR_HOST to -Dhost, and Solr 10's own default solr.xml ships with the same <str name=\"host\">${solr.host.advertise:}</str> element). Removing SOLR_HOST from the pod spec doesn't silence it. Left as-is; happy to file upstream in Solr if that's preferred.

🤖 Generated with Claude Code

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

1 participant