Add Solr 10 compatibility support#827
Draft
danielmeint wants to merge 1 commit intoapache:mainfrom
Draft
Conversation
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>
07b2d15 to
c48f428
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-exporterwas removed from the Solr distribution in 10, see #820.What changed
Version detection is centralized on the
SolrCloudtype:(*SolrCloud).IsSolr10OrLater()— parses the major version from the configured image tag, handles a nilSolrImage, and treats unparseable tags (latest,nightly, custom) as pre-10 for backwards compatibility.IsSolr10OrLater(imageTag string)is also exported for the few call sites that only have a raw image string.Areas updated for Solr 10:
solr.xmlDefaultSolrXMLForSolr10template — dropsgenericCoreNodeNames,hostContext,allowPaths,metricsEnabled, switcheshostelement to${solr.host.advertise:}SOLR_HOST_ADVERTISEenv var (replaces the deprecatedhostsysprop)SOLR_MODULESenv var; skips/opt/solr/contrib/<module>/liband/opt/solr/distpaths insharedLib(these directories no longer exist in 10)hostPortsyspropsetUrlSchemeClusterPropCmdusessolr zk cpinstead of the removedcloud-scripts/zkcli.shuseSecureProbeusessolr api --solr-url …instead of the removed-getflagcallSolrApiInPoduses--solr-urland the native--credentials user:passflag (Solr 10 no longer honors-Dbasicauth=…viaJAVA_TOOL_OPTIONS)Test plan
SolrMajorVersion,IsSolr10OrLater— including unparseable / nil-image cases)solr.xmltemplates (Solr 9 and Solr 10)useSecureProbeNotes
\"deprecated system property host\"warning at startup. After investigation this appears to be a Solr-side false positive (bin/solrin 10 doesn't translateSOLR_HOSTto-Dhost, and Solr 10's own defaultsolr.xmlships with the same<str name=\"host\">${solr.host.advertise:}</str>element). RemovingSOLR_HOSTfrom the pod spec doesn't silence it. Left as-is; happy to file upstream in Solr if that's preferred.🤖 Generated with Claude Code