Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions controllers/solrcloud_controller_basic_auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,11 @@ func expectBasicAuthConfigOnPodTemplateWithGomega(g Gomega, solrCloud *solrv1bet
// if the zookeeperRef has ACLs set, verify the env vars were set correctly for this initContainer
allACL, _ := solrCloud.Spec.ZookeeperRef.GetACLs()
if allACL != nil {
g.Expect(expInitContainer.Env).To(HaveLen(10), "Wrong number of env vars using ACLs and Basic Auth")
g.Expect(expInitContainer.Env[len(expInitContainer.Env)-2].Name).To(Equal("SOLR_OPTS"), "Env var SOLR_OPTS is misplaced the Solr Pod env vars")
g.Expect(expInitContainer.Env[len(expInitContainer.Env)-1].Name).To(Equal("SECURITY_JSON"), "Env var SECURITY_JSON is misplaced the Solr Pod env vars")
testACLEnvVarsWithGomega(g, expInitContainer.Env[3:len(expInitContainer.Env)-2], true)
g.Expect(expInitContainer.Env).To(HaveLen(11), "Wrong number of env vars using ACLs and Basic Auth")
g.Expect(expInitContainer.Env[len(expInitContainer.Env)-3].Name).To(Equal("SOLR_OPTS"), "Env var SOLR_OPTS is misplaced among the initContainer env vars")
g.Expect(expInitContainer.Env[len(expInitContainer.Env)-2].Name).To(Equal("SOLR_TOOL_OPTS"), "Env var SOLR_TOOL_OPTS is misplaced among the initContainer env vars")
g.Expect(expInitContainer.Env[len(expInitContainer.Env)-1].Name).To(Equal("SECURITY_JSON"), "Env var SECURITY_JSON is misplaced among the initContainer env vars")
testACLEnvVarsWithGomega(g, expInitContainer.Env[3:len(expInitContainer.Env)-3], true)
} // else this ref not using ACLs

expectPutSecurityJsonInZkCmd(g, expInitContainer)
Expand Down
6 changes: 3 additions & 3 deletions controllers/solrcloud_controller_zk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -583,9 +583,9 @@ var _ = FDescribe("SolrCloud controller - Zookeeper", func() {
testPodEnvVariables(expectedEnvVars, statefulSet.Spec.Template.Spec.Containers[0].Env)

expectedInitContainerEnvVars := map[string]string{
"SOLR_ZK_OPTS": testSolrZKOpts,
"SOLR_OPTS": "$(SOLR_ZK_OPTS) " + testSolrOpts,
"ZKCLI_JVM_FLAGS": "-Dsolr.zk.opts=this",
"SOLR_ZK_OPTS": testSolrZKOpts,
"SOLR_OPTS": "$(SOLR_ZK_OPTS) " + testSolrOpts,
"SOLR_TOOL_OPTS": "$(SOLR_ZK_OPTS) " + testSolrOpts,
}
testPodEnvVariables(expectedInitContainerEnvVars, statefulSet.Spec.Template.Spec.InitContainers[1].Env)
})
Expand Down
13 changes: 7 additions & 6 deletions controllers/util/solr_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ package util

import (
"fmt"
"sort"
"strconv"
"strings"

solr "github.com/apache/solr-operator/api/v1beta1"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
Expand All @@ -28,9 +32,6 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"sort"
"strconv"
"strings"
)

const (
Expand Down Expand Up @@ -1236,6 +1237,9 @@ func generateZKInteractionInitContainer(solrCloud *solr.SolrCloud, solrCloudStat
envVars = append(envVars, corev1.EnvVar{
Name: "SOLR_OPTS",
Value: strings.Join(allSolrOpts, " "),
}, corev1.EnvVar{
Name: "SOLR_TOOL_OPTS",
Value: strings.Join(allSolrOpts, " "),
})
}

Expand All @@ -1251,9 +1255,6 @@ func generateZKInteractionInitContainer(solrCloud *solr.SolrCloud, solrCloudStat

if security != nil && security.SecurityJson != "" {
envVars = append(envVars, corev1.EnvVar{Name: "SECURITY_JSON", ValueFrom: security.SecurityJsonSrc})
if solrCloud.Spec.SolrZkOpts != "" {
envVars = append(envVars, corev1.EnvVar{Name: "ZKCLI_JVM_FLAGS", Value: solrCloud.Spec.SolrZkOpts})
}
cmd += cmdToPutSecurityJsonInZk()
}

Expand Down
7 changes: 7 additions & 0 deletions helm/solr-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ annotations:
url: https://github.com/apache/solr-operator/issues/778
- name: Github PR
url: https://github.com/apache/solr-operator/pull/779
- kind: fixed
description: SOLR_TOOL_OPTS is now set, allowing 'setup-zk' initContainer to obey ZK connection settings
links:
- name: Github Issue
url: https://github.com/apache/solr-operator/issues/717
- name: Github PR
url: https://github.com/apache/solr-operator/pull/804
artifacthub.io/images: |
- name: solr-operator
image: apache/solr-operator:v0.10.0-prerelease
Expand Down
Loading