From b2c718c6722db8d4ae90a2d63b08c84ac278a9d9 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 --- --all-files --show-diff-on-failure --verbose | 139 ++++++++++++++++++ .../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 +- 7 files changed, 197 insertions(+), 1 deletion(-) create mode 100644 --all-files --show-diff-on-failure --verbose diff --git a/--all-files --show-diff-on-failure --verbose b/--all-files --show-diff-on-failure --verbose new file mode 100644 index 00000000..e4a4d952 --- /dev/null +++ b/--all-files --show-diff-on-failure --verbose @@ -0,0 +1,139 @@ +diff --git a/api/bases/keystone.openstack.org_keystoneapis.yaml b/api/bases/keystone.openstack.org_keystoneapis.yaml +index f460b11..a82074b 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 a4c9b3c..29dd60d 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 7ee4749..da70b75 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 +@@ -172,6 +192,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 f460b11..a82074b 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 1ce2985..0df5e1a 100644 +--- a/controllers/keystoneapi_controller.go ++++ b/controllers/keystoneapi_controller.go +@@ -1190,6 +1190,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 2046181..641b6dd 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 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 a4c9b3cc..29dd60d8 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 7ee47492..da70b75d 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 @@ -172,6 +192,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 1ce29856..0df5e1a9 100644 --- a/controllers/keystoneapi_controller.go +++ b/controllers/keystoneapi_controller.go @@ -1190,6 +1190,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