From 55cc6a9e233eb77429ab0160131d3070fa93e1de Mon Sep 17 00:00:00 2001 From: Francesco Pantano Date: Thu, 5 Dec 2024 09:05:15 +0100 Subject: [PATCH] Add parameter to customize the number of manilaAPI processes Signed-off-by: Francesco Pantano --- .../manila.openstack.org_manilaapis.yaml | 8 +++++++ api/bases/manila.openstack.org_manilas.yaml | 8 +++++++ api/v1beta1/manilaapi_types.go | 12 +++++++++++ api/v1beta1/zz_generated.deepcopy.go | 21 +++++++++++++++++++ .../manila.openstack.org_manilaapis.yaml | 8 +++++++ .../bases/manila.openstack.org_manilas.yaml | 8 +++++++ controllers/manila_controller.go | 1 + templates/manila/config/10-manila_wsgi.conf | 2 +- 8 files changed, 67 insertions(+), 1 deletion(-) diff --git a/api/bases/manila.openstack.org_manilaapis.yaml b/api/bases/manila.openstack.org_manilaapis.yaml index b44ea0ff..41a82fee 100644 --- a/api/bases/manila.openstack.org_manilaapis.yaml +++ b/api/bases/manila.openstack.org_manilaapis.yaml @@ -537,6 +537,14 @@ spec: - extraVol type: object type: array + httpdCustomization: + properties: + processNumber: + default: 4 + format: int32 + minimum: 1 + type: integer + type: object networkAttachments: items: type: string diff --git a/api/bases/manila.openstack.org_manilas.yaml b/api/bases/manila.openstack.org_manilas.yaml index d0a53482..ae1994e4 100644 --- a/api/bases/manila.openstack.org_manilas.yaml +++ b/api/bases/manila.openstack.org_manilas.yaml @@ -558,6 +558,14 @@ spec: items: type: string type: array + httpdCustomization: + properties: + processNumber: + default: 4 + format: int32 + minimum: 1 + type: integer + type: object networkAttachments: items: type: string diff --git a/api/v1beta1/manilaapi_types.go b/api/v1beta1/manilaapi_types.go index d21709db..a104802d 100644 --- a/api/v1beta1/manilaapi_types.go +++ b/api/v1beta1/manilaapi_types.go @@ -30,6 +30,18 @@ type ManilaAPITemplate struct { // +kubebuilder:validation:Required // ContainerImage - Manila API Container Image URL ContainerImage string `json:"containerImage"` + + // +kubebuilder:validation:Optional + // HttpdCustomization - customize the httpd service + HttpdCustomization HttpdCustomization `json:"httpdCustomization,omitempty"` +} + +type HttpdCustomization struct { + // +kubebuilder:validation:Optional + // +kubebuilder:default=4 + // +kubebuilder:validation:Minimum=1 + // ProcessNumber - Number of processes running in ManilaAPI + ProcessNumber *int32 `json:"processNumber"` } // ManilaAPITemplateCore - diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index 6f491723..dd47b68c 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -65,6 +65,26 @@ func (in *DBPurge) DeepCopy() *DBPurge { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HttpdCustomization) DeepCopyInto(out *HttpdCustomization) { + *out = *in + if in.ProcessNumber != nil { + in, out := &in.ProcessNumber, &out.ProcessNumber + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HttpdCustomization. +func (in *HttpdCustomization) DeepCopy() *HttpdCustomization { + if in == nil { + return nil + } + out := new(HttpdCustomization) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Manila) DeepCopyInto(out *Manila) { *out = *in @@ -223,6 +243,7 @@ func (in *ManilaAPIStatus) DeepCopy() *ManilaAPIStatus { func (in *ManilaAPITemplate) DeepCopyInto(out *ManilaAPITemplate) { *out = *in in.ManilaAPITemplateCore.DeepCopyInto(&out.ManilaAPITemplateCore) + in.HttpdCustomization.DeepCopyInto(&out.HttpdCustomization) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManilaAPITemplate. diff --git a/config/crd/bases/manila.openstack.org_manilaapis.yaml b/config/crd/bases/manila.openstack.org_manilaapis.yaml index b44ea0ff..41a82fee 100644 --- a/config/crd/bases/manila.openstack.org_manilaapis.yaml +++ b/config/crd/bases/manila.openstack.org_manilaapis.yaml @@ -537,6 +537,14 @@ spec: - extraVol type: object type: array + httpdCustomization: + properties: + processNumber: + default: 4 + format: int32 + minimum: 1 + type: integer + type: object networkAttachments: items: type: string diff --git a/config/crd/bases/manila.openstack.org_manilas.yaml b/config/crd/bases/manila.openstack.org_manilas.yaml index d0a53482..ae1994e4 100644 --- a/config/crd/bases/manila.openstack.org_manilas.yaml +++ b/config/crd/bases/manila.openstack.org_manilas.yaml @@ -558,6 +558,14 @@ spec: items: type: string type: array + httpdCustomization: + properties: + processNumber: + default: 4 + format: int32 + minimum: 1 + type: integer + type: object networkAttachments: items: type: string diff --git a/controllers/manila_controller.go b/controllers/manila_controller.go index f893042d..968343c0 100644 --- a/controllers/manila_controller.go +++ b/controllers/manila_controller.go @@ -897,6 +897,7 @@ func (r *ManilaReconciler) generateServiceConfig( manila.DatabaseCRName), "MemcachedServersWithInet": memcached.GetMemcachedServerListWithInetString(), "TimeOut": instance.Spec.APITimeout, + "Workers": instance.Spec.ManilaAPI.HttpdCustomization.ProcessNumber, } // create httpd vhost template parameters diff --git a/templates/manila/config/10-manila_wsgi.conf b/templates/manila/config/10-manila_wsgi.conf index 3a304576..e6b39e39 100644 --- a/templates/manila/config/10-manila_wsgi.conf +++ b/templates/manila/config/10-manila_wsgi.conf @@ -32,7 +32,7 @@ ## WSGI configuration WSGIApplicationGroup %{GLOBAL} - WSGIDaemonProcess {{ $endpt }} display-name={{ $endpt }} group=manila processes=4 threads=1 user=manila + WSGIDaemonProcess {{ $endpt }} display-name={{ $endpt }} group=manila processes={{ $.Workers }} threads=1 user=manila WSGIProcessGroup {{ $endpt }} WSGIScriptAlias / "/var/www/cgi-bin/manila/manila-wsgi" WSGIPassAuthorization On