This is an automated email from the ASF dual-hosted git repository.
houston 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 5fec11f Avoid reset of security.json if get fails (#659) (#660)
5fec11f is described below
commit 5fec11f8ef181a58b1f72123b44ae6532c49b62d
Author: Steffen Moldenhauer <[email protected]>
AuthorDate: Tue Apr 2 23:00:58 2024 +0200
Avoid reset of security.json if get fails (#659) (#660)
---
controllers/solrcloud_controller_basic_auth_test.go | 3 ++-
controllers/util/solr_security_util.go | 2 +-
helm/solr-operator/Chart.yaml | 6 ++++++
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/controllers/solrcloud_controller_basic_auth_test.go
b/controllers/solrcloud_controller_basic_auth_test.go
index 0018200..cd3fbf5 100644
--- a/controllers/solrcloud_controller_basic_auth_test.go
+++ b/controllers/solrcloud_controller_basic_auth_test.go
@@ -20,6 +20,7 @@ package controllers
import (
"context"
"fmt"
+
solrv1beta1 "github.com/apache/solr-operator/api/v1beta1"
"github.com/apache/solr-operator/controllers/util"
. "github.com/onsi/ginkgo/v2"
@@ -350,7 +351,7 @@ 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 :=
"ZK_SECURITY_JSON=$(/opt/solr/server/scripts/cloud-scripts/zkcli.sh -zkhost
${ZK_HOST} -cmd get /security.json); " +
+ expCmd :=
"ZK_SECURITY_JSON=$(/opt/solr/server/scripts/cloud-scripts/zkcli.sh -zkhost
${ZK_HOST} -cmd get /security.json || echo 'failed-to-get-security.json'); " +
"if [ ${#ZK_SECURITY_JSON} -lt 3 ]; then " +
"echo $SECURITY_JSON > /tmp/security.json; " +
"/opt/solr/server/scripts/cloud-scripts/zkcli.sh -zkhost
${ZK_HOST} -cmd putfile /security.json /tmp/security.json; echo \"put
security.json in ZK\"; fi"
diff --git a/controllers/util/solr_security_util.go
b/controllers/util/solr_security_util.go
index d67dfe1..97f7e60 100644
--- a/controllers/util/solr_security_util.go
+++ b/controllers/util/solr_security_util.go
@@ -238,7 +238,7 @@ func addHostHeaderToProbe(httpGet *corev1.HTTPGetAction,
host string) {
func cmdToPutSecurityJsonInZk() string {
scriptsDir := "/opt/solr/server/scripts/cloud-scripts"
- cmd := " ZK_SECURITY_JSON=$(%s/zkcli.sh -zkhost ${ZK_HOST} -cmd get
/security.json); "
+ cmd := " ZK_SECURITY_JSON=$(%s/zkcli.sh -zkhost ${ZK_HOST} -cmd get
/security.json || echo 'failed-to-get-security.json'); "
cmd += "if [ ${#ZK_SECURITY_JSON} -lt 3 ]; then echo $SECURITY_JSON >
/tmp/security.json; %s/zkcli.sh -zkhost ${ZK_HOST} -cmd putfile /security.json
/tmp/security.json; echo \"put security.json in ZK\"; fi"
return fmt.Sprintf(cmd, scriptsDir, scriptsDir)
}
diff --git a/helm/solr-operator/Chart.yaml b/helm/solr-operator/Chart.yaml
index fca9878..67a7336 100644
--- a/helm/solr-operator/Chart.yaml
+++ b/helm/solr-operator/Chart.yaml
@@ -62,6 +62,12 @@ annotations:
- name: Github PR
url: https://github.com/apache/solr-operator/pull/648
- kind: fixed
+ description: Avoid reset of security.json if get request fails
+ links:
+ - name: Github Issue
+ url: https://github.com/apache/solr-operator/issues/659
+ - name: Github PR
+ url: https://github.com/apache/solr-operator/pull/660
description: SolrCloud scaling is now safe when using persistent storage
with a 'Delete' reclaim policy
links:
- name: Github Issue