This is an automated email from the ASF dual-hosted git repository.
gerlowskija pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr-operator.git
The following commit(s) were added to refs/heads/main by this push:
new b019cf2 SOLR-17216: Cleanup command-based Solr probe output (#698)
b019cf2 is described below
commit b019cf2440738dd4a4b2be9684ee6a1ff6bf261f
Author: Jason Gerlowski <[email protected]>
AuthorDate: Tue Apr 2 12:46:59 2024 -0400
SOLR-17216: Cleanup command-based Solr probe output (#698)
Removes some extraneous output from liveness/readiness/startup probes
that use the 'bin/solr auth' command.
---
controllers/solrcloud_controller_basic_auth_test.go | 4 ++--
controllers/util/solr_security_util.go | 5 ++++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/controllers/solrcloud_controller_basic_auth_test.go
b/controllers/solrcloud_controller_basic_auth_test.go
index a91846f..0018200 100644
--- a/controllers/solrcloud_controller_basic_auth_test.go
+++ b/controllers/solrcloud_controller_basic_auth_test.go
@@ -289,10 +289,10 @@ func expectBasicAuthConfigOnPodTemplateWithGomega(g
Gomega, solrCloud *solrv1bet
g.Expect(basicAuthSecretVolMount.MountPath).To(Equal("/etc/secrets/"+secretName),
"Wrong path used to mount Basic Auth volume")
expLivenessProbeCmd :=
fmt.Sprintf("JAVA_TOOL_OPTIONS=\"-Dbasicauth=$(cat
/etc/secrets/%s-solrcloud-basic-auth/username):$(cat
/etc/secrets/%s-solrcloud-basic-auth/password)
-Dsolr.httpclient.builder.factory=org.apache.solr.client.solrj.impl.PreemptiveBasicAuthClientBuilderFactory\"
"+
- "solr api -get \"http://${SOLR_HOST}:8983%s\"",
+ "solr api -get \"http://${SOLR_HOST}:8983%s\" 2>&1 |
grep -v JAVA_TOOL_OPTIONS",
solrCloud.Name, solrCloud.Name, expLivenessProbePath)
expReadinessProbeCmd :=
fmt.Sprintf("JAVA_TOOL_OPTIONS=\"-Dbasicauth=$(cat
/etc/secrets/%s-solrcloud-basic-auth/username):$(cat
/etc/secrets/%s-solrcloud-basic-auth/password)
-Dsolr.httpclient.builder.factory=org.apache.solr.client.solrj.impl.PreemptiveBasicAuthClientBuilderFactory\"
"+
- "solr api -get \"http://${SOLR_HOST}:8983%s\"",
+ "solr api -get \"http://${SOLR_HOST}:8983%s\" 2>&1 |
grep -v JAVA_TOOL_OPTIONS",
solrCloud.Name, solrCloud.Name, expReadinessProbePath)
g.Expect(mainContainer.LivenessProbe).To(Not(BeNil()), "main
container should have a liveness probe defined")
diff --git a/controllers/util/solr_security_util.go
b/controllers/util/solr_security_util.go
index 51caa31..d67dfe1 100644
--- a/controllers/util/solr_security_util.go
+++ b/controllers/util/solr_security_util.go
@@ -496,13 +496,16 @@ func useSecureProbe(solrCloud *solr.SolrCloud, probe
*corev1.Probe, mountPath st
// Future work - SOLR_TOOL_OPTIONS is only in 9.4.0, use
JAVA_TOOL_OPTIONS until that is the minimum supported version
var javaToolOptionsStr string
+ var javaToolOptionsOutputFilter string
if len(javaToolOptions) > 0 {
javaToolOptionsStr = fmt.Sprintf("JAVA_TOOL_OPTIONS=%q ",
strings.Join(javaToolOptions, " "))
+ javaToolOptionsOutputFilter = " 2>&1 | grep -v
JAVA_TOOL_OPTIONS"
} else {
javaToolOptionsStr = ""
+ javaToolOptionsOutputFilter = ""
}
- probeCommand := fmt.Sprintf("%ssolr api -get
\"%s://${SOLR_HOST}:%d%s\"", javaToolOptionsStr, solrCloud.UrlScheme(false),
probe.HTTPGet.Port.IntVal, probe.HTTPGet.Path)
+ probeCommand := fmt.Sprintf("%ssolr api -get
\"%s://${SOLR_HOST}:%d%s\"%s", javaToolOptionsStr, solrCloud.UrlScheme(false),
probe.HTTPGet.Port.IntVal, probe.HTTPGet.Path, javaToolOptionsOutputFilter)
probeCommand =
regexp.MustCompile(`\s+`).ReplaceAllString(strings.TrimSpace(probeCommand), " ")
// use an Exec instead of an HTTP GET