From b5d17436c55c3ee63bdb6115f86f8ef8ba251a14 Mon Sep 17 00:00:00 2001 From: Jason Gerlowski Date: Mon, 6 Jan 2025 21:20:47 -0500 Subject: [PATCH] Address review comments, rd 1 --- api/v1beta1/common_types.go | 2 +- api/v1beta1/zz_generated.deepcopy.go | 5 ----- controllers/solrcloud_controller_test.go | 2 +- controllers/util/solr_util.go | 4 +--- helm/solr/README.md | 1 + helm/solr/templates/_custom_option_helpers.tpl | 3 +++ helm/solr/values.yaml | 2 ++ 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/api/v1beta1/common_types.go b/api/v1beta1/common_types.go index 5920a9ef..6f921a41 100644 --- a/api/v1beta1/common_types.go +++ b/api/v1beta1/common_types.go @@ -139,7 +139,7 @@ type PodOptions struct { // Should process namespace sharing be enabled on created pods // +optional - ShareProcessNamespace *bool `json:"shareProcessNamespace,omitempty"` + ShareProcessNamespace bool `json:"shareProcessNamespace,omitempty"` // Optional PodSpreadTopologyConstraints to use when scheduling pods. // More information here: https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/ diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index f93d8ebe..87e030ff 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -518,11 +518,6 @@ func (in *PodOptions) DeepCopyInto(out *PodOptions) { *out = new(int64) **out = **in } - if in.ShareProcessNamespace != nil { - in, out := &in.ShareProcessNamespace, &out.ShareProcessNamespace - *out = new(bool) - **out = **in - } if in.TopologySpreadConstraints != nil { in, out := &in.TopologySpreadConstraints, &out.TopologySpreadConstraints *out = make([]v1.TopologySpreadConstraint, len(*in)) diff --git a/controllers/solrcloud_controller_test.go b/controllers/solrcloud_controller_test.go index 402a2f02..c1dbc11b 100644 --- a/controllers/solrcloud_controller_test.go +++ b/controllers/solrcloud_controller_test.go @@ -216,7 +216,7 @@ var _ = FDescribe("SolrCloud controller - General", func() { TopologySpreadConstraints: testTopologySpreadConstraints, DefaultInitContainerResources: testResources2, InitContainers: extraContainers1, - ShareProcessNamespace: &testShareProcessNamespace, + ShareProcessNamespace: testShareProcessNamespace, }, StatefulSetOptions: &solrv1beta1.StatefulSetOptions{ Annotations: testSSAnnotations, diff --git a/controllers/util/solr_util.go b/controllers/util/solr_util.go index 2e84a90a..64b9ba12 100644 --- a/controllers/util/solr_util.go +++ b/controllers/util/solr_util.go @@ -123,9 +123,7 @@ func GenerateStatefulSet(solrCloud *solr.SolrCloud, solrCloudStatus *solr.SolrCl if customPodOptions.TerminationGracePeriodSeconds != nil { terminationGracePeriod = *customPodOptions.TerminationGracePeriodSeconds } - if customPodOptions.ShareProcessNamespace != nil { - shareProcessNamespace = *customPodOptions.ShareProcessNamespace - } + shareProcessNamespace = customPodOptions.ShareProcessNamespace } // The isNotStopped readiness gate will always be used for managedUpdates diff --git a/helm/solr/README.md b/helm/solr/README.md index 5aa45a94..bbd0075b 100644 --- a/helm/solr/README.md +++ b/helm/solr/README.md @@ -285,6 +285,7 @@ When using the helm chart, omit `customSolrKubeOptions.` | podOptions.tolerations | []object | | Specify a list of Kubernetes tolerations for the Solr pod | | podOptions.topologySpreadConstraints | []object | | Specify a list of Kubernetes topologySpreadConstraints for the Solr pod. No need to provide a `labelSelector`, as the Solr Operator will default that for you. More information can be found in [the documentation](https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/). | | podOptions.serviceAccountName | string | | Optional serviceAccount to run the Solr pods under | +| podOptions.shareProcessNamespace | boolean | false | Whether containers in a pod should share the same process namespace. | | podOptions.priorityClassName | string | | Optional priorityClassName for the Solr pod | | podOptions.sidecarContainers | []object | | An optional list of additional containers to run along side the Solr in its pod | | podOptions.initContainers | []object | | An optional list of additional initContainers to run before the Solr container starts | diff --git a/helm/solr/templates/_custom_option_helpers.tpl b/helm/solr/templates/_custom_option_helpers.tpl index d2b9b586..5b15f795 100644 --- a/helm/solr/templates/_custom_option_helpers.tpl +++ b/helm/solr/templates/_custom_option_helpers.tpl @@ -36,6 +36,9 @@ resources: {{- if (include "solr.serviceAccountName.solr" .) -}} serviceAccountName: {{ include "solr.serviceAccountName.solr" . }} {{ end }} +{{- if .Values.podOptions.shareProcessNamespace -}} +shareProcessNamespace: {{ .Values.podOptions.shareProcessNamespace}} +{{ end }} {{- if .Values.podOptions.priorityClassName -}} priorityClassName: {{ .Values.podOptions.priorityClassName }} {{ end }} diff --git a/helm/solr/values.yaml b/helm/solr/values.yaml index 216944d5..15171f11 100644 --- a/helm/solr/values.yaml +++ b/helm/solr/values.yaml @@ -300,6 +300,8 @@ podOptions: # Set Solr service account individually instead of the global "serviceAccount.name" serviceAccountName: "" + shareProcessNamespace: false + # Manage where the Solr pods are scheduled affinity: {} tolerations: []