This is an automated email from the ASF dual-hosted git repository.
gerlowskija pushed a commit to branch release-0.9
in repository https://gitbox.apache.org/repos/asf/solr-operator.git
The following commit(s) were added to refs/heads/release-0.9 by this push:
new 1cd65d5 Provide explicit '-z' option to 'solr zk' (#756)
1cd65d5 is described below
commit 1cd65d51fec12d2c8bf475b3979ff8e1982650f1
Author: Samuel Verstraete <[email protected]>
AuthorDate: Tue Mar 11 15:11:09 2025 +0100
Provide explicit '-z' option to 'solr zk' (#756)
This works around a bug (SOLR-17690) in Solr 9.8 where the "solr zk"
tool wasn't reading the ZK_HOST env-var as in previous versions.
Providing the ZK hostname via an explicit CLI option allows our
initContainer logic to work for all Solr versions in the supported range.
(When 9.8.x falls out of the supported Solr version range, this code can
likely be simplified.)
---------
Co-authored-by: samuel <[email protected]>
---
controllers/solrcloud_controller_basic_auth_test.go | 6 +++---
controllers/util/solr_security_util.go | 6 +++---
helm/solr-operator/Chart.yaml | 13 ++++++-------
3 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/controllers/solrcloud_controller_basic_auth_test.go
b/controllers/solrcloud_controller_basic_auth_test.go
index c271393..90eeef2 100644
--- a/controllers/solrcloud_controller_basic_auth_test.go
+++ b/controllers/solrcloud_controller_basic_auth_test.go
@@ -351,12 +351,12 @@ func expectBasicAuthConfigOnPodTemplateWithGomega(g
Gomega, solrCloud *solrv1bet
func expectPutSecurityJsonInZkCmd(g Gomega, expInitContainer
*corev1.Container) {
g.Expect(expInitContainer).To(Not(BeNil()), "Didn't find the setup-zk
InitContainer in the sts!")
- expCmd := "solr zk cp zk:/security.json /tmp/current_security.json
>/dev/null 2>&1; " +
+ expCmd := "solr zk cp zk:/security.json /tmp/current_security.json -z
$ZK_HOST >/dev/null 2>&1; " +
"GET_CURRENT_SECURITY_JSON_EXIT_CODE=$?; if [
${GET_CURRENT_SECURITY_JSON_EXIT_CODE} -eq 0 ]; then " +
"if [ ! -s /tmp/current_security.json ] || grep -q '^{}$'
/tmp/current_security.json ]; then " +
- "echo $SECURITY_JSON > /tmp/security.json; solr zk cp
/tmp/security.json zk:/security.json >/dev/null 2>&1; " +
+ "echo $SECURITY_JSON > /tmp/security.json; solr zk cp
/tmp/security.json zk:/security.json -z $ZK_HOST >/dev/null 2>&1; " +
" echo 'Blank security.json found. Put new security.json in
ZK'; fi; elif [ ${GET_CURRENT_SECURITY_JSON_EXIT_CODE} -eq 1 ]; then " +
- " echo $SECURITY_JSON > /tmp/security.json; solr zk cp
/tmp/security.json zk:/security.json >/dev/null 2>&1; " +
+ " echo $SECURITY_JSON > /tmp/security.json; solr zk cp
/tmp/security.json zk:/security.json -z $ZK_HOST >/dev/null 2>&1; " +
" echo 'No security.json found. Put new security.json in ZK';
fi"
g.Expect(expInitContainer.Command[2]).To(ContainSubstring(expCmd),
"setup-zk initContainer not configured to bootstrap security.json!")
}
diff --git a/controllers/util/solr_security_util.go
b/controllers/util/solr_security_util.go
index 2eb8679..c11e98c 100644
--- a/controllers/util/solr_security_util.go
+++ b/controllers/util/solr_security_util.go
@@ -237,17 +237,17 @@ func addHostHeaderToProbe(httpGet *corev1.HTTPGetAction,
host string) {
}
func cmdToPutSecurityJsonInZk() string {
- cmd := " solr zk cp zk:/security.json /tmp/current_security.json
>/dev/null 2>&1; " +
+ cmd := " solr zk cp zk:/security.json /tmp/current_security.json -z
$ZK_HOST >/dev/null 2>&1; " +
" GET_CURRENT_SECURITY_JSON_EXIT_CODE=$?; " +
"if [ ${GET_CURRENT_SECURITY_JSON_EXIT_CODE} -eq 0 ]; then " +
// JSON already exists
"if [ ! -s /tmp/current_security.json ] || grep -q '^{}$'
/tmp/current_security.json ]; then " + // File doesn't exist, is empty, or is
just '{}'
" echo $SECURITY_JSON > /tmp/security.json;" +
- " solr zk cp /tmp/security.json zk:/security.json >/dev/null
2>&1; " +
+ " solr zk cp /tmp/security.json zk:/security.json -z $ZK_HOST
>/dev/null 2>&1; " +
" echo 'Blank security.json found. Put new security.json in
ZK'; " +
"fi; " + // TODO: Consider checking a diff and still applying
over the top
"elif [ ${GET_CURRENT_SECURITY_JSON_EXIT_CODE} -eq 1 ]; then "
+ // JSON doesn't exist, but not other error types
" echo $SECURITY_JSON > /tmp/security.json;" +
- " solr zk cp /tmp/security.json zk:/security.json >/dev/null
2>&1; " +
+ " solr zk cp /tmp/security.json zk:/security.json -z $ZK_HOST
>/dev/null 2>&1; " +
" echo 'No security.json found. Put new security.json in ZK'; "
+
"fi"
return cmd
diff --git a/helm/solr-operator/Chart.yaml b/helm/solr-operator/Chart.yaml
index d14fd98..30d7b85 100644
--- a/helm/solr-operator/Chart.yaml
+++ b/helm/solr-operator/Chart.yaml
@@ -55,16 +55,15 @@ annotations:
# Allowed syntax is described at:
https://artifacthub.io/docs/topics/annotations/helm/#example
# 'kind' accepts values: "added", "changed", "deprecated", "removed",
"fixed" and "security"
artifacthub.io/changes: |
- - kind: added
- description: Addition 1
+ - kind: fixed
+ description: "initContainers can once again connect to ZooKeeper when
Solr 9.8.x images are used"
links:
- name: Github Issue
- url: https://github.com/issue-url
- - kind: changed
- description: Change 2
- links:
+ url: https://github.com/apache/solr-operator/issues/762
+ - name: JIRA Issue
+ url: https://issues.apache.org/jira/browse/SOLR-17690
- name: Github PR
- url: https://github.com/pr-url
+ url: https://github.com/apache/solr-operator/pull/756
artifacthub.io/images: |
- name: solr-operator
image: apache/solr-operator:v0.9.1-prerelease