Making java memory configurable (#27)
Signed-off-by: Zane Williamson <zanew@zillow.com>
diff --git a/config/crds/solr_v1beta1_solrcloud.yaml b/config/crds/solr_v1beta1_solrcloud.yaml
index 28c49fe..8afd250 100644
--- a/config/crds/solr_v1beta1_solrcloud.yaml
+++ b/config/crds/solr_v1beta1_solrcloud.yaml
@@ -98,6 +98,8 @@
tag:
type: string
type: object
+ solrJavaMem:
+ type: string
zookeeperRef:
description: The information for the Zookeeper this SolrCloud should
connect to Can be a zookeeper that is running, or one that is created
diff --git a/example/test_solrcloud.yaml b/example/test_solrcloud.yaml
index fbc9248..9bdc880 100644
--- a/example/test_solrcloud.yaml
+++ b/example/test_solrcloud.yaml
@@ -6,3 +6,4 @@
replicas: 4
solrImage:
tag: 8.2.0
+ solrJavaMem: "-Xms1g -Xmx3g"
diff --git a/pkg/apis/solr/v1beta1/solrcloud_types.go b/pkg/apis/solr/v1beta1/solrcloud_types.go
index 39992e6..8cf1408 100644
--- a/pkg/apis/solr/v1beta1/solrcloud_types.go
+++ b/pkg/apis/solr/v1beta1/solrcloud_types.go
@@ -18,10 +18,11 @@
import (
"fmt"
+ "strings"
+
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "strings"
)
const (
@@ -31,6 +32,7 @@
DefaultSolrRepo = "library/solr"
DefaultSolrVersion = "7.7.0"
DefaultSolrStorage = "5Gi"
+ DefaultSolrJavaMem = "-Xms1g -Xmx2g"
DefaultBusyBoxImageRepo = "library/busybox"
DefaultBusyBoxImageVersion = "1.28.0-glibc"
@@ -82,6 +84,9 @@
// +optional
BusyBoxImage *ContainerImage `json:"busyBoxImage,omitempty"`
+
+ // +optional
+ SolrJavaMem string `json:"solrJavaMem,omitempty"`
}
func (spec *SolrCloudSpec) withDefaults() (changed bool) {
@@ -91,6 +96,11 @@
spec.Replicas = &r
}
+ if spec.SolrJavaMem == "" {
+ changed = true
+ spec.SolrJavaMem = DefaultSolrJavaMem
+ }
+
if spec.ZookeeperRef == nil {
spec.ZookeeperRef = &ZookeeperRef{}
}
diff --git a/pkg/controller/util/solr_util.go b/pkg/controller/util/solr_util.go
index 20efc35..6f95a78 100644
--- a/pkg/controller/util/solr_util.go
+++ b/pkg/controller/util/solr_util.go
@@ -174,7 +174,7 @@
Env: []corev1.EnvVar{
{
Name: "SOLR_JAVA_MEM",
- Value: "-Xms1g -Xmx2g",
+ Value: solrCloud.Spec.SolrJavaMem,
},
{
Name: "SOLR_HOME",