Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sysprop driven XML tags to default solr.xml #636

Merged
merged 7 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
4 changes: 2 additions & 2 deletions controllers/solrcloud_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ func (r *SolrCloudReconciler) Reconcile(ctx context.Context, req ctrl.Request) (

if hasSolrXml {
// make sure the user-provided solr.xml is valid
if !strings.Contains(solrXml, "${hostPort:") {
if !strings.Contains(solrXml, "${solr.port.advertise:") {
return requeueOrNot,
fmt.Errorf("custom solr.xml in ConfigMap %s must contain a placeholder for the 'hostPort' variable, such as <int name=\"hostPort\">${hostPort:80}</int>",
fmt.Errorf("custom solr.xml in ConfigMap %s must contain a placeholder for the 'solr.port.advertise' variable, such as <int name=\"hostPort\">${solr.port.advertise:80}</int>",
providedConfigMapName)
}
// stored in the pod spec annotations on the statefulset so that we get a restart when solr.xml changes
Expand Down
6 changes: 3 additions & 3 deletions controllers/solrcloud_controller_backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ var _ = FDescribe("SolrCloud controller - Backup Repositories", func() {
"SOLR_HOST": "$(POD_NAME)." + solrCloud.HeadlessServiceName() + "." + solrCloud.Namespace,
"SOLR_PORT": "8983",
"SOLR_NODE_PORT": "8983",
"SOLR_OPTS": "-DhostPort=$(SOLR_NODE_PORT)",
"SOLR_OPTS": "-Dsolr.port.advertise=$(SOLR_NODE_PORT)",
}
foundEnv := statefulSet.Spec.Template.Spec.Containers[0].Env

Expand Down Expand Up @@ -155,7 +155,7 @@ var _ = FDescribe("SolrCloud controller - Backup Repositories", func() {
"SOLR_PORT": "8983",
"SOLR_NODE_PORT": "8983",
"SOLR_LOG_LEVEL": "INFO",
"SOLR_OPTS": "-DhostPort=$(SOLR_NODE_PORT)",
"SOLR_OPTS": "-Dsolr.port.advertise=$(SOLR_NODE_PORT)",
}
foundEnv := found.Spec.Template.Spec.Containers[0].Env

Expand Down Expand Up @@ -209,7 +209,7 @@ var _ = FDescribe("SolrCloud controller - Backup Repositories", func() {
"SOLR_PORT": "8983",
"SOLR_NODE_PORT": "8983",
"SOLR_LOG_LEVEL": "INFO",
"SOLR_OPTS": "-DhostPort=$(SOLR_NODE_PORT)",
"SOLR_OPTS": "-Dsolr.port.advertise=$(SOLR_NODE_PORT)",
}
foundEnv := found.Spec.Template.Spec.Containers[0].Env

Expand Down
14 changes: 7 additions & 7 deletions controllers/solrcloud_controller_externaldns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ var _ = FDescribe("SolrCloud controller - External DNS", func() {
"SOLR_HOST": "$(POD_NAME)." + solrCloud.Namespace + "." + testDomain,
"SOLR_PORT": "3000",
"SOLR_NODE_PORT": "3000",
"SOLR_OPTS": "-DhostPort=$(SOLR_NODE_PORT)",
"SOLR_OPTS": "-Dsolr.port.advertise=$(SOLR_NODE_PORT)",
}
testPodEnvVariables(expectedEnvVars, statefulSet.Spec.Template.Spec.Containers[0].Env)
Expect(statefulSet.Spec.Template.Spec.Containers[0].Lifecycle.PreStop.Exec.Command).To(Equal([]string{"solr", "stop", "-p", "3000"}), "Incorrect pre-stop command")
Expand Down Expand Up @@ -181,7 +181,7 @@ var _ = FDescribe("SolrCloud controller - External DNS", func() {
"SOLR_HOST": "$(POD_NAME)." + solrCloud.HeadlessServiceName() + "." + solrCloud.Namespace,
"SOLR_PORT": "2000",
"SOLR_NODE_PORT": "2000",
"SOLR_OPTS": "-DhostPort=$(SOLR_NODE_PORT)",
"SOLR_OPTS": "-Dsolr.port.advertise=$(SOLR_NODE_PORT)",
}
testPodEnvVariables(expectedEnvVars, statefulSet.Spec.Template.Spec.Containers[0].Env)
Expect(statefulSet.Spec.Template.Spec.Containers[0].Lifecycle.PreStop.Exec.Command).To(Equal([]string{"solr", "stop", "-p", "2000"}), "Incorrect pre-stop command")
Expand Down Expand Up @@ -252,7 +252,7 @@ var _ = FDescribe("SolrCloud controller - External DNS", func() {
"SOLR_HOST": "$(POD_NAME)." + solrCloud.Namespace + "." + testDomain,
"SOLR_PORT": "3000",
"SOLR_NODE_PORT": "3000",
"SOLR_OPTS": "-DhostPort=$(SOLR_NODE_PORT)",
"SOLR_OPTS": "-Dsolr.port.advertise=$(SOLR_NODE_PORT)",
}
testPodEnvVariables(expectedEnvVars, statefulSet.Spec.Template.Spec.Containers[0].Env)
Expect(statefulSet.Spec.Template.Spec.Containers[0].Lifecycle.PreStop.Exec.Command).To(Equal([]string{"solr", "stop", "-p", "3000"}), "Incorrect pre-stop command")
Expand Down Expand Up @@ -322,7 +322,7 @@ var _ = FDescribe("SolrCloud controller - External DNS", func() {
"SOLR_HOST": "$(POD_NAME)." + solrCloud.HeadlessServiceName() + "." + solrCloud.Namespace,
"SOLR_PORT": "3000",
"SOLR_NODE_PORT": "3000",
"SOLR_OPTS": "-DhostPort=$(SOLR_NODE_PORT)",
"SOLR_OPTS": "-Dsolr.port.advertise=$(SOLR_NODE_PORT)",
}
testPodEnvVariables(expectedEnvVars, statefulSet.Spec.Template.Spec.Containers[0].Env)
Expect(statefulSet.Spec.Template.Spec.Containers[0].Lifecycle.PreStop.Exec.Command).To(Equal([]string{"solr", "stop", "-p", "3000"}), "Incorrect pre-stop command")
Expand Down Expand Up @@ -390,7 +390,7 @@ var _ = FDescribe("SolrCloud controller - External DNS", func() {
"SOLR_HOST": "$(POD_NAME)." + solrCloud.Namespace + "." + testDomain,
"SOLR_PORT": "3000",
"SOLR_NODE_PORT": "3000",
"SOLR_OPTS": "-DhostPort=$(SOLR_NODE_PORT)",
"SOLR_OPTS": "-Dsolr.port.advertise=$(SOLR_NODE_PORT)",
}
testPodEnvVariables(expectedEnvVars, statefulSet.Spec.Template.Spec.Containers[0].Env)
Expect(statefulSet.Spec.Template.Spec.Containers[0].Lifecycle.PreStop.Exec.Command).To(Equal([]string{"solr", "stop", "-p", "3000"}), "Incorrect pre-stop command")
Expand Down Expand Up @@ -470,7 +470,7 @@ var _ = FDescribe("SolrCloud controller - External DNS", func() {
"SOLR_HOST": "$(POD_NAME)." + solrCloud.HeadlessServiceName() + "." + solrCloud.Namespace + ".svc." + testKubeDomain,
"SOLR_PORT": "2000",
"SOLR_NODE_PORT": "2000",
"SOLR_OPTS": "-DhostPort=$(SOLR_NODE_PORT)",
"SOLR_OPTS": "-Dsolr.port.advertise=$(SOLR_NODE_PORT)",
}
testPodEnvVariables(expectedEnvVars, statefulSet.Spec.Template.Spec.Containers[0].Env)
Expect(statefulSet.Spec.Template.Spec.Containers[0].Lifecycle.PreStop.Exec.Command).To(Equal([]string{"solr", "stop", "-p", "2000"}), "Incorrect pre-stop command")
Expand Down Expand Up @@ -535,7 +535,7 @@ var _ = FDescribe("SolrCloud controller - External DNS", func() {
"SOLR_HOST": "$(POD_NAME)." + solrCloud.Namespace + "." + testDomain,
"SOLR_PORT": "2000",
"SOLR_NODE_PORT": "2000",
"SOLR_OPTS": "-DhostPort=$(SOLR_NODE_PORT)",
"SOLR_OPTS": "-Dsolr.port.advertise=$(SOLR_NODE_PORT)",
}
testPodEnvVariables(expectedEnvVars, statefulSet.Spec.Template.Spec.Containers[0].Env)
Expect(statefulSet.Spec.Template.Spec.Containers[0].Lifecycle.PreStop.Exec.Command).To(Equal([]string{"solr", "stop", "-p", "2000"}), "Incorrect pre-stop command")
Expand Down
14 changes: 7 additions & 7 deletions controllers/solrcloud_controller_ingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ var _ = FDescribe("SolrCloud controller - Ingress", func() {
"SOLR_HOST": solrCloud.Namespace + "-$(POD_NAME)." + testDomain,
"SOLR_PORT": "3000",
"SOLR_NODE_PORT": "100",
"SOLR_OPTS": "-DhostPort=$(SOLR_NODE_PORT)",
"SOLR_OPTS": "-Dsolr.port.advertise=$(SOLR_NODE_PORT)",
}
testPodEnvVariables(expectedEnvVars, statefulSet.Spec.Template.Spec.Containers[0].Env)
Expect(statefulSet.Spec.Template.Spec.Containers[0].Lifecycle.PreStop.Exec.Command).To(Equal([]string{"solr", "stop", "-p", "3000"}), "Incorrect pre-stop command")
Expand Down Expand Up @@ -217,7 +217,7 @@ var _ = FDescribe("SolrCloud controller - Ingress", func() {
"SOLR_HOST": "$(POD_NAME)." + solrCloud.HeadlessServiceName() + "." + solrCloud.Namespace,
"SOLR_PORT": "3000",
"SOLR_NODE_PORT": "3000",
"SOLR_OPTS": "-DhostPort=$(SOLR_NODE_PORT)",
"SOLR_OPTS": "-Dsolr.port.advertise=$(SOLR_NODE_PORT)",
}
testPodEnvVariables(expectedEnvVars, statefulSet.Spec.Template.Spec.Containers[0].Env)
Expect(statefulSet.Spec.Template.Spec.Containers[0].Lifecycle.PreStop.Exec.Command).To(Equal([]string{"solr", "stop", "-p", "3000"}), "Incorrect pre-stop command")
Expand Down Expand Up @@ -296,7 +296,7 @@ var _ = FDescribe("SolrCloud controller - Ingress", func() {
"SOLR_HOST": solrCloud.Namespace + "-$(POD_NAME)." + testDomain,
"SOLR_PORT": "3000",
"SOLR_NODE_PORT": "100",
"SOLR_OPTS": "-DhostPort=$(SOLR_NODE_PORT)",
"SOLR_OPTS": "-Dsolr.port.advertise=$(SOLR_NODE_PORT)",
}
testPodEnvVariables(expectedEnvVars, statefulSet.Spec.Template.Spec.Containers[0].Env)
Expect(statefulSet.Spec.Template.Spec.Containers[0].Lifecycle.PreStop.Exec.Command).To(Equal([]string{"solr", "stop", "-p", "3000"}), "Incorrect pre-stop command")
Expand Down Expand Up @@ -373,7 +373,7 @@ var _ = FDescribe("SolrCloud controller - Ingress", func() {
"SOLR_HOST": "$(POD_NAME)." + solrCloud.Namespace,
"SOLR_PORT": "3000",
"SOLR_NODE_PORT": "100",
"SOLR_OPTS": "-DhostPort=$(SOLR_NODE_PORT)",
"SOLR_OPTS": "-Dsolr.port.advertise=$(SOLR_NODE_PORT)",
}
testPodEnvVariables(expectedEnvVars, statefulSet.Spec.Template.Spec.Containers[0].Env)
Expect(statefulSet.Spec.Template.Spec.Containers[0].Lifecycle.PreStop.Exec.Command).To(Equal([]string{"solr", "stop", "-p", "3000"}), "Incorrect pre-stop command")
Expand Down Expand Up @@ -450,7 +450,7 @@ var _ = FDescribe("SolrCloud controller - Ingress", func() {
"SOLR_HOST": solrCloud.Namespace + "-$(POD_NAME)." + testDomain,
"SOLR_PORT": "3000",
"SOLR_NODE_PORT": "100",
"SOLR_OPTS": "-DhostPort=$(SOLR_NODE_PORT)",
"SOLR_OPTS": "-Dsolr.port.advertise=$(SOLR_NODE_PORT)",
}
testPodEnvVariables(expectedEnvVars, statefulSet.Spec.Template.Spec.Containers[0].Env)
Expect(statefulSet.Spec.Template.Spec.Containers[0].Lifecycle.PreStop.Exec.Command).To(Equal([]string{"solr", "stop", "-p", "3000"}), "Incorrect pre-stop command")
Expand Down Expand Up @@ -523,7 +523,7 @@ var _ = FDescribe("SolrCloud controller - Ingress", func() {
"SOLR_HOST": "$(POD_NAME)." + solrCloud.Namespace + ".svc." + testKubeDomain,
"SOLR_PORT": "3000",
"SOLR_NODE_PORT": "100",
"SOLR_OPTS": "-DhostPort=$(SOLR_NODE_PORT)",
"SOLR_OPTS": "-Dsolr.port.advertise=$(SOLR_NODE_PORT)",
}
testPodEnvVariables(expectedEnvVars, statefulSet.Spec.Template.Spec.Containers[0].Env)
Expect(statefulSet.Spec.Template.Spec.Containers[0].Lifecycle.PreStop.Exec.Command).To(Equal([]string{"solr", "stop", "-p", "3000"}), "Incorrect pre-stop command")
Expand Down Expand Up @@ -599,7 +599,7 @@ var _ = FDescribe("SolrCloud controller - Ingress", func() {
"SOLR_HOST": solrCloud.Namespace + "-$(POD_NAME)." + testDomain,
"SOLR_PORT": "3000",
"SOLR_NODE_PORT": "100",
"SOLR_OPTS": "-DhostPort=$(SOLR_NODE_PORT)",
"SOLR_OPTS": "-Dsolr.port.advertise=$(SOLR_NODE_PORT)",
}
testPodEnvVariables(expectedEnvVars, statefulSet.Spec.Template.Spec.Containers[0].Env)
Expect(statefulSet.Spec.Template.Spec.Containers[0].Lifecycle.PreStop.Exec.Command).To(Equal([]string{"solr", "stop", "-p", "3000"}), "Incorrect pre-stop command")
Expand Down
8 changes: 4 additions & 4 deletions controllers/solrcloud_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ var _ = FDescribe("SolrCloud controller - General", func() {
"SOLR_PORT": "8983",
"SOLR_NODE_PORT": "8983",
"SOLR_LOG_LEVEL": "DEBUG",
"SOLR_OPTS": "-DhostPort=$(SOLR_NODE_PORT) extra-opts",
"SOLR_OPTS": "-Dsolr.port.advertise=$(SOLR_NODE_PORT) extra-opts",
}
foundEnv := statefulSet.Spec.Template.Spec.Containers[0].Env
// Note that this check changes the variable foundEnv, so the values are no longer valid afterwards.
Expand Down Expand Up @@ -252,7 +252,7 @@ var _ = FDescribe("SolrCloud controller - General", func() {
"SOLR_PORT": "8983",
"SOLR_NODE_PORT": "8983",
"GC_TUNE": "gc Options",
"SOLR_OPTS": "-DhostPort=$(SOLR_NODE_PORT)",
"SOLR_OPTS": "-Dsolr.port.advertise=$(SOLR_NODE_PORT)",
"SOLR_STOP_WAIT": strconv.FormatInt(testTerminationGracePeriodSeconds-5, 10),
}
expectedStatefulSetLabels := util.MergeLabelsOrAnnotations(solrCloud.SharedLabelsWith(solrCloud.Labels), map[string]string{"technology": util.SolrCloudPVCTechnology})
Expand Down Expand Up @@ -442,7 +442,7 @@ var _ = FDescribe("SolrCloud controller - General", func() {
"SOLR_HOST": "$(POD_NAME)." + solrCloud.HeadlessServiceName() + "." + solrCloud.Namespace + ".svc." + testKubeDomain,
"SOLR_PORT": "2000",
"SOLR_NODE_PORT": "2000",
"SOLR_OPTS": "-DhostPort=$(SOLR_NODE_PORT)",
"SOLR_OPTS": "-Dsolr.port.advertise=$(SOLR_NODE_PORT)",
}
testPodEnvVariables(expectedEnvVars, statefulSet.Spec.Template.Spec.Containers[0].Env)
By("testing the Solr Common Service")
Expand Down Expand Up @@ -696,7 +696,7 @@ var _ = FDescribe("SolrCloud controller - General", func() {
},
Data: map[string]string{
util.LogXmlFile: "<Configuration/>",
util.SolrXmlFile: "<solr> ${hostPort:} </solr>", // the controller checks for ${hostPort: in the solr.xml
util.SolrXmlFile: "<solr> ${solr.port.advertise:} </solr>", // the controller checks for ${hostPort: in the solr.xml
},
}
Expect(k8sClient.Create(ctx, configMap)).To(Succeed(), "Create the valid configMap")
Expand Down
10 changes: 5 additions & 5 deletions controllers/solrcloud_controller_zk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ var _ = FDescribe("SolrCloud controller - Zookeeper", func() {
"SOLR_HOST": "$(POD_NAME)." + solrCloud.HeadlessServiceName() + "." + solrCloud.Namespace,
"SOLR_PORT": "8983",
"SOLR_NODE_PORT": "8983",
"SOLR_OPTS": "-DhostPort=$(SOLR_NODE_PORT) $(SOLR_ZK_CREDS_AND_ACLS) -Dextra -Dopts",
"SOLR_OPTS": "-Dsolr.port.advertise=$(SOLR_NODE_PORT) $(SOLR_ZK_CREDS_AND_ACLS) -Dextra -Dopts",
}
insertExpectedAclEnvVars(expectedEnvVars, false)
for _, envVar := range extraVars {
Expand Down Expand Up @@ -173,7 +173,7 @@ var _ = FDescribe("SolrCloud controller - Zookeeper", func() {
"SOLR_HOST": "$(POD_NAME)." + solrCloud.HeadlessServiceName() + "." + solrCloud.Namespace,
"SOLR_PORT": "8983",
"SOLR_NODE_PORT": "8983",
"SOLR_OPTS": "-DhostPort=$(SOLR_NODE_PORT) $(SOLR_ZK_CREDS_AND_ACLS) -Dextra -Dopts",
"SOLR_OPTS": "-Dsolr.port.advertise=$(SOLR_NODE_PORT) $(SOLR_ZK_CREDS_AND_ACLS) -Dextra -Dopts",
}
insertExpectedAclEnvVars(expectedEnvVars, true)
for _, envVar := range extraVars {
Expand Down Expand Up @@ -454,7 +454,7 @@ var _ = FDescribe("SolrCloud controller - Zookeeper", func() {
"SOLR_PORT": "8983",
"SOLR_NODE_PORT": "8983",
"ZK_CHROOT": "/a-ch/root",
"SOLR_OPTS": "-DhostPort=$(SOLR_NODE_PORT) $(SOLR_ZK_CREDS_AND_ACLS) -Dextra -Dopts",
"SOLR_OPTS": "-Dsolr.port.advertise=$(SOLR_NODE_PORT) $(SOLR_ZK_CREDS_AND_ACLS) -Dextra -Dopts",
}
insertExpectedAclEnvVars(expectedEnvVars, false)
for _, envVar := range extraVars {
Expand Down Expand Up @@ -529,7 +529,7 @@ var _ = FDescribe("SolrCloud controller - Zookeeper", func() {
"SOLR_HOST": "$(POD_NAME)." + solrCloud.HeadlessServiceName() + "." + solrCloud.Namespace,
"SOLR_PORT": "8983",
"SOLR_NODE_PORT": "8983",
"SOLR_OPTS": "-DhostPort=$(SOLR_NODE_PORT) $(SOLR_ZK_CREDS_AND_ACLS) -Dextra -Dopts",
"SOLR_OPTS": "-Dsolr.port.advertise=$(SOLR_NODE_PORT) $(SOLR_ZK_CREDS_AND_ACLS) -Dextra -Dopts",
}
insertExpectedAclEnvVars(expectedEnvVars, true)
for _, envVar := range extraVars {
Expand Down Expand Up @@ -570,7 +570,7 @@ var _ = FDescribe("SolrCloud controller - Zookeeper", func() {
"SOLR_PORT": "8983",
"SOLR_NODE_PORT": "8983",
"SOLR_ZK_OPTS": testSolrZKOpts,
"SOLR_OPTS": "-DhostPort=$(SOLR_NODE_PORT) $(SOLR_ZK_OPTS) " + testSolrOpts,
"SOLR_OPTS": "-Dsolr.port.advertise=$(SOLR_NODE_PORT) $(SOLR_ZK_OPTS) " + testSolrOpts,
"SOLR_STOP_WAIT": strconv.FormatInt(60-5, 10),
}
testPodEnvVariables(expectedEnvVars, statefulSet.Spec.Template.Spec.Containers[0].Env)
Expand Down
28 changes: 15 additions & 13 deletions controllers/util/solr_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ const (

DefaultStatefulSetPodManagementPolicy = appsv1.ParallelPodManagement

DistLibs = "/opt/solr/dist"
ContribLibs = "/opt/solr/contrib/%s/lib"
DistLibs = "/opt/solr/dist"
ContribLibs = "/opt/solr/contrib/%s/lib"
SysPropLibPlaceholder = "${solr.sharedLib:}"
)

var (
Expand Down Expand Up @@ -134,7 +135,7 @@ func GenerateStatefulSet(solrCloud *solr.SolrCloud, solrCloudStatus *solr.SolrCl

// Keep track of the SolrOpts that the Solr Operator needs to set
// These will be added to the SolrOpts given by the user.
allSolrOpts := []string{"-DhostPort=$(SOLR_NODE_PORT)"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we can actually just use an envVar, SOLR_PORT_ADVERTISE, instead of relying on SOLR_OPTS. Makes the code a small bit cleaner 🙂

But we can keep the hostPort in place and deprecate it (So we would be using -DhostPort and SOLR_PORT_ADVERTISE at the same time), to give people with a custom solr.xml a release to change their Solr.xml to use solr.port.advertise, like is used in the official solr.xml. As long as we document it in the upgrade notes, we should be good to go!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right! I forgot bin/solr was set up to convert SOLR_PORT_ADVERTISE to a sysprop that solr.xml can take advantage of, cool. 👍

allSolrOpts := []string{"-Dsolr.port.advertise=$(SOLR_NODE_PORT)"}

// Volumes & Mounts
solrVolumes := []corev1.Volume{
Expand Down Expand Up @@ -771,7 +772,7 @@ const DefaultSolrXML = `<?xml version="1.0" encoding="UTF-8" ?>
%s
<solrcloud>
<str name="host">${host:}</str>
<int name="hostPort">${hostPort:80}</int>
<int name="hostPort">${solr.port.advertise:80}</int>
<str name="hostContext">${hostContext:solr}</str>
<bool name="genericCoreNodeNames">${genericCoreNodeNames:true}</bool>
<int name="zkClientTimeout">${zkClientTimeout:30000}</int>
Expand All @@ -786,6 +787,8 @@ const DefaultSolrXML = `<?xml version="1.0" encoding="UTF-8" ?>
<int name="connTimeout">${connTimeout:60000}</int>
</shardHandlerFactory>
<int name="maxBooleanClauses">${solr.max.booleanClauses:1024}</int>
<str name="allowPaths">${solr.allowPaths:}</str>
<metrics enabled="${metricsEnabled:true}"/>
%s
</solr>
`
Expand Down Expand Up @@ -831,6 +834,9 @@ func GenerateSolrXMLString(backupSection string, solrModules []string, additiona
func GenerateAdditionalLibXMLPart(solrModules []string, additionalLibs []string) string {
libs := make(map[string]bool, 0)

// Placeholder for users to specify libs via sysprop
libs[SysPropLibPlaceholder] = true

// Add all module library locations
if len(solrModules) > 0 {
libs[DistLibs] = true
Expand All @@ -844,16 +850,12 @@ func GenerateAdditionalLibXMLPart(solrModules []string, additionalLibs []string)
libs[libPath] = true
}

libXml := ""
if len(libs) > 0 {
libList := make([]string, 0)
for lib := range libs {
libList = append(libList, lib)
}
sort.Strings(libList)
libXml = fmt.Sprintf("<str name=\"sharedLib\">%s</str>", strings.Join(libList, ","))
libList := make([]string, 0)
for lib := range libs {
libList = append(libList, lib)
}
return libXml
sort.Strings(libList)
return fmt.Sprintf("<str name=\"sharedLib\">%s</str>", strings.Join(libList, ","))
}

func getAppProtocol(solrCloud *solr.SolrCloud) *string {
Expand Down
Loading
Loading