From 38dad7112c4785f4d49abf27b26ed859b8ac8cec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20L=C3=B3pez?= Date: Mon, 22 May 2023 13:22:25 +0200 Subject: [PATCH 1/2] Add searchServer batchSize field to system API --- api/v1alpha1/system_types.go | 26 ++++++++++++++----- api/v1alpha1/zz_generated.deepcopy.go | 21 +++++++++++++++ bundle/manifests/saas.3scale.net_systems.yaml | 4 +++ config/crd/bases/saas.3scale.net_systems.yaml | 4 +++ .../saas-operator.clusterserviceversion.yaml | 3 +++ controllers/system_controller_suite_test.go | 11 +++++--- docs/api-reference/reference.asciidoc | 22 ++++++++++++++-- pkg/generators/system/config/options.go | 10 ++++--- 8 files changed, 85 insertions(+), 16 deletions(-) diff --git a/api/v1alpha1/system_types.go b/api/v1alpha1/system_types.go index 59f93634..c2577ef5 100644 --- a/api/v1alpha1/system_types.go +++ b/api/v1alpha1/system_types.go @@ -56,10 +56,13 @@ var ( SelectorKey: pointer.String("monitoring-key"), SelectorValue: pointer.String("middleware"), } - systemDefaultTerminationGracePeriodSeconds *int64 = pointer.Int64(60) - systemDefaultSearchServerAddress AddressSpec = AddressSpec{ - Host: pointer.String("system-sphinx"), - Port: pointer.Int32(9306), + systemDefaultTerminationGracePeriodSeconds *int64 = pointer.Int64(60) + systemDefaultSearchServer SearchServerSpec = SearchServerSpec{ + AddressSpec: AddressSpec{ + Host: pointer.String("system-sphinx"), + Port: pointer.Int32(9306), + }, + BatchSize: pointer.Int32(100), } // App @@ -335,6 +338,14 @@ func (spec *SystemSpec) Default() { } +type SearchServerSpec struct { + AddressSpec `json:",inline"` + // Defines the batch size + // +operator-sdk:csv:customresourcedefinitions:type=spec + // +optional + BatchSize *int32 `json:"batchSize,omitempty"` +} + // SystemConfig holds configuration for SystemApp component type SystemConfig struct { // Rails configuration options for system components @@ -356,7 +367,7 @@ type SystemConfig struct { // Search service options // +operator-sdk:csv:customresourcedefinitions:type=spec // +optional - SearchServer AddressSpec `json:"searchServer,omitempty"` + SearchServer SearchServerSpec `json:"searchServer,omitempty"` // 3scale provider plan // +operator-sdk:csv:customresourcedefinitions:type=spec // +optional @@ -453,8 +464,9 @@ func (sc *SystemConfig) Default() { sc.ExternalSecret.SecretStoreRef = InitializeExternalSecretSecretStoreReferenceSpec(sc.ExternalSecret.SecretStoreRef, defaultExternalSecretSecretStoreReference) sc.ExternalSecret.RefreshInterval = durationOrDefault(sc.ExternalSecret.RefreshInterval, &defaultExternalSecretRefreshInterval) - sc.SearchServer.Host = stringOrDefault(sc.SearchServer.Host, systemDefaultSearchServerAddress.Host) - sc.SearchServer.Port = intOrDefault(sc.SearchServer.Port, systemDefaultSearchServerAddress.Port) + sc.SearchServer.Host = stringOrDefault(sc.SearchServer.Host, systemDefaultSearchServer.Host) + sc.SearchServer.Port = intOrDefault(sc.SearchServer.Port, systemDefaultSearchServer.Port) + sc.SearchServer.BatchSize = intOrDefault(sc.SearchServer.BatchSize, systemDefaultSearchServer.BatchSize) } diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 0711589d..a9ca8ec5 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -2365,6 +2365,27 @@ func (in *SMTPSpec) DeepCopy() *SMTPSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SearchServerSpec) DeepCopyInto(out *SearchServerSpec) { + *out = *in + in.AddressSpec.DeepCopyInto(&out.AddressSpec) + if in.BatchSize != nil { + in, out := &in.BatchSize, &out.BatchSize + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SearchServerSpec. +func (in *SearchServerSpec) DeepCopy() *SearchServerSpec { + if in == nil { + return nil + } + out := new(SearchServerSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SearchdConfig) DeepCopyInto(out *SearchdConfig) { *out = *in diff --git a/bundle/manifests/saas.3scale.net_systems.yaml b/bundle/manifests/saas.3scale.net_systems.yaml index cbfc7d2c..af4b4c05 100644 --- a/bundle/manifests/saas.3scale.net_systems.yaml +++ b/bundle/manifests/saas.3scale.net_systems.yaml @@ -1142,6 +1142,10 @@ spec: searchServer: description: Search service options properties: + batchSize: + description: Defines the batch size + format: int32 + type: integer host: description: Defines the address host type: string diff --git a/config/crd/bases/saas.3scale.net_systems.yaml b/config/crd/bases/saas.3scale.net_systems.yaml index c1137f82..ba7ce119 100644 --- a/config/crd/bases/saas.3scale.net_systems.yaml +++ b/config/crd/bases/saas.3scale.net_systems.yaml @@ -1143,6 +1143,10 @@ spec: searchServer: description: Search service options properties: + batchSize: + description: Defines the batch size + format: int32 + type: integer host: description: Defines the address host type: string diff --git a/config/manifests/bases/saas-operator.clusterserviceversion.yaml b/config/manifests/bases/saas-operator.clusterserviceversion.yaml index 59e07bf4..28b9e200 100644 --- a/config/manifests/bases/saas-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/saas-operator.clusterserviceversion.yaml @@ -2608,6 +2608,9 @@ spec: - description: Search service options displayName: Search Server path: config.searchServer + - description: Defines the batch size + displayName: Batch Size + path: config.searchServer.batchSize - description: Defines the address host displayName: Host path: config.searchServer.host diff --git a/controllers/system_controller_suite_test.go b/controllers/system_controller_suite_test.go index f59a8e4f..d90caa83 100644 --- a/controllers/system_controller_suite_test.go +++ b/controllers/system_controller_suite_test.go @@ -396,9 +396,12 @@ var _ = Describe("System controller", func() { k8sClient, &appsv1.Deployment{}, "system-app", namespace, timeout, poll) patch := client.MergeFrom(system.DeepCopy()) - system.Spec.Config.SearchServer = saasv1alpha1.AddressSpec{ - Host: pointer.String("system-searchd"), - Port: pointer.Int32(1234), + system.Spec.Config.SearchServer = saasv1alpha1.SearchServerSpec{ + AddressSpec: saasv1alpha1.AddressSpec{ + Host: pointer.String("system-searchd"), + Port: pointer.Int32(1234), + }, + BatchSize: pointer.Int32(222), } system.Spec.Searchd = &saasv1alpha1.SystemSearchdSpec{ @@ -433,6 +436,8 @@ var _ = Describe("System controller", func() { Expect(env.Value).To(Equal("system-searchd")) case "THINKING_SPHINX_PORT": Expect(env.Value).To(Equal("1234")) + case "THINKING_SPHINX_BATCH_SIZE": + Expect(env.Value).To(Equal("222")) } } diff --git a/docs/api-reference/reference.asciidoc b/docs/api-reference/reference.asciidoc index 5740c093..b5464872 100644 --- a/docs/api-reference/reference.asciidoc +++ b/docs/api-reference/reference.asciidoc @@ -59,7 +59,7 @@ AddressSpec allows the definition of an address .Appears In: **** -- xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-systemconfig[$$SystemConfig$$] +- xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-searchserverspec[$$SearchServerSpec$$] **** [cols="25a,75a", options="header"] @@ -1323,6 +1323,24 @@ SMTPSpec has options to configure system's SMTP |=== +[id="{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-searchserverspec"] +==== SearchServerSpec + + + +.Appears In: +**** +- xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-systemconfig[$$SystemConfig$$] +**** + +[cols="25a,75a", options="header"] +|=== +| Field | Description +| *`AddressSpec`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-addressspec[$$AddressSpec$$]__ | +| *`batchSize`* __integer__ | Defines the batch size +|=== + + [id="{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-searchdconfig"] ==== SearchdConfig @@ -1633,7 +1651,7 @@ SystemConfig holds configuration for SystemApp component | *`sandboxProxyOpensslVerifyMode`* __string__ | OpenSSL verification mode for sandbox proxy | *`forceSSL`* __boolean__ | Enable (true) or disable (false) enforcing SSL | *`sslCertsDir`* __string__ | SSL certificates path -| *`searchServer`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-addressspec[$$AddressSpec$$]__ | Search service options +| *`searchServer`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-searchserverspec[$$SearchServerSpec$$]__ | Search service options | *`threescaleProviderPlan`* __string__ | 3scale provider plan | *`threescaleSuperdomain`* __string__ | 3scale superdomain | *`configFilesSecret`* __string__ | Secret containging system configuration files to be mounted in the pods diff --git a/pkg/generators/system/config/options.go b/pkg/generators/system/config/options.go index e9a220f4..795757f9 100644 --- a/pkg/generators/system/config/options.go +++ b/pkg/generators/system/config/options.go @@ -20,8 +20,9 @@ type Options struct { RailsLogLevel pod.EnvVarValue `env:"RAILS_LOG_LEVEL"` RailsLogToStdout pod.EnvVarValue `env:"RAILS_LOG_TO_STDOUT"` - SearchServerAddress pod.EnvVarValue `env:"THINKING_SPHINX_ADDRESS"` - SearchServerPort pod.EnvVarValue `env:"THINKING_SPHINX_PORT"` + SearchServerAddress pod.EnvVarValue `env:"THINKING_SPHINX_ADDRESS"` + SearchServerPort pod.EnvVarValue `env:"THINKING_SPHINX_PORT"` + SearchServerBatchSize pod.EnvVarValue `env:"THINKING_SPHINX_BATCH_SIZE"` DatabaseURL pod.EnvVarValue `env:"DATABASE_URL" secret:"system-database"` @@ -94,8 +95,9 @@ func NewOptions(spec saasv1alpha1.SystemSpec) Options { RailsLogLevel: &pod.ClearTextValue{Value: *spec.Config.Rails.LogLevel}, RailsLogToStdout: &pod.ClearTextValue{Value: "true"}, - SearchServerAddress: &pod.ClearTextValue{Value: *spec.Config.SearchServer.Host}, - SearchServerPort: &pod.ClearTextValue{Value: fmt.Sprintf("%d", *spec.Config.SearchServer.Port)}, + SearchServerAddress: &pod.ClearTextValue{Value: *spec.Config.SearchServer.Host}, + SearchServerPort: &pod.ClearTextValue{Value: fmt.Sprintf("%d", *spec.Config.SearchServer.Port)}, + SearchServerBatchSize: &pod.ClearTextValue{Value: fmt.Sprintf("%d", *spec.Config.SearchServer.BatchSize)}, DatabaseURL: &pod.SecretValue{Value: spec.Config.DatabaseDSN}, From 7425819b018673b550d718c8c9e1f8e8a4154a96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20L=C3=B3pez?= Date: Mon, 22 May 2023 13:22:43 +0200 Subject: [PATCH 2/2] Alpha release v0.19.8-alpha.2 --- Makefile | 2 +- bundle.Dockerfile | 3 +-- .../saas-operator.clusterserviceversion.yaml | 11 +++++++---- bundle/metadata/annotations.yaml | 3 +-- config/manager/kustomization.yaml | 2 +- pkg/version/version.go | 2 +- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index ccc51375..b750533c 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # To re-generate a bundle for another specific version without changing the standard setup, you can: # - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2) # - use environment variables to overwrite this value (e.g export VERSION=0.0.2) -VERSION ?= 0.19.7 +VERSION ?= 0.19.8-alpha.2 # CHANNELS define the bundle channels used in the bundle. # Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable") diff --git a/bundle.Dockerfile b/bundle.Dockerfile index e44312a4..b80837a0 100644 --- a/bundle.Dockerfile +++ b/bundle.Dockerfile @@ -5,8 +5,7 @@ LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1 LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/ LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/ LABEL operators.operatorframework.io.bundle.package.v1=saas-operator -LABEL operators.operatorframework.io.bundle.channels.v1=alpha,stable -LABEL operators.operatorframework.io.bundle.channel.default.v1=alpha +LABEL operators.operatorframework.io.bundle.channels.v1=alpha LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.27.0 LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1 LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3 diff --git a/bundle/manifests/saas-operator.clusterserviceversion.yaml b/bundle/manifests/saas-operator.clusterserviceversion.yaml index 6bb96afa..9fd6df62 100644 --- a/bundle/manifests/saas-operator.clusterserviceversion.yaml +++ b/bundle/manifests/saas-operator.clusterserviceversion.yaml @@ -627,7 +627,7 @@ metadata: capabilities: Basic Install categories: Integration & Delivery containerImage: quay.io/3scale/saas-operator - createdAt: "2023-05-09T08:16:49Z" + createdAt: "2023-05-22T11:05:17Z" description: |- The 3scale SaaS Operator creates and maintains a SaaS-ready deployment of the Red Hat 3scale API Management on OpenShift. @@ -635,7 +635,7 @@ metadata: operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 repository: https://github.com/3scale/saas-operator support: Red Hat - name: saas-operator.v0.19.7 + name: saas-operator.v0.19.8-alpha.2 namespace: placeholder spec: apiservicedefinitions: {} @@ -3096,6 +3096,9 @@ spec: - description: Search service options displayName: Search Server path: config.searchServer + - description: Defines the batch size + displayName: Batch Size + path: config.searchServer.batchSize - description: Defines the address host displayName: Host path: config.searchServer.host @@ -4453,7 +4456,7 @@ spec: valueFrom: fieldRef: fieldPath: metadata.annotations['olm.targetNamespaces'] - image: quay.io/3scale/saas-operator:v0.19.7 + image: quay.io/3scale/saas-operator:v0.19.8-alpha.2 livenessProbe: httpGet: path: /healthz @@ -4967,4 +4970,4 @@ spec: provider: name: Red Hat url: https://www.3scale.net/ - version: 0.19.7 + version: 0.19.8-alpha.2 diff --git a/bundle/metadata/annotations.yaml b/bundle/metadata/annotations.yaml index 5d8597be..77fadbff 100644 --- a/bundle/metadata/annotations.yaml +++ b/bundle/metadata/annotations.yaml @@ -4,8 +4,7 @@ annotations: operators.operatorframework.io.bundle.manifests.v1: manifests/ operators.operatorframework.io.bundle.metadata.v1: metadata/ operators.operatorframework.io.bundle.package.v1: saas-operator - operators.operatorframework.io.bundle.channels.v1: alpha,stable - operators.operatorframework.io.bundle.channel.default.v1: alpha + operators.operatorframework.io.bundle.channels.v1: alpha operators.operatorframework.io.metrics.builder: operator-sdk-v1.27.0 operators.operatorframework.io.metrics.mediatype.v1: metrics+v1 operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v3 diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index 87479a39..bb9a4ad5 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -13,4 +13,4 @@ kind: Kustomization images: - name: controller newName: quay.io/3scale/saas-operator - newTag: v0.19.7 + newTag: v0.19.8-alpha.2 diff --git a/pkg/version/version.go b/pkg/version/version.go index 0f230164..0ec795af 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -1,7 +1,7 @@ package version const ( - version string = "v0.19.7" + version string = "v0.19.8-alpha.2" ) // Current returns the current marin3r operator version