From 6a4a70a305288da82bf0d1557b72da295f64e706 Mon Sep 17 00:00:00 2001 From: Francesco Pantano Date: Thu, 5 Dec 2024 09:57:50 +0100 Subject: [PATCH] Add parameter to customize the number of cinderAPI processes Signed-off-by: Francesco Pantano --- .../cinder.openstack.org_cinderapis.yaml | 8 +++++++ api/bases/cinder.openstack.org_cinders.yaml | 8 +++++++ api/v1beta1/cinderapi_types.go | 13 ++++++++++++ api/v1beta1/zz_generated.deepcopy.go | 21 +++++++++++++++++++ .../cinder.openstack.org_cinderapis.yaml | 8 +++++++ .../bases/cinder.openstack.org_cinders.yaml | 8 +++++++ controllers/cinder_controller.go | 1 + templates/cinder/config/10-cinder_wsgi.conf | 2 +- 8 files changed, 68 insertions(+), 1 deletion(-) diff --git a/api/bases/cinder.openstack.org_cinderapis.yaml b/api/bases/cinder.openstack.org_cinderapis.yaml index 0510f7a3..0f488558 100644 --- a/api/bases/cinder.openstack.org_cinderapis.yaml +++ b/api/bases/cinder.openstack.org_cinderapis.yaml @@ -536,6 +536,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/cinder.openstack.org_cinders.yaml b/api/bases/cinder.openstack.org_cinders.yaml index 1511d932..fa4ee92f 100644 --- a/api/bases/cinder.openstack.org_cinders.yaml +++ b/api/bases/cinder.openstack.org_cinders.yaml @@ -50,6 +50,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/cinderapi_types.go b/api/v1beta1/cinderapi_types.go index df5ab150..16c84e95 100644 --- a/api/v1beta1/cinderapi_types.go +++ b/api/v1beta1/cinderapi_types.go @@ -51,6 +51,19 @@ type CinderAPITemplate struct { ContainerImage string `json:"containerImage"` CinderAPITemplateCore `json:",inline"` + + // +kubebuilder:validation:Optional + // HttpdCustomization - customize the httpd service + HttpdCustomization HttpdCustomization `json:"httpdCustomization,omitempty"` +} + +// HttpdCustomization - +type HttpdCustomization struct { + // +kubebuilder:validation:Optional + // +kubebuilder:default=4 + // +kubebuilder:validation:Minimum=1 + // ProcessNumber - Number of processes running in Cinder API + ProcessNumber *int32 `json:"processNumber"` } // APIOverrideSpec to override the generated manifest of several child resources. diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index 2164887c..fc268e49 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -232,6 +232,7 @@ func (in *CinderAPIStatus) DeepCopy() *CinderAPIStatus { func (in *CinderAPITemplate) DeepCopyInto(out *CinderAPITemplate) { *out = *in in.CinderAPITemplateCore.DeepCopyInto(&out.CinderAPITemplateCore) + in.HttpdCustomization.DeepCopyInto(&out.HttpdCustomization) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CinderAPITemplate. @@ -1046,6 +1047,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 *PasswordSelector) DeepCopyInto(out *PasswordSelector) { *out = *in diff --git a/config/crd/bases/cinder.openstack.org_cinderapis.yaml b/config/crd/bases/cinder.openstack.org_cinderapis.yaml index 0510f7a3..0f488558 100644 --- a/config/crd/bases/cinder.openstack.org_cinderapis.yaml +++ b/config/crd/bases/cinder.openstack.org_cinderapis.yaml @@ -536,6 +536,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/cinder.openstack.org_cinders.yaml b/config/crd/bases/cinder.openstack.org_cinders.yaml index 1511d932..fa4ee92f 100644 --- a/config/crd/bases/cinder.openstack.org_cinders.yaml +++ b/config/crd/bases/cinder.openstack.org_cinders.yaml @@ -50,6 +50,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/cinder_controller.go b/controllers/cinder_controller.go index 7bfb6679..323868b0 100644 --- a/controllers/cinder_controller.go +++ b/controllers/cinder_controller.go @@ -924,6 +924,7 @@ func (r *CinderReconciler) generateServiceConfigs( cinder.DatabaseName) templateParameters["MemcachedServersWithInet"] = memcached.GetMemcachedServerListWithInetString() templateParameters["TimeOut"] = instance.Spec.APITimeout + templateParameters["Workers"] = instance.Spec.CinderAPI.HttpdCustomization.ProcessNumber // create httpd vhost template parameters httpdVhostConfig := map[string]interface{}{} diff --git a/templates/cinder/config/10-cinder_wsgi.conf b/templates/cinder/config/10-cinder_wsgi.conf index e12f1e24..31e5b360 100644 --- a/templates/cinder/config/10-cinder_wsgi.conf +++ b/templates/cinder/config/10-cinder_wsgi.conf @@ -32,7 +32,7 @@ ## WSGI configuration WSGIApplicationGroup %{GLOBAL} - WSGIDaemonProcess {{ $endpt }} display-name={{ $endpt }} group=cinder processes=4 threads=1 user=cinder + WSGIDaemonProcess {{ $endpt }} display-name={{ $endpt }} group=cinder processes={{ $.Workers }} threads=1 user=cinder WSGIProcessGroup {{ $endpt }} WSGIScriptAlias / "/var/www/cgi-bin/cinder/cinder-wsgi" WSGIPassAuthorization On