janhoy commented on code in PR #827:
URL: https://github.com/apache/solr-operator/pull/827#discussion_r4619307880


##########
controllers/util/solr_security_util.go:
##########
@@ -498,13 +498,20 @@ func useSecureProbe(solrCloud *solr.SolrCloud, probe 
*corev1.Probe, mountPath st
        // mount the secret in a file so it gets updated; env vars do not see:
        // 
https://kubernetes.io/docs/concepts/configuration/secret/#environment-variables-are-not-updated-after-a-secret-update
        javaToolOptions := make([]string, 0)
+       credentialsArg := ""
        if solrCloud.Spec.SolrSecurity != nil && 
solrCloud.Spec.SolrSecurity.ProbesRequireAuth && 
solrCloud.Spec.SolrSecurity.AuthenticationType == solr.Basic {
                usernameFile := fmt.Sprintf("%s/%s", mountPath, 
corev1.BasicAuthUsernameKey)
                passwordFile := fmt.Sprintf("%s/%s", mountPath, 
corev1.BasicAuthPasswordKey)
-               javaToolOptions = append(javaToolOptions,
-                       fmt.Sprintf("-Dbasicauth=$(cat %s):$(cat %s)", 
usernameFile, passwordFile),
-                       
"-Dsolr.httpclient.builder.factory=org.apache.solr.client.solrj.impl.PreemptiveBasicAuthClientBuilderFactory",
-               )
+               if solrCloud.SolrVersionAtLeast(10) {
+                       // Solr 10 removed the 
PreemptiveBasicAuthClientBuilderFactory used with JAVA_TOOL_OPTIONS below, so 
pass the credentials as an argument.
+                       // This makes them visible in the process arguments 
inside the pod.
+                       credentialsArg = fmt.Sprintf(` --credentials "$(cat 
%s):$(cat %s)"`, usernameFile, passwordFile)

Review Comment:
   Agreed. It turns out Solr 10 still has the preemptive basic-auth mechanism, 
just renamed: `PreemptiveBasicAuthClientCustomizer`, enabled with 
`-Dsolr.solrj.http.jetty.customizer`, with the credentials in 
`-Dsolr.security.auth.basicauth.credentials`. The probe now uses that through 
`JAVA_TOOL_OPTIONS`, read from the mounted secret files exactly like Solr 9, so 
the credentials are no longer in the process arguments (fbc6aad). This stays a 
9-vs-10 switch, as no 9.x release has the new class.
   



##########
controllers/util/solr_util.go:
##########
@@ -431,6 +441,19 @@ func GenerateStatefulSet(solrCloud *solr.SolrCloud, 
solrCloudStatus *solr.SolrCl
                },
        }
 
+       // Solr 10+ reads the listen port from SOLR_PORT_LISTEN instead of 
SOLR_PORT,
+       // and uses SOLR_HOST_ADVERTISE in place of the deprecated 'host' 
sysprop.
+       // These are only set for Solr 10+, so that pods of older Solr versions 
are not restarted by an operator upgrade.
+       if solrCloud.SolrVersionAtLeast(10) {

Review Comment:
   Good point, done in f211c8b: both are set for Solr 9+ (Solr 9 ignores them), 
and 6471c8a phrases the check as "is this Solr 8" so it goes away with Solr 8 
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]

Reply via email to