Copilot commented on code in PR #827:
URL: https://github.com/apache/solr-operator/pull/827#discussion_r4619972863
##########
controllers/util/solr_security_util.go:
##########
@@ -520,7 +527,11 @@ func useSecureProbe(solrCloud *solr.SolrCloud, probe
*corev1.Probe, mountPath st
javaToolOptionsOutputFilter = ""
}
- probeCommand := fmt.Sprintf("%ssolr api -get
\"%s://${SOLR_HOST}:%d%s\"%s", javaToolOptionsStr, solrCloud.UrlScheme(false),
probe.HTTPGet.Port.IntVal, probe.HTTPGet.Path, javaToolOptionsOutputFilter)
+ apiUrlFlag := "--solr-url"
+ if solrCloud.SolrVersionBelow("9.7") {
+ apiUrlFlag = "-get"
+ }
+ probeCommand := fmt.Sprintf("%ssolr api %s
\"%s://${SOLR_HOST}:%d%s\"%s", javaToolOptionsStr, apiUrlFlag,
solrCloud.UrlScheme(false), probe.HTTPGet.Port.IntVal, probe.HTTPGet.Path,
javaToolOptionsOutputFilter)
Review Comment:
With `probesRequireAuth` on Solr 10, the generated command still pipes
through `grep`, so a failed request that prints an error (such as HTTP 401)
reports success and can leave an unhealthy pod ready. Capture the CLI output
and exit status before filtering, then return that status, as in #854. Update
the command assertions and add a failing-request check.
##########
controllers/util/solr_util.go:
##########
@@ -891,6 +911,58 @@ const DefaultSolrXML = `<?xml version="1.0"
encoding="UTF-8" ?>
</solr>
`
+// DefaultSolrXMLForSolr10 is the solr.xml template for Solr 10+.
+// It mirrors Solr 10's stock server/solr/solr.xml, so the two can be diffed
directly. The operator only changes:
+// - sharedLib, which is generated (first placeholder) to add custom library
paths
+// - backup repositories, which are generated (second placeholder)
+//
+// Compared to DefaultSolrXML (Solr 9 and earlier), it drops settings that
Solr 10 rejects (hostContext,
+// genericCoreNodeNames) and the metrics element, which Solr 10's stock
solr.xml doesn't contain either.
+// Solr 10 still supports the metrics element, but leaving it out means
-DmetricsEnabled=false has no effect on Solr 10.
+// It reads the advertised host from "solr.host.advertise" instead of the
deprecated "host" sysprop,
+// and allowPaths from its Solr 10 sysprop "solr.security.allow.paths".
+const DefaultSolrXMLForSolr10 = `<?xml version="1.0" encoding="UTF-8" ?>
+<solr>
+ <int name="maxBooleanClauses">${solr.max.booleanClauses:1024}</int>
+ %s
+ <str name="modules">${solr.modules:}</str>
+ <str name="allowPaths">${solr.security.allow.paths:}</str>
+ <str name="allowUrls">${solr.security.allow.urls:}</str>
+ <str name="hideStackTrace">${solr.hideStackTrace:false}</str>
+ <int name="indexSearcherExecutorThreads">${solr.searchThreads:0}</int>
+ <solrcloud>
+ <str name="host">${solr.host.advertise:}</str>
+ <int name="hostPort">${solr.port.advertise:0}</int>
+ <int name="zkClientTimeout">${zkClientTimeout:30000}</int>
+ <int name="distribUpdateSoTimeout">${distribUpdateSoTimeout:600000}</int>
+ <int
name="distribUpdateConnTimeout">${distribUpdateConnTimeout:60000}</int>
+ <str
name="zkCredentialsProvider">${zkCredentialsProvider:org.apache.solr.common.cloud.DefaultZkCredentialsProvider}</str>
+ <str
name="zkACLProvider">${zkACLProvider:org.apache.solr.common.cloud.DefaultZkACLProvider}</str>
Review Comment:
With ZooKeeper ACL options configured, Solr 10.1 cannot start because
`AddACLsToEnv` still selects `VMParamsAllAndReadonlyDigestZkACLProvider`, which
the [Solr 10.1 removal entry on the default
branch](https://github.com/apache/solr/blob/8b2e99721e28c66b96654d0dff440d74785febb2/changelog/v10.1.0/SOLR-18122-remove-vmparams-acl-provider.yml#L1-L2)
identifies as removed. Generate version-appropriate ACL settings using
`DigestZkACLProvider`, `VMParamsZkCredentialsInjector`, and a compatible
credentials provider for both the Solr container and ZooKeeper init commands,
while preserving older-version support.
--
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]