From 4e26c43a63d576a850e27f5b9a2623fcdba7672e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20L=C3=B3pez?= Date: Wed, 18 Jan 2023 17:00:37 +0100 Subject: [PATCH 1/2] Add sphinx batch size field to System CR --- api/v1alpha1/system_types.go | 6 ++++++ api/v1alpha1/zz_generated.deepcopy.go | 5 +++++ bundle/manifests/saas-operator.clusterserviceversion.yaml | 3 +++ bundle/manifests/saas.3scale.net_systems.yaml | 4 ++++ config/crd/bases/saas.3scale.net_systems.yaml | 4 ++++ .../bases/saas-operator.clusterserviceversion.yaml | 3 +++ docs/api-reference/reference.asciidoc | 1 + pkg/generators/system/config/sphinx_options.go | 2 ++ 8 files changed, 28 insertions(+) diff --git a/api/v1alpha1/system_types.go b/api/v1alpha1/system_types.go index 6f7c7cd9..d0f5eaab 100644 --- a/api/v1alpha1/system_types.go +++ b/api/v1alpha1/system_types.go @@ -160,6 +160,7 @@ var ( systemDefaultSphinxPort int32 = 9306 systemDefaultSphinxBindAddress string = "0.0.0.0" systemDefaultSphinxConfigFile string = "/opt/system/db/sphinx/sphinx.conf" + systemDefaultSphinxBatchSize int32 = 100 systemDefaultSphinxDBPath string = "/opt/system/db/sphinx" systemDefaultSphinxDatabaseStorageSize string = "30Gi" systemDefaultSphinxPIDFile string = "/opt/system/tmp/pids/searchd.pid" @@ -794,6 +795,10 @@ type ThinkingSpec struct { // +operator-sdk:csv:customresourcedefinitions:type=spec // +optional ConfigFile *string `json:"configFile,omitempty"` + // Sphinx batch size + // +operator-sdk:csv:customresourcedefinitions:type=spec + // +optional + BatchSize *int32 `json:"batchSize,omitempty"` // Sphinx database path // +operator-sdk:csv:customresourcedefinitions:type=spec // +optional @@ -817,6 +822,7 @@ func (tc *ThinkingSpec) Default() { tc.Port = intOrDefault(tc.Port, pointer.Int32Ptr(systemDefaultSphinxPort)) tc.BindAddress = stringOrDefault(tc.BindAddress, pointer.StringPtr(systemDefaultSphinxBindAddress)) tc.ConfigFile = stringOrDefault(tc.ConfigFile, pointer.StringPtr(systemDefaultSphinxConfigFile)) + tc.BatchSize = intOrDefault(tc.BatchSize, pointer.Int32Ptr(systemDefaultSphinxBatchSize)) tc.DatabasePath = stringOrDefault(tc.DatabasePath, pointer.StringPtr(systemDefaultSphinxDBPath)) tc.PIDFile = stringOrDefault(tc.PIDFile, pointer.StringPtr(systemDefaultSphinxPIDFile)) if tc.DatabaseStorageSize == nil { diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index fb459f51..b6560b6f 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -3153,6 +3153,11 @@ func (in *ThinkingSpec) DeepCopyInto(out *ThinkingSpec) { *out = new(string) **out = **in } + if in.BatchSize != nil { + in, out := &in.BatchSize, &out.BatchSize + *out = new(int32) + **out = **in + } if in.DatabasePath != nil { in, out := &in.DatabasePath, &out.DatabasePath *out = new(string) diff --git a/bundle/manifests/saas-operator.clusterserviceversion.yaml b/bundle/manifests/saas-operator.clusterserviceversion.yaml index db85878a..34118c3f 100644 --- a/bundle/manifests/saas-operator.clusterserviceversion.yaml +++ b/bundle/manifests/saas-operator.clusterserviceversion.yaml @@ -3672,6 +3672,9 @@ spec: - description: Thinking configuration for sphinx displayName: Thinking path: sphinx.config.thinking + - description: Sphinx batch size + displayName: Batch Size + path: sphinx.config.thinking.batchSize - description: Allows setting the TCP host for Sphinx to a different address displayName: Bind Address path: sphinx.config.thinking.bindAddress diff --git a/bundle/manifests/saas.3scale.net_systems.yaml b/bundle/manifests/saas.3scale.net_systems.yaml index c70ff262..8ada88ae 100644 --- a/bundle/manifests/saas.3scale.net_systems.yaml +++ b/bundle/manifests/saas.3scale.net_systems.yaml @@ -2792,6 +2792,10 @@ spec: thinking: description: Thinking configuration for sphinx properties: + batchSize: + description: Sphinx batch size + format: int32 + type: integer bindAddress: description: Allows setting the TCP host for Sphinx to a different address diff --git a/config/crd/bases/saas.3scale.net_systems.yaml b/config/crd/bases/saas.3scale.net_systems.yaml index ab1aa0a3..96644339 100644 --- a/config/crd/bases/saas.3scale.net_systems.yaml +++ b/config/crd/bases/saas.3scale.net_systems.yaml @@ -2793,6 +2793,10 @@ spec: thinking: description: Thinking configuration for sphinx properties: + batchSize: + description: Sphinx batch size + format: int32 + type: integer bindAddress: description: Allows setting the TCP host for Sphinx to a different address diff --git a/config/manifests/bases/saas-operator.clusterserviceversion.yaml b/config/manifests/bases/saas-operator.clusterserviceversion.yaml index 07b92a67..1f5cc277 100644 --- a/config/manifests/bases/saas-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/saas-operator.clusterserviceversion.yaml @@ -3184,6 +3184,9 @@ spec: - description: Thinking configuration for sphinx displayName: Thinking path: sphinx.config.thinking + - description: Sphinx batch size + displayName: Batch Size + path: sphinx.config.thinking.batchSize - description: Allows setting the TCP host for Sphinx to a different address displayName: Bind Address path: sphinx.config.thinking.bindAddress diff --git a/docs/api-reference/reference.asciidoc b/docs/api-reference/reference.asciidoc index fb8802ea..da15be67 100644 --- a/docs/api-reference/reference.asciidoc +++ b/docs/api-reference/reference.asciidoc @@ -1764,6 +1764,7 @@ ThinkingSpec configures the thinking library for sphinx | *`port`* __integer__ | The TCP port Sphinx will run its daemon on | *`bindAddress`* __string__ | Allows setting the TCP host for Sphinx to a different address | *`configFile`* __string__ | Sphinx configuration file path +| *`batchSize`* __integer__ | Sphinx batch size | *`databasePath`* __string__ | Sphinx database path | *`databaseStorageSize`* __Quantity__ | Sphinx database storage size | *`databaseStorageClass`* __string__ | Sphinx database storage type diff --git a/pkg/generators/system/config/sphinx_options.go b/pkg/generators/system/config/sphinx_options.go index eba175ef..f7d07d07 100644 --- a/pkg/generators/system/config/sphinx_options.go +++ b/pkg/generators/system/config/sphinx_options.go @@ -13,6 +13,7 @@ type SphinxOptions struct { SphinxPort pod.EnvVarValue `env:"THINKING_SPHINX_PORT"` SphinxPIDFile pod.EnvVarValue `env:"THINKING_SPHINX_PID_FILE"` SphinxConfigurationFile pod.EnvVarValue `env:"THINKING_SPHINX_CONFIGURATION_FILE"` + SphinxBatchSize pod.EnvVarValue `env:"THINKING_SPHINX_BATCH_SIZE"` RailsEnvironment pod.EnvVarValue `env:"RAILS_ENV"` SecretKeyBase pod.EnvVarValue `env:"SECRET_KEY_BASE"` @@ -32,6 +33,7 @@ func NewSphinxOptions(spec saasv1alpha1.SystemSpec) SphinxOptions { SphinxPort: &pod.ClearTextValue{Value: fmt.Sprintf("%d", *spec.Sphinx.Config.Thinking.Port)}, SphinxPIDFile: &pod.ClearTextValue{Value: *spec.Sphinx.Config.Thinking.PIDFile}, SphinxConfigurationFile: &pod.ClearTextValue{Value: *spec.Sphinx.Config.Thinking.ConfigFile}, + SphinxBatchSize: &pod.ClearTextValue{Value: fmt.Sprintf("%d", *spec.Sphinx.Config.Thinking.BatchSize)}, RailsEnvironment: &pod.ClearTextValue{Value: *spec.Config.Rails.Environment}, SecretKeyBase: &pod.ClearTextValue{Value: "dummy"}, // https://github.com/rails/rails/issues/32947 DatabaseURL: &pod.SecretValue{Value: spec.Config.DatabaseDSN}, From f97381e84c20c715961275ab2dde41f5dd7e8dec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20L=C3=B3pez?= Date: Wed, 18 Jan 2023 17:04:51 +0100 Subject: [PATCH 2/2] Uncommited change on marin3r dynamicConfigs from PR#243 --- bundle/manifests/saas.3scale.net_apicasts.yaml | 8 ++++---- bundle/manifests/saas.3scale.net_backends.yaml | 4 ++-- bundle/manifests/saas.3scale.net_echoapis.yaml | 4 ++-- config/crd/bases/saas.3scale.net_apicasts.yaml | 8 ++++---- config/crd/bases/saas.3scale.net_backends.yaml | 4 ++-- config/crd/bases/saas.3scale.net_echoapis.yaml | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/bundle/manifests/saas.3scale.net_apicasts.yaml b/bundle/manifests/saas.3scale.net_apicasts.yaml index 59d74736..dad726c8 100644 --- a/bundle/manifests/saas.3scale.net_apicasts.yaml +++ b/bundle/manifests/saas.3scale.net_apicasts.yaml @@ -240,8 +240,8 @@ spec: properties: dynamicConfigs: additionalProperties: - maxProperties: 1 - minProperties: 1 + maxProperties: 2 + minProperties: 2 properties: cluster: description: Cluster contains options for an Envoy cluster @@ -1000,8 +1000,8 @@ spec: properties: dynamicConfigs: additionalProperties: - maxProperties: 1 - minProperties: 1 + maxProperties: 2 + minProperties: 2 properties: cluster: description: Cluster contains options for an Envoy cluster diff --git a/bundle/manifests/saas.3scale.net_backends.yaml b/bundle/manifests/saas.3scale.net_backends.yaml index 5549bc42..38f06e0c 100644 --- a/bundle/manifests/saas.3scale.net_backends.yaml +++ b/bundle/manifests/saas.3scale.net_backends.yaml @@ -670,8 +670,8 @@ spec: properties: dynamicConfigs: additionalProperties: - maxProperties: 1 - minProperties: 1 + maxProperties: 2 + minProperties: 2 properties: cluster: description: Cluster contains options for an Envoy cluster diff --git a/bundle/manifests/saas.3scale.net_echoapis.yaml b/bundle/manifests/saas.3scale.net_echoapis.yaml index 8ec25322..d236f1af 100644 --- a/bundle/manifests/saas.3scale.net_echoapis.yaml +++ b/bundle/manifests/saas.3scale.net_echoapis.yaml @@ -138,8 +138,8 @@ spec: properties: dynamicConfigs: additionalProperties: - maxProperties: 1 - minProperties: 1 + maxProperties: 2 + minProperties: 2 properties: cluster: description: Cluster contains options for an Envoy cluster diff --git a/config/crd/bases/saas.3scale.net_apicasts.yaml b/config/crd/bases/saas.3scale.net_apicasts.yaml index 2c1192f8..0df7077b 100644 --- a/config/crd/bases/saas.3scale.net_apicasts.yaml +++ b/config/crd/bases/saas.3scale.net_apicasts.yaml @@ -241,8 +241,8 @@ spec: properties: dynamicConfigs: additionalProperties: - maxProperties: 1 - minProperties: 1 + maxProperties: 2 + minProperties: 2 properties: cluster: description: Cluster contains options for an Envoy cluster @@ -1001,8 +1001,8 @@ spec: properties: dynamicConfigs: additionalProperties: - maxProperties: 1 - minProperties: 1 + maxProperties: 2 + minProperties: 2 properties: cluster: description: Cluster contains options for an Envoy cluster diff --git a/config/crd/bases/saas.3scale.net_backends.yaml b/config/crd/bases/saas.3scale.net_backends.yaml index 639f38ef..6337630d 100644 --- a/config/crd/bases/saas.3scale.net_backends.yaml +++ b/config/crd/bases/saas.3scale.net_backends.yaml @@ -671,8 +671,8 @@ spec: properties: dynamicConfigs: additionalProperties: - maxProperties: 1 - minProperties: 1 + maxProperties: 2 + minProperties: 2 properties: cluster: description: Cluster contains options for an Envoy cluster diff --git a/config/crd/bases/saas.3scale.net_echoapis.yaml b/config/crd/bases/saas.3scale.net_echoapis.yaml index d8f03aea..19cbe80f 100644 --- a/config/crd/bases/saas.3scale.net_echoapis.yaml +++ b/config/crd/bases/saas.3scale.net_echoapis.yaml @@ -139,8 +139,8 @@ spec: properties: dynamicConfigs: additionalProperties: - maxProperties: 1 - minProperties: 1 + maxProperties: 2 + minProperties: 2 properties: cluster: description: Cluster contains options for an Envoy cluster