Skip to content

Commit

Permalink
Make process number configurable
Browse files Browse the repository at this point in the history
Signed-off-by: Veronika Fisarova <[email protected]>
  • Loading branch information
Deydra71 committed Nov 19, 2024
1 parent 2e94eb1 commit b2c718c
Show file tree
Hide file tree
Showing 7 changed files with 197 additions and 1 deletion.
139 changes: 139 additions & 0 deletions --all-files --show-diff-on-failure --verbose
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions api/bases/keystone.openstack.org_keystoneapis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
13 changes: 13 additions & 0 deletions api/v1beta1/keystoneapi_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down Expand Up @@ -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
Expand Down
21 changes: 21 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions config/crd/bases/keystone.openstack.org_keystoneapis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions controllers/keystoneapi_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,7 @@ func (r *KeystoneAPIReconciler) generateServiceConfigMaps(
keystone.DatabaseName,
),
"enableSecureRBAC": instance.Spec.EnableSecureRBAC,
"ProcessNumber": instance.Spec.HttpdCustomization.ProcessNumber,
}

// create httpd vhost template parameters
Expand Down
2 changes: 1 addition & 1 deletion templates/keystoneapi/config/httpd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b2c718c

Please sign in to comment.