You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ho...@apache.org on 2022/07/07 16:40:08 UTC

[solr-operator] branch main updated: Ability to customize default initContainer resources (#451)

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 8e773dd  Ability to customize default initContainer resources (#451)
8e773dd is described below

commit 8e773dd2865a93a037509e1b2943fa07c7772f0a
Author: Houston Putman <ho...@apache.org>
AuthorDate: Thu Jul 7 12:40:03 2022 -0400

    Ability to customize default initContainer resources (#451)
    
    Also add reasonable default resources for these initContainers
---
 api/v1beta1/common_types.go                        |  7 ++-
 api/v1beta1/solrcloud_types.go                     |  3 +-
 api/v1beta1/zz_generated.deepcopy.go               |  1 +
 config/crd/bases/solr.apache.org_solrclouds.yaml   | 26 ++++++++++-
 .../solr.apache.org_solrprometheusexporters.yaml   | 24 ++++++++++-
 controllers/controller_utils_test.go               |  8 ++++
 controllers/solrcloud_controller_test.go           | 12 +++++-
 .../solrprometheusexporter_controller_test.go      |  1 +
 controllers/util/solr_util.go                      | 35 +++++++++++++++
 helm/solr-operator/Chart.yaml                      |  7 +++
 helm/solr-operator/crds/crds.yaml                  | 50 ++++++++++++++++++++--
 helm/solr/README.md                                |  2 +
 helm/solr/templates/_custom_option_helpers.tpl     |  4 ++
 helm/solr/values.yaml                              |  3 ++
 14 files changed, 171 insertions(+), 12 deletions(-)

diff --git a/api/v1beta1/common_types.go b/api/v1beta1/common_types.go
index c75213b..b440b90 100644
--- a/api/v1beta1/common_types.go
+++ b/api/v1beta1/common_types.go
@@ -61,8 +61,7 @@ type PodOptions struct {
 	// +optional
 	Affinity *corev1.Affinity `json:"affinity,omitempty"`
 
-	// Resources is the resource requirements for the container.
-	// This field cannot be updated once the cluster is created.
+	// Resources is the resource requirements for the default container.
 	// +optional
 	Resources corev1.ResourceRequirements `json:"resources,omitempty"`
 
@@ -150,6 +149,10 @@ type PodOptions struct {
 	// +listMapKey=whenUnsatisfiable
 	// +optional
 	TopologySpreadConstraints []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
+
+	// DefaultInitContainerResources are the resource requirements for the default init container(s) created by the Solr Operator, if any are created.
+	// +optional
+	DefaultInitContainerResources corev1.ResourceRequirements `json:"defaultInitContainerResources,omitempty"`
 }
 
 // ServiceOptions defines custom options for services
diff --git a/api/v1beta1/solrcloud_types.go b/api/v1beta1/solrcloud_types.go
index 7b8da4f..dd2344d 100644
--- a/api/v1beta1/solrcloud_types.go
+++ b/api/v1beta1/solrcloud_types.go
@@ -978,8 +978,7 @@ type ZookeeperPodPolicy struct {
 	// +optional
 	Env []corev1.EnvVar `json:"env,omitempty"`
 
-	// Resources is the resource requirements for the container.
-	// This field cannot be updated once the cluster is created.
+	// Resources is the resource requirements for the Zookeeper container.
 	// +optional
 	Resources corev1.ResourceRequirements `json:"resources,omitempty"`
 
diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go
index 5cf969d..235b6ea 100644
--- a/api/v1beta1/zz_generated.deepcopy.go
+++ b/api/v1beta1/zz_generated.deepcopy.go
@@ -525,6 +525,7 @@ func (in *PodOptions) DeepCopyInto(out *PodOptions) {
 			(*in)[i].DeepCopyInto(&(*out)[i])
 		}
 	}
+	in.DefaultInitContainerResources.DeepCopyInto(&out.DefaultInitContainerResources)
 }
 
 // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodOptions.
diff --git a/config/crd/bases/solr.apache.org_solrclouds.yaml b/config/crd/bases/solr.apache.org_solrclouds.yaml
index 163d9e3..d26e086 100644
--- a/config/crd/bases/solr.apache.org_solrclouds.yaml
+++ b/config/crd/bases/solr.apache.org_solrclouds.yaml
@@ -1563,6 +1563,28 @@ spec:
                           type: string
                         description: Annotations to be added for pods.
                         type: object
+                      defaultInitContainerResources:
+                        description: DefaultInitContainerResources are the resource requirements for the default init container(s) created by the Solr Operator, if any are created.
+                        properties:
+                          limits:
+                            additionalProperties:
+                              anyOf:
+                              - type: integer
+                              - type: string
+                              pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+                              x-kubernetes-int-or-string: true
+                            description: 'Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
+                            type: object
+                          requests:
+                            additionalProperties:
+                              anyOf:
+                              - type: integer
+                              - type: string
+                              pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+                              x-kubernetes-int-or-string: true
+                            description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
+                            type: object
+                        type: object
                       envVars:
                         description: Additional environment variables to pass to the default container.
                         items:
@@ -2782,7 +2804,7 @@ spec:
                             type: integer
                         type: object
                       resources:
-                        description: Resources is the resource requirements for the container. This field cannot be updated once the cluster is created.
+                        description: Resources is the resource requirements for the default container.
                         properties:
                           limits:
                             additionalProperties:
@@ -5888,7 +5910,7 @@ spec:
                             description: Node Selector to be added on pods.
                             type: object
                           resources:
-                            description: Resources is the resource requirements for the container. This field cannot be updated once the cluster is created.
+                            description: Resources is the resource requirements for the Zookeeper container.
                             properties:
                               limits:
                                 additionalProperties:
diff --git a/config/crd/bases/solr.apache.org_solrprometheusexporters.yaml b/config/crd/bases/solr.apache.org_solrprometheusexporters.yaml
index 636b17d..ee12b31 100644
--- a/config/crd/bases/solr.apache.org_solrprometheusexporters.yaml
+++ b/config/crd/bases/solr.apache.org_solrprometheusexporters.yaml
@@ -458,6 +458,28 @@ spec:
                           type: string
                         description: Annotations to be added for pods.
                         type: object
+                      defaultInitContainerResources:
+                        description: DefaultInitContainerResources are the resource requirements for the default init container(s) created by the Solr Operator, if any are created.
+                        properties:
+                          limits:
+                            additionalProperties:
+                              anyOf:
+                              - type: integer
+                              - type: string
+                              pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+                              x-kubernetes-int-or-string: true
+                            description: 'Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
+                            type: object
+                          requests:
+                            additionalProperties:
+                              anyOf:
+                              - type: integer
+                              - type: string
+                              pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+                              x-kubernetes-int-or-string: true
+                            description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
+                            type: object
+                        type: object
                       envVars:
                         description: Additional environment variables to pass to the default container.
                         items:
@@ -1677,7 +1699,7 @@ spec:
                             type: integer
                         type: object
                       resources:
-                        description: Resources is the resource requirements for the container. This field cannot be updated once the cluster is created.
+                        description: Resources is the resource requirements for the default container.
                         properties:
                           limits:
                             additionalProperties:
diff --git a/controllers/controller_utils_test.go b/controllers/controller_utils_test.go
index cd707c1..d4e16ad 100644
--- a/controllers/controller_utils_test.go
+++ b/controllers/controller_utils_test.go
@@ -869,6 +869,14 @@ var (
 			corev1.ResourceEphemeralStorage: resource.MustParse("5Gi"),
 		},
 	}
+	testResources2 = corev1.ResourceRequirements{
+		Limits: map[corev1.ResourceName]resource.Quantity{
+			corev1.ResourceCPU: *resource.NewMilliQuantity(400, resource.DecimalSI),
+		},
+		Requests: map[corev1.ResourceName]resource.Quantity{
+			corev1.ResourceEphemeralStorage: resource.MustParse("3Gi"),
+		},
+	}
 	extraContainers1 = []corev1.Container{
 		{
 			Name:                     "container1",
diff --git a/controllers/solrcloud_controller_test.go b/controllers/solrcloud_controller_test.go
index 3753af3..86d07f3 100644
--- a/controllers/solrcloud_controller_test.go
+++ b/controllers/solrcloud_controller_test.go
@@ -160,6 +160,7 @@ var _ = FDescribe("SolrCloud controller - General", func() {
 				ZookeeperRef: &solrv1beta1.ZookeeperRef{
 					ConnectionInfo: &solrv1beta1.ZookeeperConnectionInfo{
 						InternalConnectionString: "host:7271",
+						ChRoot:                   "/test",
 					},
 				},
 				UpdateStrategy: solrv1beta1.SolrUpdateStrategy{
@@ -171,6 +172,7 @@ var _ = FDescribe("SolrCloud controller - General", func() {
 					PodOptions: &solrv1beta1.PodOptions{
 						Annotations:    testPodAnnotations,
 						Labels:         testPodLabels,
+						Resources:      testResources,
 						Tolerations:    testTolerations,
 						NodeSelector:   testNodeSelectors,
 						LivenessProbe:  testProbeLivenessNonDefaults,
@@ -181,6 +183,8 @@ var _ = FDescribe("SolrCloud controller - General", func() {
 						TerminationGracePeriodSeconds: &testTerminationGracePeriodSeconds,
 						ServiceAccountName:            testServiceAccountName,
 						TopologySpreadConstraints:     testTopologySpreadConstraints,
+						DefaultInitContainerResources: testResources2,
+						InitContainers:                extraContainers1,
 					},
 					StatefulSetOptions: &solrv1beta1.StatefulSetOptions{
 						Annotations:         testSSAnnotations,
@@ -216,7 +220,7 @@ var _ = FDescribe("SolrCloud controller - General", func() {
 
 			Expect(statefulSet.Spec.Template.Spec.Containers).To(HaveLen(1), "Solr StatefulSet requires a container.")
 			expectedEnvVars := map[string]string{
-				"ZK_HOST":        "host:7271/",
+				"ZK_HOST":        "host:7271/test",
 				"SOLR_HOST":      "$(POD_HOSTNAME).foo-solrcloud-headless.default",
 				"SOLR_PORT":      "8983",
 				"SOLR_NODE_PORT": "8983",
@@ -225,7 +229,7 @@ var _ = FDescribe("SolrCloud controller - General", func() {
 				"SOLR_STOP_WAIT": strconv.FormatInt(testTerminationGracePeriodSeconds-5, 10),
 			}
 			expectedStatefulSetLabels := util.MergeLabelsOrAnnotations(solrCloud.SharedLabelsWith(solrCloud.Labels), map[string]string{"technology": util.SolrCloudPVCTechnology})
-			expectedStatefulSetAnnotations := map[string]string{util.SolrZKConnectionStringAnnotation: "host:7271/"}
+			expectedStatefulSetAnnotations := map[string]string{util.SolrZKConnectionStringAnnotation: "host:7271/test"}
 			testPodEnvVariables(expectedEnvVars, statefulSet.Spec.Template.Spec.Containers[0].Env)
 			Expect(statefulSet.Labels).To(Equal(util.MergeLabelsOrAnnotations(expectedStatefulSetLabels, testSSLabels)), "Incorrect statefulSet labels")
 			Expect(statefulSet.Annotations).To(Equal(util.MergeLabelsOrAnnotations(expectedStatefulSetAnnotations, testSSAnnotations)), "Incorrect statefulSet annotations")
@@ -240,6 +244,10 @@ var _ = FDescribe("SolrCloud controller - General", func() {
 			Expect(statefulSet.Spec.Template.Spec.Containers[0].ReadinessProbe, testProbeReadinessNonDefaults, "Incorrect Readiness Probe")
 			Expect(statefulSet.Spec.Template.Spec.Containers[0].StartupProbe, testProbeStartup, "Incorrect Startup Probe")
 			Expect(statefulSet.Spec.Template.Spec.Containers[0].Lifecycle).To(Equal(testLifecycle), "Incorrect container lifecycle")
+			Expect(statefulSet.Spec.Template.Spec.Containers[0].Resources).To(Equal(testResources), "Incorrect container resources")
+			Expect(statefulSet.Spec.Template.Spec.InitContainers[0].Resources).To(Equal(testResources2), "Incorrect initContainer[0] resources")
+			Expect(statefulSet.Spec.Template.Spec.InitContainers[1].Resources).To(Equal(testResources2), "Incorrect initContainer[1] resources")
+			Expect(statefulSet.Spec.Template.Spec.InitContainers[2].Resources).ToNot(Equal(testResources2), "Incorrect initContainer[2] resources, should not use the default override")
 			Expect(statefulSet.Spec.Template.Spec.Tolerations).To(Equal(testTolerations), "Incorrect Tolerations for Pod")
 			Expect(statefulSet.Spec.Template.Spec.PriorityClassName).To(Equal(testPriorityClass), "Incorrect Priority class name for Pod Spec")
 			Expect(statefulSet.Spec.Template.Spec.ImagePullSecrets).To(ConsistOf(append(testAdditionalImagePullSecrets, corev1.LocalObjectReference{Name: testImagePullSecretName})), "Incorrect imagePullSecrets")
diff --git a/controllers/solrprometheusexporter_controller_test.go b/controllers/solrprometheusexporter_controller_test.go
index c20f751..49f59c6 100644
--- a/controllers/solrprometheusexporter_controller_test.go
+++ b/controllers/solrprometheusexporter_controller_test.go
@@ -162,6 +162,7 @@ var _ = FDescribe("SolrPrometheusExporter controller - General", func() {
 						ServiceAccountName:            testServiceAccountName,
 						Lifecycle:                     testLifecycle,
 						TopologySpreadConstraints:     testTopologySpreadConstraints,
+						DefaultInitContainerResources: testResources2,
 					},
 					DeploymentOptions: &solrv1beta1.DeploymentOptions{
 						Annotations: testDeploymentAnnotations,
diff --git a/controllers/util/solr_util.go b/controllers/util/solr_util.go
index 6f929eb..31e516c 100644
--- a/controllers/util/solr_util.go
+++ b/controllers/util/solr_util.go
@@ -23,6 +23,7 @@ import (
 	appsv1 "k8s.io/api/apps/v1"
 	corev1 "k8s.io/api/core/v1"
 	netv1 "k8s.io/api/networking/v1"
+	"k8s.io/apimachinery/pkg/api/resource"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/util/intstr"
 	"sort"
@@ -57,6 +58,13 @@ const (
 	ContribLibs = "/opt/solr/contrib/%s/lib"
 )
 
+var (
+	DefaultSolrVolumePrepInitContainerMemory = resource.NewScaledQuantity(50, 6)
+	DefaultSolrVolumePrepInitContainerCPU    = resource.NewMilliQuantity(50, resource.DecimalExponent)
+	DefaultSolrZKPrepInitContainerMemory     = resource.NewScaledQuantity(200, 6)
+	DefaultSolrZKPrepInitContainerCPU        = resource.NewMilliQuantity(400, resource.DecimalExponent)
+)
+
 // GenerateStatefulSet returns a new appsv1.StatefulSet pointer generated for the SolrCloud instance
 // object: SolrCloud instance
 // replicas: the number of replicas for the SolrCloud instance
@@ -607,12 +615,20 @@ func generateSolrSetupInitContainers(solrCloud *solr.SolrCloud, solrCloudStatus
 		}
 	}
 
+	volumePrepResources := corev1.ResourceList{
+		corev1.ResourceCPU:    *DefaultSolrVolumePrepInitContainerCPU,
+		corev1.ResourceMemory: *DefaultSolrVolumePrepInitContainerMemory,
+	}
 	volumePrepInitContainer := corev1.Container{
 		Name:            "cp-solr-xml",
 		Image:           solrCloud.Spec.BusyBoxImage.ToImageName(),
 		ImagePullPolicy: solrCloud.Spec.BusyBoxImage.PullPolicy,
 		Command:         []string{"sh", "-c", strings.Join(setupCommands, " && ")},
 		VolumeMounts:    volumeMounts,
+		Resources: corev1.ResourceRequirements{
+			Requests: volumePrepResources,
+			Limits:   volumePrepResources,
+		},
 	}
 
 	containers = append(containers, volumePrepInitContainer)
@@ -621,6 +637,17 @@ func generateSolrSetupInitContainers(solrCloud *solr.SolrCloud, solrCloudStatus
 		containers = append(containers, zkSetupContainer)
 	}
 
+	// If the user has provided custom resources for the default init containers, use them
+	customPodOptions := solrCloud.Spec.CustomSolrKubeOptions.PodOptions
+	if nil != customPodOptions {
+		resources := customPodOptions.DefaultInitContainerResources
+		if resources.Limits != nil || resources.Requests != nil {
+			for i := range containers {
+				containers[i].Resources = resources
+			}
+		}
+	}
+
 	return containers
 }
 
@@ -1068,6 +1095,10 @@ func generateZKInteractionInitContainer(solrCloud *solr.SolrCloud, solrCloudStat
 		cmd += cmdToPutSecurityJsonInZk()
 	}
 
+	zkSetupResources := corev1.ResourceList{
+		corev1.ResourceCPU:    *DefaultSolrZKPrepInitContainerCPU,
+		corev1.ResourceMemory: *DefaultSolrZKPrepInitContainerMemory,
+	}
 	if cmd != "" {
 		return true, corev1.Container{
 			Name:                     "setup-zk",
@@ -1077,6 +1108,10 @@ func generateZKInteractionInitContainer(solrCloud *solr.SolrCloud, solrCloudStat
 			TerminationMessagePolicy: "File",
 			Command:                  []string{"sh", "-c", cmd},
 			Env:                      envVars,
+			Resources: corev1.ResourceRequirements{
+				Requests: zkSetupResources,
+				Limits:   zkSetupResources,
+			},
 		}
 	}
 
diff --git a/helm/solr-operator/Chart.yaml b/helm/solr-operator/Chart.yaml
index 908018d..916fb32 100644
--- a/helm/solr-operator/Chart.yaml
+++ b/helm/solr-operator/Chart.yaml
@@ -143,6 +143,13 @@ annotations:
           url: https://github.com/apache/solr-operator/issues/386
         - name: Github PR
           url: https://github.com/apache/solr-operator/pull/454
+    - kind: added
+      description: SolrCloud default initContainer(s) can now have their resources customized via `podOptions.defaultInitContainerResources`. These initContainers now include default resources.
+      links:
+        - name: Github Issue
+          url: https://github.com/apache/solr-operator/issues/448
+        - name: Github PR
+          url: https://github.com/apache/solr-operator/pull/451
   artifacthub.io/images: |
     - name: solr-operator
       image: apache/solr-operator:v0.6.0-prerelease
diff --git a/helm/solr-operator/crds/crds.yaml b/helm/solr-operator/crds/crds.yaml
index 26b52a6..2f68e55 100644
--- a/helm/solr-operator/crds/crds.yaml
+++ b/helm/solr-operator/crds/crds.yaml
@@ -1795,6 +1795,28 @@ spec:
                           type: string
                         description: Annotations to be added for pods.
                         type: object
+                      defaultInitContainerResources:
+                        description: DefaultInitContainerResources are the resource requirements for the default init container(s) created by the Solr Operator, if any are created.
+                        properties:
+                          limits:
+                            additionalProperties:
+                              anyOf:
+                              - type: integer
+                              - type: string
+                              pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+                              x-kubernetes-int-or-string: true
+                            description: 'Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
+                            type: object
+                          requests:
+                            additionalProperties:
+                              anyOf:
+                              - type: integer
+                              - type: string
+                              pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+                              x-kubernetes-int-or-string: true
+                            description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
+                            type: object
+                        type: object
                       envVars:
                         description: Additional environment variables to pass to the default container.
                         items:
@@ -3014,7 +3036,7 @@ spec:
                             type: integer
                         type: object
                       resources:
-                        description: Resources is the resource requirements for the container. This field cannot be updated once the cluster is created.
+                        description: Resources is the resource requirements for the default container.
                         properties:
                           limits:
                             additionalProperties:
@@ -6120,7 +6142,7 @@ spec:
                             description: Node Selector to be added on pods.
                             type: object
                           resources:
-                            description: Resources is the resource requirements for the container. This field cannot be updated once the cluster is created.
+                            description: Resources is the resource requirements for the Zookeeper container.
                             properties:
                               limits:
                                 additionalProperties:
@@ -6853,6 +6875,28 @@ spec:
                           type: string
                         description: Annotations to be added for pods.
                         type: object
+                      defaultInitContainerResources:
+                        description: DefaultInitContainerResources are the resource requirements for the default init container(s) created by the Solr Operator, if any are created.
+                        properties:
+                          limits:
+                            additionalProperties:
+                              anyOf:
+                              - type: integer
+                              - type: string
+                              pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+                              x-kubernetes-int-or-string: true
+                            description: 'Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
+                            type: object
+                          requests:
+                            additionalProperties:
+                              anyOf:
+                              - type: integer
+                              - type: string
+                              pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+                              x-kubernetes-int-or-string: true
+                            description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
+                            type: object
+                        type: object
                       envVars:
                         description: Additional environment variables to pass to the default container.
                         items:
@@ -8072,7 +8116,7 @@ spec:
                             type: integer
                         type: object
                       resources:
-                        description: Resources is the resource requirements for the container. This field cannot be updated once the cluster is created.
+                        description: Resources is the resource requirements for the default container.
                         properties:
                           limits:
                             additionalProperties:
diff --git a/helm/solr/README.md b/helm/solr/README.md
index 8cf4c5b..a6ce3e0 100644
--- a/helm/solr/README.md
+++ b/helm/solr/README.md
@@ -260,6 +260,8 @@ When using the helm chart, omit `customSolrKubeOptions.`
 | podOptions.labels | map[string]string |  | Custom labels to add to the Solr pod |
 | podOptions.resources.limits | map[string]string |  | Provide Resource limits for the Solr container |
 | podOptions.resources.requests | map[string]string |  | Provide Resource requests for the Solr container |
+| podOptions.defaultInitContainerResources.limits | map[string]string |  | Provide Resource limits for Solr's default initContainer(s) |
+| podOptions.defaultInitContainerResources.requests | map[string]string |  | Provide Resource requests for Solr's default initContainer(s) |
 | podOptions.nodeSelector | map[string]string |  | Add a node selector for the Solr pod, to specify where it can be scheduled |
 | podOptions.affinity | object |  | Add Kubernetes affinity information for the Solr pod |
 | podOptions.tolerations | []object |  | Specify a list of Kubernetes tolerations for the Solr pod |
diff --git a/helm/solr/templates/_custom_option_helpers.tpl b/helm/solr/templates/_custom_option_helpers.tpl
index a1dda9a..d2b9b58 100644
--- a/helm/solr/templates/_custom_option_helpers.tpl
+++ b/helm/solr/templates/_custom_option_helpers.tpl
@@ -98,6 +98,10 @@ initContainers:
 topologySpreadConstraints:
   {{- toYaml .Values.podOptions.topologySpreadConstraints | nindent 2 }}
 {{ end }}
+{{- if .Values.podOptions.defaultInitContainerResources -}}
+defaultInitContainerResources:
+  {{- toYaml .Values.podOptions.defaultInitContainerResources | nindent 2 }}
+{{ end }}
 {{- end -}}
 
 {{/*
diff --git a/helm/solr/values.yaml b/helm/solr/values.yaml
index 301c534..d49ea54 100644
--- a/helm/solr/values.yaml
+++ b/helm/solr/values.yaml
@@ -296,6 +296,9 @@ podOptions:
     #   cpu: 500m
     #   memory: 4G
 
+  # Resources for the init containers created by the Solr Operator
+  defaultInitContainerResources: {}
+
   volumes: []
     # - name:
     #   defaultContainerMount: {}