From b52ef01886c24c3eb46374b267ade97347aa464f Mon Sep 17 00:00:00 2001 From: Veronika Fisarova Date: Wed, 13 Nov 2024 12:03:14 +0100 Subject: [PATCH] Make process number configurable Signed-off-by: Veronika Fisarova --- .../keystone.openstack.org_keystoneapis.yaml | 11 ++++++++++ api/v1beta1/keystoneapi_types.go | 13 ++++++++++++ api/v1beta1/zz_generated.deepcopy.go | 21 +++++++++++++++++++ .../keystone.openstack.org_keystoneapis.yaml | 11 ++++++++++ controllers/keystoneapi_controller.go | 1 + templates/keystoneapi/config/httpd.conf | 2 +- 6 files changed, 58 insertions(+), 1 deletion(-) diff --git a/api/bases/keystone.openstack.org_keystoneapis.yaml b/api/bases/keystone.openstack.org_keystoneapis.yaml index f460b115..a82074b6 100644 --- a/api/bases/keystone.openstack.org_keystoneapis.yaml +++ b/api/bases/keystone.openstack.org_keystoneapis.yaml @@ -103,6 +103,17 @@ spec: format: int32 minimum: 1 type: integer + httpdCustomization: + description: HttpdCustomization - customize the httpd service + properties: + processNumber: + default: 3 + description: ProcessNumber - Number of processes running in keystone + API + format: int32 + minimum: 1 + type: integer + type: object memcachedInstance: default: memcached description: Memcached instance name. diff --git a/api/v1beta1/keystoneapi_types.go b/api/v1beta1/keystoneapi_types.go index 41a46ddc..a0d86aff 100644 --- a/api/v1beta1/keystoneapi_types.go +++ b/api/v1beta1/keystoneapi_types.go @@ -157,6 +157,10 @@ type KeystoneAPISpecCore struct { // TODO: -> implement DefaultConfigOverwrite map[string]string `json:"defaultConfigOverwrite,omitempty"` + // +kubebuilder:validation:Optional + // HttpdCustomization - customize the httpd service + HttpdCustomization HttpdCustomization `json:"httpdCustomization,omitempty"` + // +kubebuilder:validation:Optional // Resources - Compute Resources required by this service (Limits/Requests). // https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ @@ -197,6 +201,15 @@ type PasswordSelector struct { Admin string `json:"admin"` } +// HttpdCustomization - customize the httpd service +type HttpdCustomization struct { + // +kubebuilder:validation:Optional + // +kubebuilder:default=3 + // +kubebuilder:validation:Minimum=1 + // ProcessNumber - Number of processes running in keystone API + ProcessNumber *int32 `json:"processNumber"` +} + // KeystoneAPIStatus defines the observed state of KeystoneAPI type KeystoneAPIStatus struct { // ReadyCount of keystone API instances diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index 98047671..59a8e30b 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -49,6 +49,26 @@ func (in *APIOverrideSpec) DeepCopy() *APIOverrideSpec { 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 *KeystoneAPI) DeepCopyInto(out *KeystoneAPI) { *out = *in @@ -176,6 +196,7 @@ func (in *KeystoneAPISpecCore) DeepCopyInto(out *KeystoneAPISpecCore) { (*out)[key] = val } } + in.HttpdCustomization.DeepCopyInto(&out.HttpdCustomization) in.Resources.DeepCopyInto(&out.Resources) if in.NetworkAttachments != nil { in, out := &in.NetworkAttachments, &out.NetworkAttachments diff --git a/config/crd/bases/keystone.openstack.org_keystoneapis.yaml b/config/crd/bases/keystone.openstack.org_keystoneapis.yaml index f460b115..a82074b6 100644 --- a/config/crd/bases/keystone.openstack.org_keystoneapis.yaml +++ b/config/crd/bases/keystone.openstack.org_keystoneapis.yaml @@ -103,6 +103,17 @@ spec: format: int32 minimum: 1 type: integer + httpdCustomization: + description: HttpdCustomization - customize the httpd service + properties: + processNumber: + default: 3 + description: ProcessNumber - Number of processes running in keystone + API + format: int32 + minimum: 1 + type: integer + type: object memcachedInstance: default: memcached description: Memcached instance name. diff --git a/controllers/keystoneapi_controller.go b/controllers/keystoneapi_controller.go index afbe0f58..3644d3e1 100644 --- a/controllers/keystoneapi_controller.go +++ b/controllers/keystoneapi_controller.go @@ -1196,6 +1196,7 @@ func (r *KeystoneAPIReconciler) generateServiceConfigMaps( keystone.DatabaseName, ), "enableSecureRBAC": instance.Spec.EnableSecureRBAC, + "ProcessNumber": instance.Spec.HttpdCustomization.ProcessNumber, } // create httpd vhost template parameters diff --git a/templates/keystoneapi/config/httpd.conf b/templates/keystoneapi/config/httpd.conf index 2046181e..641b6ddf 100644 --- a/templates/keystoneapi/config/httpd.conf +++ b/templates/keystoneapi/config/httpd.conf @@ -53,7 +53,7 @@ CustomLog /dev/stdout proxy env=forwarded ## WSGI configuration WSGIApplicationGroup %{GLOBAL} - WSGIDaemonProcess {{ $endpt }} display-name={{ $endpt }} group=keystone processes=3 threads=1 user=keystone + WSGIDaemonProcess {{ $endpt }} display-name={{ $endpt }} group=keystone processes={{ $.ProcessNumber }} threads=1 user=keystone WSGIProcessGroup {{ $endpt }} WSGIScriptAlias / "/usr/bin/keystone-wsgi-public" WSGIPassAuthorization On