diff --git a/Makefile b/Makefile index 215a628e..ccc51375 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.6 +VERSION ?= 0.19.7 # 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/api/v1alpha1/apicast_types.go b/api/v1alpha1/apicast_types.go index 58a88a8e..9621bf77 100644 --- a/api/v1alpha1/apicast_types.go +++ b/api/v1alpha1/apicast_types.go @@ -28,19 +28,19 @@ import ( var ( apicastDefaultReplicas int32 = 2 apicastDefaultImage defaultImageSpec = defaultImageSpec{ - Name: pointer.StringPtr("quay.io/3scale/apicast-cloud-hosted"), - Tag: pointer.StringPtr("latest"), - PullPolicy: (*corev1.PullPolicy)(pointer.StringPtr(string(corev1.PullIfNotPresent))), + Name: pointer.String("quay.io/3scale/apicast-cloud-hosted"), + Tag: pointer.String("latest"), + PullPolicy: (*corev1.PullPolicy)(pointer.String(string(corev1.PullIfNotPresent))), } apicastDefaultLoadBalancer defaultLoadBalancerSpec = defaultLoadBalancerSpec{ - ProxyProtocol: pointer.BoolPtr(true), - CrossZoneLoadBalancingEnabled: pointer.BoolPtr(true), - ConnectionDrainingEnabled: pointer.BoolPtr(true), - ConnectionDrainingTimeout: pointer.Int32Ptr(60), - HealthcheckHealthyThreshold: pointer.Int32Ptr(2), - HealthcheckUnhealthyThreshold: pointer.Int32Ptr(2), - HealthcheckInterval: pointer.Int32Ptr(5), - HealthcheckTimeout: pointer.Int32Ptr(3), + ProxyProtocol: pointer.Bool(true), + CrossZoneLoadBalancingEnabled: pointer.Bool(true), + ConnectionDrainingEnabled: pointer.Bool(true), + ConnectionDrainingTimeout: pointer.Int32(60), + HealthcheckHealthyThreshold: pointer.Int32(2), + HealthcheckUnhealthyThreshold: pointer.Int32(2), + HealthcheckInterval: pointer.Int32(5), + HealthcheckTimeout: pointer.Int32(3), } apicastDefaultResources defaultResourceRequirementsSpec = defaultResourceRequirementsSpec{ Requests: corev1.ResourceList{ @@ -53,31 +53,31 @@ var ( }, } apicastDefaultHPA defaultHorizontalPodAutoscalerSpec = defaultHorizontalPodAutoscalerSpec{ - MinReplicas: pointer.Int32Ptr(2), - MaxReplicas: pointer.Int32Ptr(4), - ResourceUtilization: pointer.Int32Ptr(90), - ResourceName: pointer.StringPtr("cpu"), + MinReplicas: pointer.Int32(2), + MaxReplicas: pointer.Int32(4), + ResourceUtilization: pointer.Int32(90), + ResourceName: pointer.String("cpu"), } apicastDefaultLivenessProbe defaultProbeSpec = defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(5), - TimeoutSeconds: pointer.Int32Ptr(5), - PeriodSeconds: pointer.Int32Ptr(10), - SuccessThreshold: pointer.Int32Ptr(1), - FailureThreshold: pointer.Int32Ptr(3), + InitialDelaySeconds: pointer.Int32(5), + TimeoutSeconds: pointer.Int32(5), + PeriodSeconds: pointer.Int32(10), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(3), } apicastDefaultReadinessProbe defaultProbeSpec = defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(5), - TimeoutSeconds: pointer.Int32Ptr(5), - PeriodSeconds: pointer.Int32Ptr(30), - SuccessThreshold: pointer.Int32Ptr(1), - FailureThreshold: pointer.Int32Ptr(3), + InitialDelaySeconds: pointer.Int32(5), + TimeoutSeconds: pointer.Int32(5), + PeriodSeconds: pointer.Int32(30), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(3), } apicastDefaultPDB defaultPodDisruptionBudgetSpec = defaultPodDisruptionBudgetSpec{ MaxUnavailable: util.IntStrPtr(intstr.FromInt(1)), } apicastDefaultGrafanaDashboard defaultGrafanaDashboardSpec = defaultGrafanaDashboardSpec{ - SelectorKey: pointer.StringPtr("monitoring-key"), - SelectorValue: pointer.StringPtr("middleware"), + SelectorKey: pointer.String("monitoring-key"), + SelectorValue: pointer.String("middleware"), } apicastDefaultMarin3rSpec defaultMarin3rSidecarSpec = defaultMarin3rSidecarSpec{} apicastDefaultLogLevel string = "warn" @@ -227,8 +227,8 @@ type ApicastConfig struct { // Default sets default values for any value not specifically set in the ApicastConfig struct func (cfg *ApicastConfig) Default() { - cfg.LogLevel = stringOrDefault(cfg.LogLevel, pointer.StringPtr(apicastDefaultLogLevel)) - cfg.OIDCLogLevel = stringOrDefault(cfg.OIDCLogLevel, pointer.StringPtr(apicastDefaultOIDCLogLevel)) + cfg.LogLevel = stringOrDefault(cfg.LogLevel, pointer.String(apicastDefaultLogLevel)) + cfg.OIDCLogLevel = stringOrDefault(cfg.OIDCLogLevel, pointer.String(apicastDefaultOIDCLogLevel)) } diff --git a/api/v1alpha1/autossl_types.go b/api/v1alpha1/autossl_types.go index 3a8c1550..fb93d9b0 100644 --- a/api/v1alpha1/autossl_types.go +++ b/api/v1alpha1/autossl_types.go @@ -28,19 +28,19 @@ import ( var ( autosslDefaultReplicas int32 = 2 autosslDefaultImage defaultImageSpec = defaultImageSpec{ - Name: pointer.StringPtr("quay.io/3scale/autossl"), - Tag: pointer.StringPtr("latest"), - PullPolicy: (*corev1.PullPolicy)(pointer.StringPtr(string(corev1.PullIfNotPresent))), + Name: pointer.String("quay.io/3scale/autossl"), + Tag: pointer.String("latest"), + PullPolicy: (*corev1.PullPolicy)(pointer.String(string(corev1.PullIfNotPresent))), } autosslDefaultLoadBalancer defaultLoadBalancerSpec = defaultLoadBalancerSpec{ - ProxyProtocol: pointer.BoolPtr(true), - CrossZoneLoadBalancingEnabled: pointer.BoolPtr(true), - ConnectionDrainingEnabled: pointer.BoolPtr(true), - ConnectionDrainingTimeout: pointer.Int32Ptr(60), - HealthcheckHealthyThreshold: pointer.Int32Ptr(2), - HealthcheckUnhealthyThreshold: pointer.Int32Ptr(2), - HealthcheckInterval: pointer.Int32Ptr(5), - HealthcheckTimeout: pointer.Int32Ptr(3), + ProxyProtocol: pointer.Bool(true), + CrossZoneLoadBalancingEnabled: pointer.Bool(true), + ConnectionDrainingEnabled: pointer.Bool(true), + ConnectionDrainingTimeout: pointer.Int32(60), + HealthcheckHealthyThreshold: pointer.Int32(2), + HealthcheckUnhealthyThreshold: pointer.Int32(2), + HealthcheckInterval: pointer.Int32(5), + HealthcheckTimeout: pointer.Int32(3), } autosslDefaultResources defaultResourceRequirementsSpec = defaultResourceRequirementsSpec{ Requests: corev1.ResourceList{ @@ -53,25 +53,25 @@ var ( }, } autosslDefaultHPA defaultHorizontalPodAutoscalerSpec = defaultHorizontalPodAutoscalerSpec{ - MinReplicas: pointer.Int32Ptr(2), - MaxReplicas: pointer.Int32Ptr(4), - ResourceUtilization: pointer.Int32Ptr(90), - ResourceName: pointer.StringPtr("cpu"), + MinReplicas: pointer.Int32(2), + MaxReplicas: pointer.Int32(4), + ResourceUtilization: pointer.Int32(90), + ResourceName: pointer.String("cpu"), } autosslDefaultProbe defaultProbeSpec = defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(25), - TimeoutSeconds: pointer.Int32Ptr(1), - PeriodSeconds: pointer.Int32Ptr(10), - SuccessThreshold: pointer.Int32Ptr(1), - FailureThreshold: pointer.Int32Ptr(3), + InitialDelaySeconds: pointer.Int32(25), + TimeoutSeconds: pointer.Int32(1), + PeriodSeconds: pointer.Int32(10), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(3), } autosslDefaultPDB defaultPodDisruptionBudgetSpec = defaultPodDisruptionBudgetSpec{ MaxUnavailable: util.IntStrPtr(intstr.FromInt(1)), } autosslDefaultGrafanaDashboard defaultGrafanaDashboardSpec = defaultGrafanaDashboardSpec{ - SelectorKey: pointer.StringPtr("monitoring-key"), - SelectorValue: pointer.StringPtr("middleware"), + SelectorKey: pointer.String("monitoring-key"), + SelectorValue: pointer.String("middleware"), } autosslDefaultACMEStaging bool = false autosslDefaultRedisPort int32 = 6379 @@ -208,9 +208,9 @@ type AutoSSLConfig struct { // Default sets default values for any value not specifically set in the AutoSSLConfig struct func (cfg *AutoSSLConfig) Default() { - cfg.ACMEStaging = boolOrDefault(cfg.ACMEStaging, pointer.BoolPtr(autosslDefaultACMEStaging)) - cfg.RedisPort = intOrDefault(cfg.RedisPort, pointer.Int32Ptr(autosslDefaultRedisPort)) - cfg.LogLevel = stringOrDefault(cfg.LogLevel, pointer.StringPtr(autosslDefaultLogLevel)) + cfg.ACMEStaging = boolOrDefault(cfg.ACMEStaging, pointer.Bool(autosslDefaultACMEStaging)) + cfg.RedisPort = intOrDefault(cfg.RedisPort, pointer.Int32(autosslDefaultRedisPort)) + cfg.LogLevel = stringOrDefault(cfg.LogLevel, pointer.String(autosslDefaultLogLevel)) if cfg.DomainWhitelist == nil { cfg.DomainWhitelist = []string{} } diff --git a/api/v1alpha1/backend_types.go b/api/v1alpha1/backend_types.go index c8f227c8..b98bf781 100644 --- a/api/v1alpha1/backend_types.go +++ b/api/v1alpha1/backend_types.go @@ -27,28 +27,28 @@ import ( var ( backendDefaultImage defaultImageSpec = defaultImageSpec{ - Name: pointer.StringPtr("quay.io/3scale/apisonator"), - Tag: pointer.StringPtr("nightly"), - PullPolicy: (*corev1.PullPolicy)(pointer.StringPtr(string(corev1.PullIfNotPresent))), + Name: pointer.String("quay.io/3scale/apisonator"), + Tag: pointer.String("nightly"), + PullPolicy: (*corev1.PullPolicy)(pointer.String(string(corev1.PullIfNotPresent))), } backendDefaultGrafanaDashboard defaultGrafanaDashboardSpec = defaultGrafanaDashboardSpec{ - SelectorKey: pointer.StringPtr("monitoring-key"), - SelectorValue: pointer.StringPtr("middleware"), + SelectorKey: pointer.String("monitoring-key"), + SelectorValue: pointer.String("middleware"), } backendDefaultConfigRackEnv string = "dev" backendDefaultConfigMasterServiceID int32 = 6 backendDefaultListenerHPA defaultHorizontalPodAutoscalerSpec = defaultHorizontalPodAutoscalerSpec{ - MinReplicas: pointer.Int32Ptr(2), - MaxReplicas: pointer.Int32Ptr(4), - ResourceUtilization: pointer.Int32Ptr(90), - ResourceName: pointer.StringPtr("cpu"), + MinReplicas: pointer.Int32(2), + MaxReplicas: pointer.Int32(4), + ResourceUtilization: pointer.Int32(90), + ResourceName: pointer.String("cpu"), } backendDefaultListenerPDB defaultPodDisruptionBudgetSpec = defaultPodDisruptionBudgetSpec{ MaxUnavailable: util.IntStrPtr(intstr.FromInt(1)), } backendDefaultListenerNLBLoadBalancer defaultNLBLoadBalancerSpec = defaultNLBLoadBalancerSpec{ - ProxyProtocol: pointer.BoolPtr(true), - CrossZoneLoadBalancingEnabled: pointer.BoolPtr(true), + ProxyProtocol: pointer.Bool(true), + CrossZoneLoadBalancingEnabled: pointer.Bool(true), } backendDefaultListenerReplicas int32 = 2 backendDefaultListenerResources defaultResourceRequirementsSpec = defaultResourceRequirementsSpec{ @@ -62,18 +62,18 @@ var ( }, } backendDefaultListenerLivenessProbe defaultProbeSpec = defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(30), - TimeoutSeconds: pointer.Int32Ptr(1), - PeriodSeconds: pointer.Int32Ptr(10), - SuccessThreshold: pointer.Int32Ptr(1), - FailureThreshold: pointer.Int32Ptr(3), + InitialDelaySeconds: pointer.Int32(30), + TimeoutSeconds: pointer.Int32(1), + PeriodSeconds: pointer.Int32(10), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(3), } backendDefaultListenerReadinessProbe defaultProbeSpec = defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(30), - TimeoutSeconds: pointer.Int32Ptr(5), - PeriodSeconds: pointer.Int32Ptr(10), - SuccessThreshold: pointer.Int32Ptr(1), - FailureThreshold: pointer.Int32Ptr(3), + InitialDelaySeconds: pointer.Int32(30), + TimeoutSeconds: pointer.Int32(5), + PeriodSeconds: pointer.Int32(10), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(3), } backendDefaultListenerMarin3rSpec defaultMarin3rSidecarSpec = defaultMarin3rSidecarSpec{} backendDefaultListenerConfigLogFormat string = "json" @@ -81,10 +81,10 @@ var ( backendDefaultListenerConfigListenerWorkers int32 = 16 backendDefaultListenerConfigLegacyReferrerFilters bool = true backendDefaultWorkerHPA defaultHorizontalPodAutoscalerSpec = defaultHorizontalPodAutoscalerSpec{ - MinReplicas: pointer.Int32Ptr(2), - MaxReplicas: pointer.Int32Ptr(4), - ResourceUtilization: pointer.Int32Ptr(90), - ResourceName: pointer.StringPtr("cpu"), + MinReplicas: pointer.Int32(2), + MaxReplicas: pointer.Int32(4), + ResourceUtilization: pointer.Int32(90), + ResourceName: pointer.String("cpu"), } backendDefaultWorkerPDB defaultPodDisruptionBudgetSpec = defaultPodDisruptionBudgetSpec{ MaxUnavailable: util.IntStrPtr(intstr.FromInt(1)), @@ -101,18 +101,18 @@ var ( }, } backendDefaultWorkerLivenessProbe defaultProbeSpec = defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(10), - TimeoutSeconds: pointer.Int32Ptr(3), - PeriodSeconds: pointer.Int32Ptr(15), - SuccessThreshold: pointer.Int32Ptr(1), - FailureThreshold: pointer.Int32Ptr(3), + InitialDelaySeconds: pointer.Int32(10), + TimeoutSeconds: pointer.Int32(3), + PeriodSeconds: pointer.Int32(15), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(3), } backendDefaultWorkerReadinessProbe defaultProbeSpec = defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(10), - TimeoutSeconds: pointer.Int32Ptr(5), - PeriodSeconds: pointer.Int32Ptr(30), - SuccessThreshold: pointer.Int32Ptr(1), - FailureThreshold: pointer.Int32Ptr(3), + InitialDelaySeconds: pointer.Int32(10), + TimeoutSeconds: pointer.Int32(5), + PeriodSeconds: pointer.Int32(30), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(3), } backendDefaultWorkerConfigLogFormat string = "json" backendDefaultWorkerConfigRedisAsync bool = false @@ -407,8 +407,8 @@ type BackendConfig struct { // Default sets default values for any value not specifically set in the BackendConfig struct func (cfg *BackendConfig) Default() { - cfg.RackEnv = stringOrDefault(cfg.RackEnv, pointer.StringPtr(backendDefaultConfigRackEnv)) - cfg.MasterServiceID = intOrDefault(cfg.MasterServiceID, pointer.Int32Ptr(backendDefaultConfigMasterServiceID)) + cfg.RackEnv = stringOrDefault(cfg.RackEnv, pointer.String(backendDefaultConfigRackEnv)) + cfg.MasterServiceID = intOrDefault(cfg.MasterServiceID, pointer.Int32(backendDefaultConfigMasterServiceID)) cfg.ExternalSecret.SecretStoreRef = InitializeExternalSecretSecretStoreReferenceSpec(cfg.ExternalSecret.SecretStoreRef, defaultExternalSecretSecretStoreReference) cfg.ExternalSecret.RefreshInterval = durationOrDefault(cfg.ExternalSecret.RefreshInterval, &defaultExternalSecretRefreshInterval) } @@ -436,10 +436,10 @@ type ListenerConfig struct { // Default sets default values for any value not specifically set in the ListenerConfig struct func (cfg *ListenerConfig) Default() { - cfg.LogFormat = stringOrDefault(cfg.LogFormat, pointer.StringPtr(backendDefaultListenerConfigLogFormat)) - cfg.RedisAsync = boolOrDefault(cfg.RedisAsync, pointer.BoolPtr(backendDefaultListenerConfigRedisAsync)) - cfg.ListenerWorkers = intOrDefault(cfg.ListenerWorkers, pointer.Int32Ptr(backendDefaultListenerConfigListenerWorkers)) - cfg.LegacyReferrerFilters = boolOrDefault(cfg.LegacyReferrerFilters, pointer.BoolPtr(backendDefaultListenerConfigLegacyReferrerFilters)) + cfg.LogFormat = stringOrDefault(cfg.LogFormat, pointer.String(backendDefaultListenerConfigLogFormat)) + cfg.RedisAsync = boolOrDefault(cfg.RedisAsync, pointer.Bool(backendDefaultListenerConfigRedisAsync)) + cfg.ListenerWorkers = intOrDefault(cfg.ListenerWorkers, pointer.Int32(backendDefaultListenerConfigListenerWorkers)) + cfg.LegacyReferrerFilters = boolOrDefault(cfg.LegacyReferrerFilters, pointer.Bool(backendDefaultListenerConfigLegacyReferrerFilters)) } // WorkerConfig configures app behavior for Backend Worker @@ -457,8 +457,8 @@ type WorkerConfig struct { // Default sets default values for any value not specifically set in the WorkerConfig struct func (cfg *WorkerConfig) Default() { - cfg.LogFormat = stringOrDefault(cfg.LogFormat, pointer.StringPtr(backendDefaultWorkerConfigLogFormat)) - cfg.RedisAsync = boolOrDefault(cfg.RedisAsync, pointer.BoolPtr(backendDefaultWorkerConfigRedisAsync)) + cfg.LogFormat = stringOrDefault(cfg.LogFormat, pointer.String(backendDefaultWorkerConfigLogFormat)) + cfg.RedisAsync = boolOrDefault(cfg.RedisAsync, pointer.Bool(backendDefaultWorkerConfigRedisAsync)) } // BackendStatus defines the observed state of Backend diff --git a/api/v1alpha1/common_types.go b/api/v1alpha1/common_types.go index a9ada1b5..0b2231fd 100644 --- a/api/v1alpha1/common_types.go +++ b/api/v1alpha1/common_types.go @@ -42,8 +42,8 @@ const ( var ( defaultExternalSecretRefreshInterval metav1.Duration = metav1.Duration{Duration: 60 * time.Second} defaultExternalSecretSecretStoreReference defaultExternalSecretSecretStoreReferenceSpec = defaultExternalSecretSecretStoreReferenceSpec{ - Name: pointer.StringPtr("vault-mgmt"), - Kind: pointer.StringPtr("ClusterSecretStore"), + Name: pointer.String("vault-mgmt"), + Kind: pointer.String("ClusterSecretStore"), } ) @@ -634,6 +634,18 @@ func (bs *BugsnagSpec) Enabled() bool { return !reflect.DeepEqual(bs, &BugsnagSpec{}) } +// AddressSpec allows the definition of an address +type AddressSpec struct { + // Defines the address host + // +operator-sdk:csv:customresourcedefinitions:type=spec + // +optional + Host *string `json:"host,omitempty"` + // Defines the address port + // +operator-sdk:csv:customresourcedefinitions:type=spec + // +optional + Port *int32 `json:"port,omitempty"` +} + // Canary allows the definition of a canary Deployment type Canary struct { // SendTraffic controls if traffic is sent to the canary diff --git a/api/v1alpha1/common_types_test.go b/api/v1alpha1/common_types_test.go index 7f324908..6f58bebf 100644 --- a/api/v1alpha1/common_types_test.go +++ b/api/v1alpha1/common_types_test.go @@ -48,34 +48,34 @@ func TestImageSpec_Default(t *testing.T) { name: "Sets defaults", fields: fields{}, args: args{def: defaultImageSpec{ - Name: pointer.StringPtr("name"), - Tag: pointer.StringPtr("tag"), - PullSecretName: pointer.StringPtr("pullSecret"), + Name: pointer.String("name"), + Tag: pointer.String("tag"), + PullSecretName: pointer.String("pullSecret"), PullPolicy: func() *corev1.PullPolicy { p := corev1.PullIfNotPresent; return &p }(), }}, want: &ImageSpec{ - Name: pointer.StringPtr("name"), - Tag: pointer.StringPtr("tag"), - PullSecretName: pointer.StringPtr("pullSecret"), + Name: pointer.String("name"), + Tag: pointer.String("tag"), + PullSecretName: pointer.String("pullSecret"), PullPolicy: func() *corev1.PullPolicy { p := corev1.PullIfNotPresent; return &p }(), }, }, { name: "Combines explicitely set values with defaults", fields: fields{ - Name: pointer.StringPtr("explicit"), + Name: pointer.String("explicit"), PullPolicy: func() *corev1.PullPolicy { p := corev1.PullAlways; return &p }(), }, args: args{def: defaultImageSpec{ - Name: pointer.StringPtr("name"), - Tag: pointer.StringPtr("tag"), - PullSecretName: pointer.StringPtr("pullSecret"), + Name: pointer.String("name"), + Tag: pointer.String("tag"), + PullSecretName: pointer.String("pullSecret"), PullPolicy: func() *corev1.PullPolicy { p := corev1.PullIfNotPresent; return &p }(), }}, want: &ImageSpec{ - Name: pointer.StringPtr("explicit"), - Tag: pointer.StringPtr("tag"), - PullSecretName: pointer.StringPtr("pullSecret"), + Name: pointer.String("explicit"), + Tag: pointer.String("tag"), + PullSecretName: pointer.String("pullSecret"), PullPolicy: func() *corev1.PullPolicy { p := corev1.PullAlways; return &p }(), }, }, @@ -127,27 +127,27 @@ func TestInitializeImageSpec(t *testing.T) { { name: "Initializes the struct with appropriate defaults if nil", args: args{nil, defaultImageSpec{ - Name: pointer.StringPtr("name"), - Tag: pointer.StringPtr("tag"), - PullSecretName: pointer.StringPtr("pullSecret"), + Name: pointer.String("name"), + Tag: pointer.String("tag"), + PullSecretName: pointer.String("pullSecret"), }}, want: &ImageSpec{ - Name: pointer.StringPtr("name"), - Tag: pointer.StringPtr("tag"), - PullSecretName: pointer.StringPtr("pullSecret"), + Name: pointer.String("name"), + Tag: pointer.String("tag"), + PullSecretName: pointer.String("pullSecret"), }, }, { name: "Initializes the struct with appropriate defaults if empty", args: args{&ImageSpec{}, defaultImageSpec{ - Name: pointer.StringPtr("name"), - Tag: pointer.StringPtr("tag"), - PullSecretName: pointer.StringPtr("pullSecret"), + Name: pointer.String("name"), + Tag: pointer.String("tag"), + PullSecretName: pointer.String("pullSecret"), }}, want: &ImageSpec{ - Name: pointer.StringPtr("name"), - Tag: pointer.StringPtr("tag"), - PullSecretName: pointer.StringPtr("pullSecret"), + Name: pointer.String("name"), + Tag: pointer.String("tag"), + PullSecretName: pointer.String("pullSecret"), }, }, } @@ -181,38 +181,38 @@ func TestProbeSpec_Default(t *testing.T) { name: "Sets defaults", fields: fields{}, args: args{def: defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(1), - TimeoutSeconds: pointer.Int32Ptr(2), - PeriodSeconds: pointer.Int32Ptr(3), - SuccessThreshold: pointer.Int32Ptr(4), - FailureThreshold: pointer.Int32Ptr(5), + InitialDelaySeconds: pointer.Int32(1), + TimeoutSeconds: pointer.Int32(2), + PeriodSeconds: pointer.Int32(3), + SuccessThreshold: pointer.Int32(4), + FailureThreshold: pointer.Int32(5), }}, want: &ProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(1), - TimeoutSeconds: pointer.Int32Ptr(2), - PeriodSeconds: pointer.Int32Ptr(3), - SuccessThreshold: pointer.Int32Ptr(4), - FailureThreshold: pointer.Int32Ptr(5), + InitialDelaySeconds: pointer.Int32(1), + TimeoutSeconds: pointer.Int32(2), + PeriodSeconds: pointer.Int32(3), + SuccessThreshold: pointer.Int32(4), + FailureThreshold: pointer.Int32(5), }, }, { name: "Combines explicitely set values with defaults", fields: fields{ - InitialDelaySeconds: pointer.Int32Ptr(9999), + InitialDelaySeconds: pointer.Int32(9999), }, args: args{def: defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(1), - TimeoutSeconds: pointer.Int32Ptr(2), - PeriodSeconds: pointer.Int32Ptr(3), - SuccessThreshold: pointer.Int32Ptr(4), - FailureThreshold: pointer.Int32Ptr(5), + InitialDelaySeconds: pointer.Int32(1), + TimeoutSeconds: pointer.Int32(2), + PeriodSeconds: pointer.Int32(3), + SuccessThreshold: pointer.Int32(4), + FailureThreshold: pointer.Int32(5), }}, want: &ProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(9999), - TimeoutSeconds: pointer.Int32Ptr(2), - PeriodSeconds: pointer.Int32Ptr(3), - SuccessThreshold: pointer.Int32Ptr(4), - FailureThreshold: pointer.Int32Ptr(5), + InitialDelaySeconds: pointer.Int32(9999), + TimeoutSeconds: pointer.Int32(2), + PeriodSeconds: pointer.Int32(3), + SuccessThreshold: pointer.Int32(4), + FailureThreshold: pointer.Int32(5), }, }, } @@ -241,7 +241,7 @@ func TestProbeSpec_IsDeactivated(t *testing.T) { }{ {"Wants true if empty", &ProbeSpec{}, true}, {"Wants false if nil", nil, false}, - {"Wants false if other", &ProbeSpec{InitialDelaySeconds: pointer.Int32Ptr(1)}, false}, + {"Wants false if other", &ProbeSpec{InitialDelaySeconds: pointer.Int32(1)}, false}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -265,18 +265,18 @@ func TestInitializeProbeSpec(t *testing.T) { { name: "Initializes the struct with appropriate defaults if nil", args: args{nil, defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(1), - TimeoutSeconds: pointer.Int32Ptr(2), - PeriodSeconds: pointer.Int32Ptr(3), - SuccessThreshold: pointer.Int32Ptr(4), - FailureThreshold: pointer.Int32Ptr(5), + InitialDelaySeconds: pointer.Int32(1), + TimeoutSeconds: pointer.Int32(2), + PeriodSeconds: pointer.Int32(3), + SuccessThreshold: pointer.Int32(4), + FailureThreshold: pointer.Int32(5), }}, want: &ProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(1), - TimeoutSeconds: pointer.Int32Ptr(2), - PeriodSeconds: pointer.Int32Ptr(3), - SuccessThreshold: pointer.Int32Ptr(4), - FailureThreshold: pointer.Int32Ptr(5), + InitialDelaySeconds: pointer.Int32(1), + TimeoutSeconds: pointer.Int32(2), + PeriodSeconds: pointer.Int32(3), + SuccessThreshold: pointer.Int32(4), + FailureThreshold: pointer.Int32(5), }, }, { @@ -318,50 +318,50 @@ func TestLoadBalancerSpec_Default(t *testing.T) { name: "Sets defaults", fields: fields{}, args: args{def: defaultLoadBalancerSpec{ - ProxyProtocol: pointer.BoolPtr(true), - CrossZoneLoadBalancingEnabled: pointer.BoolPtr(true), - ConnectionDrainingEnabled: pointer.BoolPtr(true), - ConnectionDrainingTimeout: pointer.Int32Ptr(1), - HealthcheckHealthyThreshold: pointer.Int32Ptr(2), - HealthcheckUnhealthyThreshold: pointer.Int32Ptr(3), - HealthcheckInterval: pointer.Int32Ptr(4), - HealthcheckTimeout: pointer.Int32Ptr(5), + ProxyProtocol: pointer.Bool(true), + CrossZoneLoadBalancingEnabled: pointer.Bool(true), + ConnectionDrainingEnabled: pointer.Bool(true), + ConnectionDrainingTimeout: pointer.Int32(1), + HealthcheckHealthyThreshold: pointer.Int32(2), + HealthcheckUnhealthyThreshold: pointer.Int32(3), + HealthcheckInterval: pointer.Int32(4), + HealthcheckTimeout: pointer.Int32(5), }}, want: &LoadBalancerSpec{ - ProxyProtocol: pointer.BoolPtr(true), - CrossZoneLoadBalancingEnabled: pointer.BoolPtr(true), - ConnectionDrainingEnabled: pointer.BoolPtr(true), - ConnectionDrainingTimeout: pointer.Int32Ptr(1), - HealthcheckHealthyThreshold: pointer.Int32Ptr(2), - HealthcheckUnhealthyThreshold: pointer.Int32Ptr(3), - HealthcheckInterval: pointer.Int32Ptr(4), - HealthcheckTimeout: pointer.Int32Ptr(5), + ProxyProtocol: pointer.Bool(true), + CrossZoneLoadBalancingEnabled: pointer.Bool(true), + ConnectionDrainingEnabled: pointer.Bool(true), + ConnectionDrainingTimeout: pointer.Int32(1), + HealthcheckHealthyThreshold: pointer.Int32(2), + HealthcheckUnhealthyThreshold: pointer.Int32(3), + HealthcheckInterval: pointer.Int32(4), + HealthcheckTimeout: pointer.Int32(5), }, }, { name: "Combines explicitely set values with defaults", fields: fields{ - ProxyProtocol: pointer.BoolPtr(false), + ProxyProtocol: pointer.Bool(false), }, args: args{def: defaultLoadBalancerSpec{ - ProxyProtocol: pointer.BoolPtr(true), - CrossZoneLoadBalancingEnabled: pointer.BoolPtr(true), - ConnectionDrainingEnabled: pointer.BoolPtr(true), - ConnectionDrainingTimeout: pointer.Int32Ptr(1), - HealthcheckHealthyThreshold: pointer.Int32Ptr(2), - HealthcheckUnhealthyThreshold: pointer.Int32Ptr(3), - HealthcheckInterval: pointer.Int32Ptr(4), - HealthcheckTimeout: pointer.Int32Ptr(5), + ProxyProtocol: pointer.Bool(true), + CrossZoneLoadBalancingEnabled: pointer.Bool(true), + ConnectionDrainingEnabled: pointer.Bool(true), + ConnectionDrainingTimeout: pointer.Int32(1), + HealthcheckHealthyThreshold: pointer.Int32(2), + HealthcheckUnhealthyThreshold: pointer.Int32(3), + HealthcheckInterval: pointer.Int32(4), + HealthcheckTimeout: pointer.Int32(5), }}, want: &LoadBalancerSpec{ - ProxyProtocol: pointer.BoolPtr(false), - CrossZoneLoadBalancingEnabled: pointer.BoolPtr(true), - ConnectionDrainingEnabled: pointer.BoolPtr(true), - ConnectionDrainingTimeout: pointer.Int32Ptr(1), - HealthcheckHealthyThreshold: pointer.Int32Ptr(2), - HealthcheckUnhealthyThreshold: pointer.Int32Ptr(3), - HealthcheckInterval: pointer.Int32Ptr(4), - HealthcheckTimeout: pointer.Int32Ptr(5), + ProxyProtocol: pointer.Bool(false), + CrossZoneLoadBalancingEnabled: pointer.Bool(true), + ConnectionDrainingEnabled: pointer.Bool(true), + ConnectionDrainingTimeout: pointer.Int32(1), + HealthcheckHealthyThreshold: pointer.Int32(2), + HealthcheckUnhealthyThreshold: pointer.Int32(3), + HealthcheckInterval: pointer.Int32(4), + HealthcheckTimeout: pointer.Int32(5), }, }, } @@ -393,7 +393,7 @@ func TestLoadBalancerSpec_IsDeactivated(t *testing.T) { }{ {"Wants false if empty", &LoadBalancerSpec{}, false}, {"Wants false if nil", nil, false}, - {"Wants false if other", &LoadBalancerSpec{ProxyProtocol: pointer.BoolPtr(false)}, false}} + {"Wants false if other", &LoadBalancerSpec{ProxyProtocol: pointer.Bool(false)}, false}} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := tt.spec.IsDeactivated(); got != tt.want { @@ -416,47 +416,47 @@ func TestInitializeLoadBalancerSpec(t *testing.T) { { name: "Initializes the struct with appropriate defaults if nil", args: args{nil, defaultLoadBalancerSpec{ - ProxyProtocol: pointer.BoolPtr(true), - CrossZoneLoadBalancingEnabled: pointer.BoolPtr(true), - ConnectionDrainingEnabled: pointer.BoolPtr(true), - ConnectionDrainingTimeout: pointer.Int32Ptr(1), - HealthcheckHealthyThreshold: pointer.Int32Ptr(2), - HealthcheckUnhealthyThreshold: pointer.Int32Ptr(3), - HealthcheckInterval: pointer.Int32Ptr(4), - HealthcheckTimeout: pointer.Int32Ptr(5), + ProxyProtocol: pointer.Bool(true), + CrossZoneLoadBalancingEnabled: pointer.Bool(true), + ConnectionDrainingEnabled: pointer.Bool(true), + ConnectionDrainingTimeout: pointer.Int32(1), + HealthcheckHealthyThreshold: pointer.Int32(2), + HealthcheckUnhealthyThreshold: pointer.Int32(3), + HealthcheckInterval: pointer.Int32(4), + HealthcheckTimeout: pointer.Int32(5), }}, want: &LoadBalancerSpec{ - ProxyProtocol: pointer.BoolPtr(true), - CrossZoneLoadBalancingEnabled: pointer.BoolPtr(true), - ConnectionDrainingEnabled: pointer.BoolPtr(true), - ConnectionDrainingTimeout: pointer.Int32Ptr(1), - HealthcheckHealthyThreshold: pointer.Int32Ptr(2), - HealthcheckUnhealthyThreshold: pointer.Int32Ptr(3), - HealthcheckInterval: pointer.Int32Ptr(4), - HealthcheckTimeout: pointer.Int32Ptr(5), + ProxyProtocol: pointer.Bool(true), + CrossZoneLoadBalancingEnabled: pointer.Bool(true), + ConnectionDrainingEnabled: pointer.Bool(true), + ConnectionDrainingTimeout: pointer.Int32(1), + HealthcheckHealthyThreshold: pointer.Int32(2), + HealthcheckUnhealthyThreshold: pointer.Int32(3), + HealthcheckInterval: pointer.Int32(4), + HealthcheckTimeout: pointer.Int32(5), }, }, { name: "Initializes the struct with appropriate defaults if empty", args: args{&LoadBalancerSpec{}, defaultLoadBalancerSpec{ - ProxyProtocol: pointer.BoolPtr(true), - CrossZoneLoadBalancingEnabled: pointer.BoolPtr(true), - ConnectionDrainingEnabled: pointer.BoolPtr(true), - ConnectionDrainingTimeout: pointer.Int32Ptr(1), - HealthcheckHealthyThreshold: pointer.Int32Ptr(2), - HealthcheckUnhealthyThreshold: pointer.Int32Ptr(3), - HealthcheckInterval: pointer.Int32Ptr(4), - HealthcheckTimeout: pointer.Int32Ptr(5), + ProxyProtocol: pointer.Bool(true), + CrossZoneLoadBalancingEnabled: pointer.Bool(true), + ConnectionDrainingEnabled: pointer.Bool(true), + ConnectionDrainingTimeout: pointer.Int32(1), + HealthcheckHealthyThreshold: pointer.Int32(2), + HealthcheckUnhealthyThreshold: pointer.Int32(3), + HealthcheckInterval: pointer.Int32(4), + HealthcheckTimeout: pointer.Int32(5), }}, want: &LoadBalancerSpec{ - ProxyProtocol: pointer.BoolPtr(true), - CrossZoneLoadBalancingEnabled: pointer.BoolPtr(true), - ConnectionDrainingEnabled: pointer.BoolPtr(true), - ConnectionDrainingTimeout: pointer.Int32Ptr(1), - HealthcheckHealthyThreshold: pointer.Int32Ptr(2), - HealthcheckUnhealthyThreshold: pointer.Int32Ptr(3), - HealthcheckInterval: pointer.Int32Ptr(4), - HealthcheckTimeout: pointer.Int32Ptr(5), + ProxyProtocol: pointer.Bool(true), + CrossZoneLoadBalancingEnabled: pointer.Bool(true), + ConnectionDrainingEnabled: pointer.Bool(true), + ConnectionDrainingTimeout: pointer.Int32(1), + HealthcheckHealthyThreshold: pointer.Int32(2), + HealthcheckUnhealthyThreshold: pointer.Int32(3), + HealthcheckInterval: pointer.Int32(4), + HealthcheckTimeout: pointer.Int32(5), }, }, } @@ -487,26 +487,26 @@ func TestNLBLoadBalancerSpec_Default(t *testing.T) { name: "Sets defaults", fields: fields{}, args: args{def: defaultNLBLoadBalancerSpec{ - ProxyProtocol: pointer.BoolPtr(true), - CrossZoneLoadBalancingEnabled: pointer.BoolPtr(true), + ProxyProtocol: pointer.Bool(true), + CrossZoneLoadBalancingEnabled: pointer.Bool(true), }}, want: &NLBLoadBalancerSpec{ - ProxyProtocol: pointer.BoolPtr(true), - CrossZoneLoadBalancingEnabled: pointer.BoolPtr(true), + ProxyProtocol: pointer.Bool(true), + CrossZoneLoadBalancingEnabled: pointer.Bool(true), }, }, { name: "Combines explicitely set values with defaults", fields: fields{ - ProxyProtocol: pointer.BoolPtr(false), + ProxyProtocol: pointer.Bool(false), }, args: args{def: defaultNLBLoadBalancerSpec{ - ProxyProtocol: pointer.BoolPtr(true), - CrossZoneLoadBalancingEnabled: pointer.BoolPtr(true), + ProxyProtocol: pointer.Bool(true), + CrossZoneLoadBalancingEnabled: pointer.Bool(true), }}, want: &NLBLoadBalancerSpec{ - ProxyProtocol: pointer.BoolPtr(false), - CrossZoneLoadBalancingEnabled: pointer.BoolPtr(true), + ProxyProtocol: pointer.Bool(false), + CrossZoneLoadBalancingEnabled: pointer.Bool(true), }, }, } @@ -532,7 +532,7 @@ func TestNLBLoadBalancerSpec_IsDeactivated(t *testing.T) { }{ {"Wants false if empty", &NLBLoadBalancerSpec{}, false}, {"Wants false if nil", nil, false}, - {"Wants false if other", &NLBLoadBalancerSpec{ProxyProtocol: pointer.BoolPtr(false)}, false}} + {"Wants false if other", &NLBLoadBalancerSpec{ProxyProtocol: pointer.Bool(false)}, false}} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := tt.spec.IsDeactivated(); got != tt.want { @@ -555,23 +555,23 @@ func TestInitializeNLBLoadBalancerSpec(t *testing.T) { { name: "Initializes the struct with appropriate defaults if nil", args: args{nil, defaultNLBLoadBalancerSpec{ - ProxyProtocol: pointer.BoolPtr(true), - CrossZoneLoadBalancingEnabled: pointer.BoolPtr(true), + ProxyProtocol: pointer.Bool(true), + CrossZoneLoadBalancingEnabled: pointer.Bool(true), }}, want: &NLBLoadBalancerSpec{ - ProxyProtocol: pointer.BoolPtr(true), - CrossZoneLoadBalancingEnabled: pointer.BoolPtr(true), + ProxyProtocol: pointer.Bool(true), + CrossZoneLoadBalancingEnabled: pointer.Bool(true), }, }, { name: "Initializes the struct with appropriate defaults if empty", args: args{&NLBLoadBalancerSpec{}, defaultNLBLoadBalancerSpec{ - ProxyProtocol: pointer.BoolPtr(true), - CrossZoneLoadBalancingEnabled: pointer.BoolPtr(true), + ProxyProtocol: pointer.Bool(true), + CrossZoneLoadBalancingEnabled: pointer.Bool(true), }}, want: &NLBLoadBalancerSpec{ - ProxyProtocol: pointer.BoolPtr(true), - CrossZoneLoadBalancingEnabled: pointer.BoolPtr(true), + ProxyProtocol: pointer.Bool(true), + CrossZoneLoadBalancingEnabled: pointer.Bool(true), }, }, } @@ -602,26 +602,26 @@ func TestGrafanaDashboardSpec_Default(t *testing.T) { name: "Sets defaults", fields: fields{}, args: args{def: defaultGrafanaDashboardSpec{ - SelectorKey: pointer.StringPtr("key"), - SelectorValue: pointer.StringPtr("label"), + SelectorKey: pointer.String("key"), + SelectorValue: pointer.String("label"), }}, want: &GrafanaDashboardSpec{ - SelectorKey: pointer.StringPtr("key"), - SelectorValue: pointer.StringPtr("label"), + SelectorKey: pointer.String("key"), + SelectorValue: pointer.String("label"), }, }, { name: "Combines explicitely set values with defaults", fields: fields{ - SelectorKey: pointer.StringPtr("xxxx"), + SelectorKey: pointer.String("xxxx"), }, args: args{def: defaultGrafanaDashboardSpec{ - SelectorKey: pointer.StringPtr("key"), - SelectorValue: pointer.StringPtr("label"), + SelectorKey: pointer.String("key"), + SelectorValue: pointer.String("label"), }}, want: &GrafanaDashboardSpec{ - SelectorKey: pointer.StringPtr("xxxx"), - SelectorValue: pointer.StringPtr("label"), + SelectorKey: pointer.String("xxxx"), + SelectorValue: pointer.String("label"), }, }, } @@ -647,7 +647,7 @@ func TestGrafanaDashboardSpec_IsDeactivated(t *testing.T) { }{ {"Wants true if empty", &GrafanaDashboardSpec{}, true}, {"Wants false if nil", nil, false}, - {"Wants false if other", &GrafanaDashboardSpec{SelectorKey: pointer.StringPtr("key")}, false}, + {"Wants false if other", &GrafanaDashboardSpec{SelectorKey: pointer.String("key")}, false}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -671,12 +671,12 @@ func TestInitializeGrafanaDashboardSpec(t *testing.T) { { name: "Initializes the struct with appropriate defaults if nil", args: args{nil, defaultGrafanaDashboardSpec{ - SelectorKey: pointer.StringPtr("key"), - SelectorValue: pointer.StringPtr("label"), + SelectorKey: pointer.String("key"), + SelectorValue: pointer.String("label"), }}, want: &GrafanaDashboardSpec{ - SelectorKey: pointer.StringPtr("key"), - SelectorValue: pointer.StringPtr("label"), + SelectorKey: pointer.String("key"), + SelectorValue: pointer.String("label"), }, }, { @@ -849,34 +849,34 @@ func TestHorizontalPodAutoscalerSpec_Default(t *testing.T) { name: "Sets defaults", fields: fields{}, args: args{def: defaultHorizontalPodAutoscalerSpec{ - MinReplicas: pointer.Int32Ptr(1), - MaxReplicas: pointer.Int32Ptr(2), - ResourceUtilization: pointer.Int32Ptr(3), - ResourceName: pointer.StringPtr("xxxx"), + MinReplicas: pointer.Int32(1), + MaxReplicas: pointer.Int32(2), + ResourceUtilization: pointer.Int32(3), + ResourceName: pointer.String("xxxx"), }}, want: &HorizontalPodAutoscalerSpec{ - MinReplicas: pointer.Int32Ptr(1), - MaxReplicas: pointer.Int32Ptr(2), - ResourceUtilization: pointer.Int32Ptr(3), - ResourceName: pointer.StringPtr("xxxx"), + MinReplicas: pointer.Int32(1), + MaxReplicas: pointer.Int32(2), + ResourceUtilization: pointer.Int32(3), + ResourceName: pointer.String("xxxx"), }, }, { name: "Combines explicitely set values with defaults", fields: fields{ - MinReplicas: pointer.Int32Ptr(9999), + MinReplicas: pointer.Int32(9999), }, args: args{def: defaultHorizontalPodAutoscalerSpec{ - MinReplicas: pointer.Int32Ptr(1), - MaxReplicas: pointer.Int32Ptr(2), - ResourceUtilization: pointer.Int32Ptr(3), - ResourceName: pointer.StringPtr("xxxx"), + MinReplicas: pointer.Int32(1), + MaxReplicas: pointer.Int32(2), + ResourceUtilization: pointer.Int32(3), + ResourceName: pointer.String("xxxx"), }}, want: &HorizontalPodAutoscalerSpec{ - MinReplicas: pointer.Int32Ptr(9999), - MaxReplicas: pointer.Int32Ptr(2), - ResourceUtilization: pointer.Int32Ptr(3), - ResourceName: pointer.StringPtr("xxxx"), + MinReplicas: pointer.Int32(9999), + MaxReplicas: pointer.Int32(2), + ResourceUtilization: pointer.Int32(3), + ResourceName: pointer.String("xxxx"), }, }, } @@ -904,7 +904,7 @@ func TestHorizontalPodAutoscalerSpec_IsDeactivated(t *testing.T) { }{ {"Wants true if empty", &HorizontalPodAutoscalerSpec{}, true}, {"Wants false if nil", nil, false}, - {"Wants false if other", &HorizontalPodAutoscalerSpec{MinReplicas: pointer.Int32Ptr(1)}, false}} + {"Wants false if other", &HorizontalPodAutoscalerSpec{MinReplicas: pointer.Int32(1)}, false}} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := tt.spec.IsDeactivated(); got != tt.want { @@ -927,16 +927,16 @@ func TestInitializeHorizontalPodAutoscalerSpec(t *testing.T) { { name: "Initializes the struct with appropriate defaults if nil", args: args{nil, defaultHorizontalPodAutoscalerSpec{ - MinReplicas: pointer.Int32Ptr(1), - MaxReplicas: pointer.Int32Ptr(2), - ResourceUtilization: pointer.Int32Ptr(3), - ResourceName: pointer.StringPtr("xxxx"), + MinReplicas: pointer.Int32(1), + MaxReplicas: pointer.Int32(2), + ResourceUtilization: pointer.Int32(3), + ResourceName: pointer.String("xxxx"), }}, want: &HorizontalPodAutoscalerSpec{ - MinReplicas: pointer.Int32Ptr(1), - MaxReplicas: pointer.Int32Ptr(2), - ResourceUtilization: pointer.Int32Ptr(3), - ResourceName: pointer.StringPtr("xxxx"), + MinReplicas: pointer.Int32(1), + MaxReplicas: pointer.Int32(2), + ResourceUtilization: pointer.Int32(3), + ResourceName: pointer.String("xxxx"), }, }, { @@ -1113,18 +1113,18 @@ func Test_stringOrDefault(t *testing.T) { { name: "Value explicitely set", args: args{ - value: pointer.StringPtr("value"), - defValue: pointer.StringPtr("default"), + value: pointer.String("value"), + defValue: pointer.String("default"), }, - want: pointer.StringPtr("value"), + want: pointer.String("value"), }, { name: "Value not set", args: args{ value: nil, - defValue: pointer.StringPtr("default"), + defValue: pointer.String("default"), }, - want: pointer.StringPtr("default"), + want: pointer.String("default"), }, { name: "Nor value not default set", @@ -1158,18 +1158,18 @@ func Test_intOrDefault(t *testing.T) { { name: "Value explicitely set", args: args{ - value: pointer.Int32Ptr(100), - defValue: pointer.Int32Ptr(10), + value: pointer.Int32(100), + defValue: pointer.Int32(10), }, - want: pointer.Int32Ptr(100), + want: pointer.Int32(100), }, { name: "Value not set", args: args{ value: nil, - defValue: pointer.Int32Ptr(10), + defValue: pointer.Int32(10), }, - want: pointer.Int32Ptr(10), + want: pointer.Int32(10), }, { name: "Nor value not default set", @@ -1203,18 +1203,18 @@ func Test_boolOrDefault(t *testing.T) { { name: "Value explicitely set", args: args{ - value: pointer.BoolPtr(true), - defValue: pointer.BoolPtr(false), + value: pointer.Bool(true), + defValue: pointer.Bool(false), }, - want: pointer.BoolPtr(true), + want: pointer.Bool(true), }, { name: "Value not set", args: args{ value: nil, - defValue: pointer.BoolPtr(false), + defValue: pointer.Bool(false), }, - want: pointer.BoolPtr(false), + want: pointer.Bool(false), }, { name: "Nor value not default set", @@ -1263,16 +1263,16 @@ func TestCanary_CanarySpec(t *testing.T) { args: args{ spec: &BackendSpec{ Image: &ImageSpec{ - Name: pointer.StringPtr("old"), - Tag: pointer.StringPtr("tag"), + Name: pointer.String("old"), + Tag: pointer.String("tag"), }, }, canarySpec: &BackendSpec{}, }, want: &BackendSpec{ Image: &ImageSpec{ - Name: pointer.StringPtr("new"), - Tag: pointer.StringPtr("tag"), + Name: pointer.String("new"), + Tag: pointer.String("tag"), }, }, wantErr: false, @@ -1316,26 +1316,26 @@ func TestExternalSecretSecretStoreReferenceSpec_Default(t *testing.T) { name: "Sets defaults", fields: fields{}, args: args{def: defaultExternalSecretSecretStoreReferenceSpec{ - Name: pointer.StringPtr("vault-mgmt"), - Kind: pointer.StringPtr("ClusterSecretStore"), + Name: pointer.String("vault-mgmt"), + Kind: pointer.String("ClusterSecretStore"), }}, want: &ExternalSecretSecretStoreReferenceSpec{ - Name: pointer.StringPtr("vault-mgmt"), - Kind: pointer.StringPtr("ClusterSecretStore"), + Name: pointer.String("vault-mgmt"), + Kind: pointer.String("ClusterSecretStore"), }, }, { name: "Combines explicitely set values with defaults", fields: fields{ - Name: pointer.StringPtr("other-vault"), + Name: pointer.String("other-vault"), }, args: args{def: defaultExternalSecretSecretStoreReferenceSpec{ - Name: pointer.StringPtr("vault-mgmt"), - Kind: pointer.StringPtr("ClusterSecretStore"), + Name: pointer.String("vault-mgmt"), + Kind: pointer.String("ClusterSecretStore"), }}, want: &ExternalSecretSecretStoreReferenceSpec{ - Name: pointer.StringPtr("other-vault"), - Kind: pointer.StringPtr("ClusterSecretStore"), + Name: pointer.String("other-vault"), + Kind: pointer.String("ClusterSecretStore"), }, }, } @@ -1366,12 +1366,12 @@ func TestInitializeVaultSecretStoreReferenceSpec(t *testing.T) { { name: "Initializes the struct with appropriate defaults if nil", args: args{nil, defaultExternalSecretSecretStoreReferenceSpec{ - Name: pointer.StringPtr("vault-mgmt"), - Kind: pointer.StringPtr("ClusterSecretStore"), + Name: pointer.String("vault-mgmt"), + Kind: pointer.String("ClusterSecretStore"), }}, want: &ExternalSecretSecretStoreReferenceSpec{ - Name: pointer.StringPtr("vault-mgmt"), - Kind: pointer.StringPtr("ClusterSecretStore"), + Name: pointer.String("vault-mgmt"), + Kind: pointer.String("ClusterSecretStore"), }, }, { diff --git a/api/v1alpha1/corsproxy_types.go b/api/v1alpha1/corsproxy_types.go index dc8b4e2c..d51faefc 100644 --- a/api/v1alpha1/corsproxy_types.go +++ b/api/v1alpha1/corsproxy_types.go @@ -28,9 +28,9 @@ import ( var ( corsproxyDefaultReplicas int32 = 2 corsproxyDefaultImage defaultImageSpec = defaultImageSpec{ - Name: pointer.StringPtr("quay.io/3scale/cors-proxy"), - Tag: pointer.StringPtr("latest"), - PullPolicy: (*corev1.PullPolicy)(pointer.StringPtr(string(corev1.PullIfNotPresent))), + Name: pointer.String("quay.io/3scale/cors-proxy"), + Tag: pointer.String("latest"), + PullPolicy: (*corev1.PullPolicy)(pointer.String(string(corev1.PullIfNotPresent))), } corsproxyDefaultResources defaultResourceRequirementsSpec = defaultResourceRequirementsSpec{ Requests: corev1.ResourceList{ @@ -43,25 +43,25 @@ var ( }, } corsproxyDefaultHPA defaultHorizontalPodAutoscalerSpec = defaultHorizontalPodAutoscalerSpec{ - MinReplicas: pointer.Int32Ptr(2), - MaxReplicas: pointer.Int32Ptr(4), - ResourceUtilization: pointer.Int32Ptr(90), - ResourceName: pointer.StringPtr("cpu"), + MinReplicas: pointer.Int32(2), + MaxReplicas: pointer.Int32(4), + ResourceUtilization: pointer.Int32(90), + ResourceName: pointer.String("cpu"), } corsproxyDefaultProbe defaultProbeSpec = defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(3), - TimeoutSeconds: pointer.Int32Ptr(1), - PeriodSeconds: pointer.Int32Ptr(10), - SuccessThreshold: pointer.Int32Ptr(1), - FailureThreshold: pointer.Int32Ptr(3), + InitialDelaySeconds: pointer.Int32(3), + TimeoutSeconds: pointer.Int32(1), + PeriodSeconds: pointer.Int32(10), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(3), } corsproxyDefaultPDB defaultPodDisruptionBudgetSpec = defaultPodDisruptionBudgetSpec{ MaxUnavailable: util.IntStrPtr(intstr.FromInt(1)), } corsproxyDefaultGrafanaDashboard defaultGrafanaDashboardSpec = defaultGrafanaDashboardSpec{ - SelectorKey: pointer.StringPtr("monitoring-key"), - SelectorValue: pointer.StringPtr("middleware"), + SelectorKey: pointer.String("monitoring-key"), + SelectorValue: pointer.String("middleware"), } ) diff --git a/api/v1alpha1/echoapi_types.go b/api/v1alpha1/echoapi_types.go index 7feb1f4b..4d1d54bf 100644 --- a/api/v1alpha1/echoapi_types.go +++ b/api/v1alpha1/echoapi_types.go @@ -27,16 +27,16 @@ import ( var ( echoapiDefaultImage defaultImageSpec = defaultImageSpec{ - Name: pointer.StringPtr("quay.io/3scale/echoapi"), - Tag: pointer.StringPtr("v1.0.3"), - PullPolicy: (*corev1.PullPolicy)(pointer.StringPtr(string(corev1.PullIfNotPresent))), + Name: pointer.String("quay.io/3scale/echoapi"), + Tag: pointer.String("v1.0.3"), + PullPolicy: (*corev1.PullPolicy)(pointer.String(string(corev1.PullIfNotPresent))), } echoapiDefaultReplicas int32 = 2 echoapiDefaultHPA defaultHorizontalPodAutoscalerSpec = defaultHorizontalPodAutoscalerSpec{ - MinReplicas: pointer.Int32Ptr(2), - MaxReplicas: pointer.Int32Ptr(4), - ResourceUtilization: pointer.Int32Ptr(90), - ResourceName: pointer.StringPtr("cpu"), + MinReplicas: pointer.Int32(2), + MaxReplicas: pointer.Int32(4), + ResourceUtilization: pointer.Int32(90), + ResourceName: pointer.String("cpu"), } echoapiDefaultPDB defaultPodDisruptionBudgetSpec = defaultPodDisruptionBudgetSpec{ MaxUnavailable: util.IntStrPtr(intstr.FromInt(1)), @@ -52,23 +52,23 @@ var ( }, } echoapiDefaultLivenessProbe defaultProbeSpec = defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(25), - TimeoutSeconds: pointer.Int32Ptr(2), - PeriodSeconds: pointer.Int32Ptr(20), - SuccessThreshold: pointer.Int32Ptr(1), - FailureThreshold: pointer.Int32Ptr(5), + InitialDelaySeconds: pointer.Int32(25), + TimeoutSeconds: pointer.Int32(2), + PeriodSeconds: pointer.Int32(20), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(5), } echoapiDefaultReadinessProbe defaultProbeSpec = defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(25), - TimeoutSeconds: pointer.Int32Ptr(2), - PeriodSeconds: pointer.Int32Ptr(20), - SuccessThreshold: pointer.Int32Ptr(1), - FailureThreshold: pointer.Int32Ptr(5), + InitialDelaySeconds: pointer.Int32(25), + TimeoutSeconds: pointer.Int32(2), + PeriodSeconds: pointer.Int32(20), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(5), } echoapiDefaultMarin3rSpec defaultMarin3rSidecarSpec = defaultMarin3rSidecarSpec{} echoapiDefaultNLBLoadBalancer defaultNLBLoadBalancerSpec = defaultNLBLoadBalancerSpec{ - ProxyProtocol: pointer.BoolPtr(true), - CrossZoneLoadBalancingEnabled: pointer.BoolPtr(true), + ProxyProtocol: pointer.Bool(true), + CrossZoneLoadBalancingEnabled: pointer.Bool(true), } ) diff --git a/api/v1alpha1/mappingservice_types.go b/api/v1alpha1/mappingservice_types.go index 670d1131..c1711b24 100644 --- a/api/v1alpha1/mappingservice_types.go +++ b/api/v1alpha1/mappingservice_types.go @@ -28,9 +28,9 @@ import ( var ( mappingserviceDefaultReplicas int32 = 2 mappingserviceDefaultImage defaultImageSpec = defaultImageSpec{ - Name: pointer.StringPtr("quay.io/3scale/apicast-cloud-hosted"), - Tag: pointer.StringPtr("latest"), - PullPolicy: (*corev1.PullPolicy)(pointer.StringPtr(string(corev1.PullIfNotPresent))), + Name: pointer.String("quay.io/3scale/apicast-cloud-hosted"), + Tag: pointer.String("latest"), + PullPolicy: (*corev1.PullPolicy)(pointer.String(string(corev1.PullIfNotPresent))), } mappingserviceDefaultResources defaultResourceRequirementsSpec = defaultResourceRequirementsSpec{ Requests: corev1.ResourceList{ @@ -43,32 +43,32 @@ var ( }, } mappingserviceDefaultHPA defaultHorizontalPodAutoscalerSpec = defaultHorizontalPodAutoscalerSpec{ - MinReplicas: pointer.Int32Ptr(2), - MaxReplicas: pointer.Int32Ptr(4), - ResourceUtilization: pointer.Int32Ptr(90), - ResourceName: pointer.StringPtr("cpu"), + MinReplicas: pointer.Int32(2), + MaxReplicas: pointer.Int32(4), + ResourceUtilization: pointer.Int32(90), + ResourceName: pointer.String("cpu"), } mappingserviceLivenessDefaultProbe defaultProbeSpec = defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(5), - TimeoutSeconds: pointer.Int32Ptr(5), - PeriodSeconds: pointer.Int32Ptr(10), - SuccessThreshold: pointer.Int32Ptr(1), - FailureThreshold: pointer.Int32Ptr(3), + InitialDelaySeconds: pointer.Int32(5), + TimeoutSeconds: pointer.Int32(5), + PeriodSeconds: pointer.Int32(10), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(3), } mappingserviceReadinessDefaultProbe defaultProbeSpec = defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(5), - TimeoutSeconds: pointer.Int32Ptr(5), - PeriodSeconds: pointer.Int32Ptr(30), - SuccessThreshold: pointer.Int32Ptr(1), - FailureThreshold: pointer.Int32Ptr(3), + InitialDelaySeconds: pointer.Int32(5), + TimeoutSeconds: pointer.Int32(5), + PeriodSeconds: pointer.Int32(30), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(3), } mappingserviceDefaultPDB defaultPodDisruptionBudgetSpec = defaultPodDisruptionBudgetSpec{ MaxUnavailable: util.IntStrPtr(intstr.FromInt(1)), } mappingserviceDefaultGrafanaDashboard defaultGrafanaDashboardSpec = defaultGrafanaDashboardSpec{ - SelectorKey: pointer.StringPtr("monitoring-key"), - SelectorValue: pointer.StringPtr("middleware"), + SelectorKey: pointer.String("monitoring-key"), + SelectorValue: pointer.String("middleware"), } mappingserviceDefaultLogLevel string = "warn" ) @@ -157,7 +157,7 @@ type MappingServiceConfig struct { // Default sets default values for any value not specifically set in the MappingServiceConfig struct func (cfg *MappingServiceConfig) Default() { - cfg.LogLevel = stringOrDefault(cfg.LogLevel, pointer.StringPtr(mappingserviceDefaultLogLevel)) + cfg.LogLevel = stringOrDefault(cfg.LogLevel, pointer.String(mappingserviceDefaultLogLevel)) cfg.ExternalSecret.SecretStoreRef = InitializeExternalSecretSecretStoreReferenceSpec(cfg.ExternalSecret.SecretStoreRef, defaultExternalSecretSecretStoreReference) cfg.ExternalSecret.RefreshInterval = durationOrDefault(cfg.ExternalSecret.RefreshInterval, &defaultExternalSecretRefreshInterval) } diff --git a/api/v1alpha1/redisshard_types.go b/api/v1alpha1/redisshard_types.go index 1720ff86..36d7a626 100644 --- a/api/v1alpha1/redisshard_types.go +++ b/api/v1alpha1/redisshard_types.go @@ -24,9 +24,9 @@ import ( var ( redisShardDefaultImage defaultImageSpec = defaultImageSpec{ - Name: pointer.StringPtr("redis"), - Tag: pointer.StringPtr("4.0.11-alpine"), - PullPolicy: (*corev1.PullPolicy)(pointer.StringPtr(string(corev1.PullIfNotPresent))), + Name: pointer.String("redis"), + Tag: pointer.String("4.0.11-alpine"), + PullPolicy: (*corev1.PullPolicy)(pointer.String(string(corev1.PullIfNotPresent))), } redisShardDefaultMasterIndex int32 = 0 RedisShardDefaultReplicas int32 = 3 diff --git a/api/v1alpha1/sentinel_types.go b/api/v1alpha1/sentinel_types.go index 38ac369a..32bcaebb 100644 --- a/api/v1alpha1/sentinel_types.go +++ b/api/v1alpha1/sentinel_types.go @@ -39,9 +39,9 @@ var ( SentinelDefaultReplicas int32 = 3 SentinelDefaultQuorum int = 2 sentinelDefaultImage defaultImageSpec = defaultImageSpec{ - Name: pointer.StringPtr("bitnami/redis-sentinel"), - Tag: pointer.StringPtr("4.0.11-debian-9-r110"), - PullPolicy: (*corev1.PullPolicy)(pointer.StringPtr(string(corev1.PullIfNotPresent))), + Name: pointer.String("bitnami/redis-sentinel"), + Tag: pointer.String("4.0.11-debian-9-r110"), + PullPolicy: (*corev1.PullPolicy)(pointer.String(string(corev1.PullIfNotPresent))), } sentinelDefaultResources defaultResourceRequirementsSpec = defaultResourceRequirementsSpec{ Requests: corev1.ResourceList{ @@ -54,19 +54,19 @@ var ( }, } sentinelDefaultProbe defaultProbeSpec = defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(25), - TimeoutSeconds: pointer.Int32Ptr(1), - PeriodSeconds: pointer.Int32Ptr(10), - SuccessThreshold: pointer.Int32Ptr(1), - FailureThreshold: pointer.Int32Ptr(3), + InitialDelaySeconds: pointer.Int32(25), + TimeoutSeconds: pointer.Int32(1), + PeriodSeconds: pointer.Int32(10), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(3), } sentinelDefaultPDB defaultPodDisruptionBudgetSpec = defaultPodDisruptionBudgetSpec{ MaxUnavailable: util.IntStrPtr(intstr.FromInt(1)), } sentinelDefaultGrafanaDashboard defaultGrafanaDashboardSpec = defaultGrafanaDashboardSpec{ - SelectorKey: pointer.StringPtr("monitoring-key"), - SelectorValue: pointer.StringPtr("middleware"), + SelectorKey: pointer.String("monitoring-key"), + SelectorValue: pointer.String("middleware"), } sentinelDefaultStorageSize string = "10Mi" sentinelDefaultMetricsRefreshInterval time.Duration = 30 * time.Second diff --git a/api/v1alpha1/system_types.go b/api/v1alpha1/system_types.go index 4547e28e..59f93634 100644 --- a/api/v1alpha1/system_types.go +++ b/api/v1alpha1/system_types.go @@ -48,28 +48,22 @@ var ( systemDefaultConfigFilesSecret string = "system-config" systemDefaultBugsnagSpec BugsnagSpec = BugsnagSpec{} systemDefaultImage defaultImageSpec = defaultImageSpec{ - Name: pointer.StringPtr("quay.io/3scale/porta"), - Tag: pointer.StringPtr("nightly"), - PullPolicy: (*corev1.PullPolicy)(pointer.StringPtr(string(corev1.PullIfNotPresent))), + Name: pointer.String("quay.io/3scale/porta"), + Tag: pointer.String("nightly"), + PullPolicy: (*corev1.PullPolicy)(pointer.String(string(corev1.PullIfNotPresent))), } systemDefaultGrafanaDashboard defaultGrafanaDashboardSpec = defaultGrafanaDashboardSpec{ - SelectorKey: pointer.StringPtr("monitoring-key"), - SelectorValue: pointer.StringPtr("middleware"), + 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) // App - systemDefaultAppReplicas int32 = 2 - systemDefaultAppLoadBalancer defaultLoadBalancerSpec = defaultLoadBalancerSpec{ - ProxyProtocol: pointer.BoolPtr(true), - CrossZoneLoadBalancingEnabled: pointer.BoolPtr(true), - ConnectionDrainingEnabled: pointer.BoolPtr(true), - ConnectionDrainingTimeout: pointer.Int32Ptr(60), - HealthcheckHealthyThreshold: pointer.Int32Ptr(2), - HealthcheckUnhealthyThreshold: pointer.Int32Ptr(2), - HealthcheckInterval: pointer.Int32Ptr(5), - HealthcheckTimeout: pointer.Int32Ptr(3), - } + systemDefaultAppReplicas int32 = 2 systemDefaultAppResources defaultResourceRequirementsSpec = defaultResourceRequirementsSpec{ Requests: corev1.ResourceList{ corev1.ResourceCPU: resource.MustParse("200m"), @@ -85,24 +79,24 @@ var ( MaxSurge: util.IntStrPtr(intstr.FromString("10%")), } systemDefaultAppHPA defaultHorizontalPodAutoscalerSpec = defaultHorizontalPodAutoscalerSpec{ - MinReplicas: pointer.Int32Ptr(2), - MaxReplicas: pointer.Int32Ptr(4), - ResourceUtilization: pointer.Int32Ptr(90), - ResourceName: pointer.StringPtr("cpu"), + MinReplicas: pointer.Int32(2), + MaxReplicas: pointer.Int32(4), + ResourceUtilization: pointer.Int32(90), + ResourceName: pointer.String("cpu"), } systemDefaultAppLivenessProbe defaultProbeSpec = defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(30), - TimeoutSeconds: pointer.Int32Ptr(1), - PeriodSeconds: pointer.Int32Ptr(10), - SuccessThreshold: pointer.Int32Ptr(1), - FailureThreshold: pointer.Int32Ptr(3), + InitialDelaySeconds: pointer.Int32(30), + TimeoutSeconds: pointer.Int32(1), + PeriodSeconds: pointer.Int32(10), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(3), } systemDefaultAppReadinessProbe defaultProbeSpec = defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(30), - TimeoutSeconds: pointer.Int32Ptr(5), - PeriodSeconds: pointer.Int32Ptr(10), - SuccessThreshold: pointer.Int32Ptr(1), - FailureThreshold: pointer.Int32Ptr(3), + InitialDelaySeconds: pointer.Int32(30), + TimeoutSeconds: pointer.Int32(5), + PeriodSeconds: pointer.Int32(10), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(3), } systemDefaultAppPDB defaultPodDisruptionBudgetSpec = defaultPodDisruptionBudgetSpec{ MaxUnavailable: util.IntStrPtr(intstr.FromInt(1)), @@ -125,24 +119,24 @@ var ( MaxSurge: util.IntStrPtr(intstr.FromInt(1)), } systemDefaultSidekiqHPA defaultHorizontalPodAutoscalerSpec = defaultHorizontalPodAutoscalerSpec{ - MinReplicas: pointer.Int32Ptr(2), - MaxReplicas: pointer.Int32Ptr(4), - ResourceUtilization: pointer.Int32Ptr(90), - ResourceName: pointer.StringPtr("cpu"), + MinReplicas: pointer.Int32(2), + MaxReplicas: pointer.Int32(4), + ResourceUtilization: pointer.Int32(90), + ResourceName: pointer.String("cpu"), } systemDefaultSidekiqLivenessProbe defaultProbeSpec = defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(10), - TimeoutSeconds: pointer.Int32Ptr(3), - PeriodSeconds: pointer.Int32Ptr(15), - SuccessThreshold: pointer.Int32Ptr(1), - FailureThreshold: pointer.Int32Ptr(5), + InitialDelaySeconds: pointer.Int32(10), + TimeoutSeconds: pointer.Int32(3), + PeriodSeconds: pointer.Int32(15), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(5), } systemDefaultSidekiqReadinessProbe defaultProbeSpec = defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(10), - TimeoutSeconds: pointer.Int32Ptr(5), - PeriodSeconds: pointer.Int32Ptr(30), - SuccessThreshold: pointer.Int32Ptr(1), - FailureThreshold: pointer.Int32Ptr(5), + InitialDelaySeconds: pointer.Int32(10), + TimeoutSeconds: pointer.Int32(5), + PeriodSeconds: pointer.Int32(30), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(5), } systemDefaultSidekiqPDB defaultPodDisruptionBudgetSpec = defaultPodDisruptionBudgetSpec{ MaxUnavailable: util.IntStrPtr(intstr.FromInt(1)), @@ -153,20 +147,22 @@ var ( "critical", "backend_sync", "events", "zync,40", "priority,25", "default,15", "web_hooks,10", "deletion,5", }, - MaxThreads: pointer.Int32Ptr(15), + MaxThreads: pointer.Int32(15), } systemDefaultSidekiqConfigBilling defaultSidekiqConfig = defaultSidekiqConfig{ Queues: []string{"billing"}, - MaxThreads: pointer.Int32Ptr(15), + MaxThreads: pointer.Int32(15), } systemDefaultSidekiqConfigLow defaultSidekiqConfig = defaultSidekiqConfig{ Queues: []string{ "mailers", "low", "bulk_indexing", }, - MaxThreads: pointer.Int32Ptr(15), + MaxThreads: pointer.Int32(15), } // Sphinx + systemDefaultSphinxEnabled bool = true + systemDefaultSphinxServiceName string = "system-sphinx" systemDefaultSphinxPort int32 = 9306 systemDefaultSphinxBindAddress string = "0.0.0.0" systemDefaultSphinxConfigFile string = "/opt/system/db/sphinx/sphinx.conf" @@ -185,18 +181,53 @@ var ( }, } systemDefaultSphinxLivenessProbe defaultProbeSpec = defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(60), - TimeoutSeconds: pointer.Int32Ptr(3), - PeriodSeconds: pointer.Int32Ptr(15), - SuccessThreshold: pointer.Int32Ptr(1), - FailureThreshold: pointer.Int32Ptr(5), + InitialDelaySeconds: pointer.Int32(60), + TimeoutSeconds: pointer.Int32(3), + PeriodSeconds: pointer.Int32(15), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(5), } systemDefaultSphinxReadinessProbe defaultProbeSpec = defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(60), - TimeoutSeconds: pointer.Int32Ptr(5), - PeriodSeconds: pointer.Int32Ptr(30), - SuccessThreshold: pointer.Int32Ptr(1), - FailureThreshold: pointer.Int32Ptr(5), + InitialDelaySeconds: pointer.Int32(60), + TimeoutSeconds: pointer.Int32(5), + PeriodSeconds: pointer.Int32(30), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(5), + } + // Searchd + systemDefaultSearchdEnabled bool = false + systemDefaultSearchdImage defaultImageSpec = defaultImageSpec{ + Name: pointer.String("quay.io/3scale/searchd"), + Tag: pointer.String("latest"), + PullPolicy: (*corev1.PullPolicy)(pointer.String(string(corev1.PullIfNotPresent))), + } + systemDefaultSearchdServiceName string = "system-searchd" + systemDefaultSearchdPort int32 = 9306 + systemDefaultSearchdDBPath string = "/var/lib/searchd" + systemDefaultSearchdDatabaseStorageSize string = "30Gi" + systemDefaultSearchdResources defaultResourceRequirementsSpec = defaultResourceRequirementsSpec{ + Requests: corev1.ResourceList{ + corev1.ResourceCPU: resource.MustParse("250m"), + corev1.ResourceMemory: resource.MustParse("4Gi"), + }, + Limits: corev1.ResourceList{ + corev1.ResourceCPU: resource.MustParse("750m"), + corev1.ResourceMemory: resource.MustParse("5Gi"), + }, + } + systemDefaultSearchdLivenessProbe defaultProbeSpec = defaultProbeSpec{ + InitialDelaySeconds: pointer.Int32(60), + TimeoutSeconds: pointer.Int32(3), + PeriodSeconds: pointer.Int32(15), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(5), + } + systemDefaultSearchdReadinessProbe defaultProbeSpec = defaultProbeSpec{ + InitialDelaySeconds: pointer.Int32(60), + TimeoutSeconds: pointer.Int32(5), + PeriodSeconds: pointer.Int32(30), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(5), } systemDefaultRailsConsoleResources defaultResourceRequirementsSpec = defaultResourceRequirementsSpec{ Requests: corev1.ResourceList{ @@ -239,6 +270,10 @@ type SystemSpec struct { // +operator-sdk:csv:customresourcedefinitions:type=spec // +optional Sphinx *SystemSphinxSpec `json:"sphinx,omitempty"` + // Searchd specific configuration options + // +operator-sdk:csv:customresourcedefinitions:type=spec + // +optional + Searchd *SystemSearchdSpec `json:"searchd,omitempty"` // Console specific configuration options // +operator-sdk:csv:customresourcedefinitions:type=spec // +optional @@ -279,6 +314,11 @@ func (spec *SystemSpec) Default() { } spec.SidekiqLow.Default(Low) + if spec.Searchd == nil { + spec.Searchd = &SystemSearchdSpec{} + } + spec.Searchd.Default() + if spec.Sphinx == nil { spec.Sphinx = &SystemSphinxSpec{} } @@ -313,6 +353,10 @@ type SystemConfig struct { // +operator-sdk:csv:customresourcedefinitions:type=spec // +optional SSLCertsDir *string `json:"sslCertsDir,omitempty"` + // Search service options + // +operator-sdk:csv:customresourcedefinitions:type=spec + // +optional + SearchServer AddressSpec `json:"searchServer,omitempty"` // 3scale provider plan // +operator-sdk:csv:customresourcedefinitions:type=spec // +optional @@ -395,19 +439,23 @@ func (sc *SystemConfig) Default() { } sc.Rails.Default() - sc.ConfigFilesSecret = stringOrDefault(sc.ConfigFilesSecret, pointer.StringPtr(systemDefaultConfigFilesSecret)) + sc.ConfigFilesSecret = stringOrDefault(sc.ConfigFilesSecret, pointer.String(systemDefaultConfigFilesSecret)) if sc.Bugsnag == nil { sc.Bugsnag = &systemDefaultBugsnagSpec } - sc.SandboxProxyOpensslVerifyMode = stringOrDefault(sc.SandboxProxyOpensslVerifyMode, pointer.StringPtr(systemDefaultSandboxProxyOpensslVerifyMode)) - sc.ForceSSL = boolOrDefault(sc.ForceSSL, pointer.BoolPtr(systemDefaultForceSSL)) - sc.SSLCertsDir = stringOrDefault(sc.SSLCertsDir, pointer.StringPtr(systemDefaultSSLCertsDir)) - sc.ThreescaleProviderPlan = stringOrDefault(sc.ThreescaleProviderPlan, pointer.StringPtr(systemDefaultThreescaleProviderPlan)) - sc.ThreescaleSuperdomain = stringOrDefault(sc.ThreescaleSuperdomain, pointer.StringPtr(systemDefaultThreescaleSuperdomain)) + sc.SandboxProxyOpensslVerifyMode = stringOrDefault(sc.SandboxProxyOpensslVerifyMode, pointer.String(systemDefaultSandboxProxyOpensslVerifyMode)) + sc.ForceSSL = boolOrDefault(sc.ForceSSL, pointer.Bool(systemDefaultForceSSL)) + sc.SSLCertsDir = stringOrDefault(sc.SSLCertsDir, pointer.String(systemDefaultSSLCertsDir)) + sc.ThreescaleProviderPlan = stringOrDefault(sc.ThreescaleProviderPlan, pointer.String(systemDefaultThreescaleProviderPlan)) + sc.ThreescaleSuperdomain = stringOrDefault(sc.ThreescaleSuperdomain, pointer.String(systemDefaultThreescaleSuperdomain)) 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) + } // ResolveCanarySpec modifies the SystemSpec given the provided canary configuration @@ -588,9 +636,9 @@ type SystemRailsSpec struct { // Default applies defaults for SystemRailsSpec func (srs *SystemRailsSpec) Default() { - srs.Console = boolOrDefault(srs.Console, pointer.BoolPtr(systemDefaultRailsConsole)) - srs.Environment = stringOrDefault(srs.Environment, pointer.StringPtr(systemDefaultRailsEnvironment)) - srs.LogLevel = stringOrDefault(srs.LogLevel, pointer.StringPtr(systemDefaultRailsLogLevel)) + srs.Console = boolOrDefault(srs.Console, pointer.Bool(systemDefaultRailsConsole)) + srs.Environment = stringOrDefault(srs.Environment, pointer.String(systemDefaultRailsEnvironment)) + srs.LogLevel = stringOrDefault(srs.LogLevel, pointer.String(systemDefaultRailsLogLevel)) } // SystemAppSpec configures the App component of System @@ -728,7 +776,7 @@ func (cfg *SidekiqConfig) Default(def defaultSidekiqConfig) { if cfg.Queues == nil { cfg.Queues = def.Queues } - cfg.MaxThreads = intOrDefault(cfg.MaxThreads, pointer.Int32Ptr(*def.MaxThreads)) + cfg.MaxThreads = intOrDefault(cfg.MaxThreads, pointer.Int32(*def.MaxThreads)) } // Default implements defaulting for the system Sidekiq component @@ -810,6 +858,10 @@ func (spec *SystemSphinxSpec) Default(systemDefaultImage *ImageSpec) { // SphinxConfig has configuration options for System's sphinx type SphinxConfig struct { + // Deploy Sphinx instance + // +operator-sdk:csv:customresourcedefinitions:type=spec + // +optional + Enabled *bool `json:"enabled,omitempty"` // Thinking configuration for sphinx // +operator-sdk:csv:customresourcedefinitions:type=spec // +optional @@ -818,6 +870,11 @@ type SphinxConfig struct { // Default implements defaulting for SphinxConfig func (sc *SphinxConfig) Default() { + + sc.Enabled = boolOrDefault( + sc.Enabled, pointer.Bool(systemDefaultSphinxEnabled), + ) + if sc.Thinking == nil { sc.Thinking = &ThinkingSpec{} } @@ -826,6 +883,10 @@ func (sc *SphinxConfig) Default() { // ThinkingSpec configures the thinking library for sphinx type ThinkingSpec struct { + // Allows setting the service name for Sphinx + // +operator-sdk:csv:customresourcedefinitions:type=spec + // +optional + ServiceName *string `json:"serviceName,omitempty"` // The TCP port Sphinx will run its daemon on // +operator-sdk:csv:customresourcedefinitions:type=spec // +optional @@ -862,18 +923,109 @@ type ThinkingSpec struct { // Default implements defaulting for ThinkingSpec 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)) + tc.ServiceName = stringOrDefault(tc.ServiceName, pointer.String(systemDefaultSphinxServiceName)) + tc.Port = intOrDefault(tc.Port, pointer.Int32(systemDefaultSphinxPort)) + tc.BindAddress = stringOrDefault(tc.BindAddress, pointer.String(systemDefaultSphinxBindAddress)) + tc.ConfigFile = stringOrDefault(tc.ConfigFile, pointer.String(systemDefaultSphinxConfigFile)) + tc.BatchSize = intOrDefault(tc.BatchSize, pointer.Int32(systemDefaultSphinxBatchSize)) + tc.DatabasePath = stringOrDefault(tc.DatabasePath, pointer.String(systemDefaultSphinxDBPath)) + tc.PIDFile = stringOrDefault(tc.PIDFile, pointer.String(systemDefaultSphinxPIDFile)) if tc.DatabaseStorageSize == nil { size := resource.MustParse(systemDefaultSphinxDatabaseStorageSize) tc.DatabaseStorageSize = &size } } +// SystemSearchdSpec configures the App component of System +type SystemSearchdSpec struct { + // Deploy searchd instance + // +operator-sdk:csv:customresourcedefinitions:type=spec + // +optional + Enabled *bool `json:"enabled,omitempty"` + // Image specification for the Searchd component. + // Defaults to system image if not defined. + // +operator-sdk:csv:customresourcedefinitions:type=spec + // +optional + Image *ImageSpec `json:"image,omitempty"` + // Configuration options for System's Searchd + // +operator-sdk:csv:customresourcedefinitions:type=spec + // +optional + Config *SearchdConfig `json:"config,omitempty"` + // Resource requirements for the Searchd component + // +operator-sdk:csv:customresourcedefinitions:type=spec + // +optional + Resources *ResourceRequirementsSpec `json:"resources,omitempty"` + // Liveness probe for the Searchd component + // +operator-sdk:csv:customresourcedefinitions:type=spec + // +optional + LivenessProbe *ProbeSpec `json:"livenessProbe,omitempty"` + // Readiness probe for the Searchd component + // +operator-sdk:csv:customresourcedefinitions:type=spec + // +optional + ReadinessProbe *ProbeSpec `json:"readinessProbe,omitempty"` + // Describes node affinity scheduling rules for the Searchd pod + // +optional + NodeAffinity *corev1.NodeAffinity `json:"nodeAffinity,omitempty" protobuf:"bytes,1,opt,name=nodeAffinity"` + // If specified, the Searchd pod's tolerations. + // +optional + Tolerations []corev1.Toleration `json:"tolerations,omitempty" protobuf:"bytes,22,opt,name=tolerations"` + // Configures the TerminationGracePeriodSeconds for Searchd + // +operator-sdk:csv:customresourcedefinitions:type=spec + // +optional + TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"` +} + +// Default implements defaulting for the system sphinx component +func (spec *SystemSearchdSpec) Default() { + spec.Enabled = boolOrDefault(spec.Enabled, pointer.Bool(systemDefaultSearchdEnabled)) + spec.Image = InitializeImageSpec(spec.Image, defaultImageSpec(systemDefaultSearchdImage)) + spec.Resources = InitializeResourceRequirementsSpec(spec.Resources, systemDefaultSearchdResources) + spec.LivenessProbe = InitializeProbeSpec(spec.LivenessProbe, systemDefaultSearchdLivenessProbe) + spec.ReadinessProbe = InitializeProbeSpec(spec.ReadinessProbe, systemDefaultSearchdReadinessProbe) + if spec.Config == nil { + spec.Config = &SearchdConfig{} + } + spec.Config.Default() + spec.TerminationGracePeriodSeconds = int64OrDefault( + spec.TerminationGracePeriodSeconds, systemDefaultTerminationGracePeriodSeconds, + ) +} + +// SearchdConfig has configuration options for System's sphinx +type SearchdConfig struct { + // Allows setting the service name for Searchd + // +operator-sdk:csv:customresourcedefinitions:type=spec + // +optional + ServiceName *string `json:"serviceName,omitempty"` + // The TCP port Searchd will run its daemon on + // +operator-sdk:csv:customresourcedefinitions:type=spec + // +optional + Port *int32 `json:"port,omitempty"` + // Searchd database path + // +operator-sdk:csv:customresourcedefinitions:type=spec + // +optional + DatabasePath *string `json:"databasePath,omitempty"` + // Searchd database storage size + // +operator-sdk:csv:customresourcedefinitions:type=spec + // +optional + DatabaseStorageSize *resource.Quantity `json:"databaseStorageSize,omitempty"` + // Searchd database storage type + // +operator-sdk:csv:customresourcedefinitions:type=spec + // +optional + DatabaseStorageClass *string `json:"databaseStorageClass,omitempty"` +} + +// Default implements defaulting for SearchdConfig +func (sc *SearchdConfig) Default() { + sc.ServiceName = stringOrDefault(sc.ServiceName, pointer.String(systemDefaultSearchdServiceName)) + sc.Port = intOrDefault(sc.Port, pointer.Int32(systemDefaultSearchdPort)) + sc.DatabasePath = stringOrDefault(sc.DatabasePath, pointer.String(systemDefaultSearchdDBPath)) + if sc.DatabaseStorageSize == nil { + size := resource.MustParse(systemDefaultSearchdDatabaseStorageSize) + sc.DatabaseStorageSize = &size + } +} + // SystemRailsConsoleSpec configures the App component of System type SystemRailsConsoleSpec struct { // Image specification for the Console component. diff --git a/api/v1alpha1/twemproxy_types.go b/api/v1alpha1/twemproxy_types.go index fa47da5b..0a39779a 100644 --- a/api/v1alpha1/twemproxy_types.go +++ b/api/v1alpha1/twemproxy_types.go @@ -11,25 +11,25 @@ import ( var ( // Twemproxy defaults defaultTwemproxyLivenessProbe defaultProbeSpec = defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(0), - TimeoutSeconds: pointer.Int32Ptr(1), - PeriodSeconds: pointer.Int32Ptr(5), - SuccessThreshold: pointer.Int32Ptr(1), - FailureThreshold: pointer.Int32Ptr(3), + InitialDelaySeconds: pointer.Int32(0), + TimeoutSeconds: pointer.Int32(1), + PeriodSeconds: pointer.Int32(5), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(3), } defaultTwemproxyReadinessProbe defaultProbeSpec = defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(0), - TimeoutSeconds: pointer.Int32Ptr(1), - PeriodSeconds: pointer.Int32Ptr(5), - SuccessThreshold: pointer.Int32Ptr(1), - FailureThreshold: pointer.Int32Ptr(3), + InitialDelaySeconds: pointer.Int32(0), + TimeoutSeconds: pointer.Int32(1), + PeriodSeconds: pointer.Int32(5), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(3), } // TODO: add requirements defaultTwemproxyResources defaultResourceRequirementsSpec = defaultResourceRequirementsSpec{} defaultTwemproxyImage defaultImageSpec = defaultImageSpec{ - Name: pointer.StringPtr("quay.io/3scale/twemproxy"), - Tag: pointer.StringPtr("v0.5.0"), - PullPolicy: (*corev1.PullPolicy)(pointer.StringPtr(string(corev1.PullIfNotPresent))), + Name: pointer.String("quay.io/3scale/twemproxy"), + Tag: pointer.String("v0.5.0"), + PullPolicy: (*corev1.PullPolicy)(pointer.String(string(corev1.PullIfNotPresent))), } twemproxyDefaultLogLevel int32 = 6 twemproxyDefaultMetricsPort int32 = 9151 diff --git a/api/v1alpha1/twemproxyconfig_types.go b/api/v1alpha1/twemproxyconfig_types.go index 8028c5b3..960fc9e6 100644 --- a/api/v1alpha1/twemproxyconfig_types.go +++ b/api/v1alpha1/twemproxyconfig_types.go @@ -30,8 +30,8 @@ var ( TwemproxySyncAnnotationKey string = fmt.Sprintf("%s/twemproxyconfig.configmap-hash", GroupVersion.Group) twemproxyDefaultGrafanaDashboard defaultGrafanaDashboardSpec = defaultGrafanaDashboardSpec{ - SelectorKey: pointer.StringPtr("monitoring-key"), - SelectorValue: pointer.StringPtr("middleware"), + SelectorKey: pointer.String("monitoring-key"), + SelectorValue: pointer.String("middleware"), } ) diff --git a/api/v1alpha1/zync_types.go b/api/v1alpha1/zync_types.go index 3c56f271..f8f23794 100644 --- a/api/v1alpha1/zync_types.go +++ b/api/v1alpha1/zync_types.go @@ -27,23 +27,23 @@ import ( var ( zyncDefaultImage defaultImageSpec = defaultImageSpec{ - Name: pointer.StringPtr("quay.io/3scale/zync"), - Tag: pointer.StringPtr("nightly"), - PullPolicy: (*corev1.PullPolicy)(pointer.StringPtr(string(corev1.PullIfNotPresent))), + Name: pointer.String("quay.io/3scale/zync"), + Tag: pointer.String("nightly"), + PullPolicy: (*corev1.PullPolicy)(pointer.String(string(corev1.PullIfNotPresent))), } zyncDefaultGrafanaDashboard defaultGrafanaDashboardSpec = defaultGrafanaDashboardSpec{ - SelectorKey: pointer.StringPtr("monitoring-key"), - SelectorValue: pointer.StringPtr("middleware"), + SelectorKey: pointer.String("monitoring-key"), + SelectorValue: pointer.String("middleware"), } zyncDefaultConfigRailsEnvironment string = "development" zyncDefaultConfigRailsLogLevel string = "info" zyncDefaultConfigRailsMaxThreads int32 = 10 zyncDefaultConfigBugsnagSpec BugsnagSpec = BugsnagSpec{} zyncDefaultAPIHPA defaultHorizontalPodAutoscalerSpec = defaultHorizontalPodAutoscalerSpec{ - MinReplicas: pointer.Int32Ptr(2), - MaxReplicas: pointer.Int32Ptr(4), - ResourceUtilization: pointer.Int32Ptr(90), - ResourceName: pointer.StringPtr("cpu"), + MinReplicas: pointer.Int32(2), + MaxReplicas: pointer.Int32(4), + ResourceUtilization: pointer.Int32(90), + ResourceName: pointer.String("cpu"), } zyncDefaultAPIPDB defaultPodDisruptionBudgetSpec = defaultPodDisruptionBudgetSpec{ MaxUnavailable: util.IntStrPtr(intstr.FromInt(1)), @@ -60,24 +60,24 @@ var ( }, } zyncDefaultAPILivenessProbe defaultProbeSpec = defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(10), - TimeoutSeconds: pointer.Int32Ptr(30), - PeriodSeconds: pointer.Int32Ptr(10), - SuccessThreshold: pointer.Int32Ptr(1), - FailureThreshold: pointer.Int32Ptr(3), + InitialDelaySeconds: pointer.Int32(10), + TimeoutSeconds: pointer.Int32(30), + PeriodSeconds: pointer.Int32(10), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(3), } zyncDefaultAPIReadinessProbe defaultProbeSpec = defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(30), - TimeoutSeconds: pointer.Int32Ptr(10), - PeriodSeconds: pointer.Int32Ptr(10), - SuccessThreshold: pointer.Int32Ptr(1), - FailureThreshold: pointer.Int32Ptr(3), + InitialDelaySeconds: pointer.Int32(30), + TimeoutSeconds: pointer.Int32(10), + PeriodSeconds: pointer.Int32(10), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(3), } zyncDefaultQueHPA defaultHorizontalPodAutoscalerSpec = defaultHorizontalPodAutoscalerSpec{ - MinReplicas: pointer.Int32Ptr(2), - MaxReplicas: pointer.Int32Ptr(4), - ResourceUtilization: pointer.Int32Ptr(90), - ResourceName: pointer.StringPtr("cpu"), + MinReplicas: pointer.Int32(2), + MaxReplicas: pointer.Int32(4), + ResourceUtilization: pointer.Int32(90), + ResourceName: pointer.String("cpu"), } zyncDefaultQuePDB defaultPodDisruptionBudgetSpec = defaultPodDisruptionBudgetSpec{ MaxUnavailable: util.IntStrPtr(intstr.FromInt(1)), @@ -94,18 +94,18 @@ var ( }, } zyncDefaultQueLivenessProbe defaultProbeSpec = defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(10), - TimeoutSeconds: pointer.Int32Ptr(30), - PeriodSeconds: pointer.Int32Ptr(10), - SuccessThreshold: pointer.Int32Ptr(1), - FailureThreshold: pointer.Int32Ptr(3), + InitialDelaySeconds: pointer.Int32(10), + TimeoutSeconds: pointer.Int32(30), + PeriodSeconds: pointer.Int32(10), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(3), } zyncDefaultQueReadinessProbe defaultProbeSpec = defaultProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(30), - TimeoutSeconds: pointer.Int32Ptr(10), - PeriodSeconds: pointer.Int32Ptr(10), - SuccessThreshold: pointer.Int32Ptr(1), - FailureThreshold: pointer.Int32Ptr(3), + InitialDelaySeconds: pointer.Int32(30), + TimeoutSeconds: pointer.Int32(10), + PeriodSeconds: pointer.Int32(10), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(3), } ) @@ -295,9 +295,9 @@ type ZyncRailsSpec struct { // Default applies defaults for ZyncRailsSpec func (zrs *ZyncRailsSpec) Default() { - zrs.Environment = stringOrDefault(zrs.Environment, pointer.StringPtr(zyncDefaultConfigRailsEnvironment)) - zrs.LogLevel = stringOrDefault(zrs.LogLevel, pointer.StringPtr(zyncDefaultConfigRailsLogLevel)) - zrs.MaxThreads = intOrDefault(zrs.MaxThreads, pointer.Int32Ptr(zyncDefaultConfigRailsMaxThreads)) + zrs.Environment = stringOrDefault(zrs.Environment, pointer.String(zyncDefaultConfigRailsEnvironment)) + zrs.LogLevel = stringOrDefault(zrs.LogLevel, pointer.String(zyncDefaultConfigRailsLogLevel)) + zrs.MaxThreads = intOrDefault(zrs.MaxThreads, pointer.Int32(zyncDefaultConfigRailsMaxThreads)) } // ZyncStatus defines the observed state of Zync diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 49ce5eaf..0711589d 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -88,6 +88,31 @@ func (in *APISpec) DeepCopy() *APISpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AddressSpec) DeepCopyInto(out *AddressSpec) { + *out = *in + if in.Host != nil { + in, out := &in.Host, &out.Host + *out = new(string) + **out = **in + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddressSpec. +func (in *AddressSpec) DeepCopy() *AddressSpec { + if in == nil { + return nil + } + out := new(AddressSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Apicast) DeepCopyInto(out *Apicast) { *out = *in @@ -2340,6 +2365,46 @@ 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 *SearchdConfig) DeepCopyInto(out *SearchdConfig) { + *out = *in + if in.ServiceName != nil { + in, out := &in.ServiceName, &out.ServiceName + *out = new(string) + **out = **in + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(int32) + **out = **in + } + if in.DatabasePath != nil { + in, out := &in.DatabasePath, &out.DatabasePath + *out = new(string) + **out = **in + } + if in.DatabaseStorageSize != nil { + in, out := &in.DatabaseStorageSize, &out.DatabaseStorageSize + x := (*in).DeepCopy() + *out = &x + } + if in.DatabaseStorageClass != nil { + in, out := &in.DatabaseStorageClass, &out.DatabaseStorageClass + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SearchdConfig. +func (in *SearchdConfig) DeepCopy() *SearchdConfig { + if in == nil { + return nil + } + out := new(SearchdConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SecretReference) DeepCopyInto(out *SecretReference) { *out = *in @@ -2638,6 +2703,11 @@ func (in *SidekiqConfig) DeepCopy() *SidekiqConfig { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SphinxConfig) DeepCopyInto(out *SphinxConfig) { *out = *in + if in.Enabled != nil { + in, out := &in.Enabled, &out.Enabled + *out = new(bool) + **out = **in + } if in.Thinking != nil { in, out := &in.Thinking, &out.Thinking *out = new(ThinkingSpec) @@ -2794,6 +2864,7 @@ func (in *SystemConfig) DeepCopyInto(out *SystemConfig) { *out = new(string) **out = **in } + in.SearchServer.DeepCopyInto(&out.SearchServer) if in.ThreescaleProviderPlan != nil { in, out := &in.ThreescaleProviderPlan, &out.ThreescaleProviderPlan *out = new(string) @@ -2971,6 +3042,68 @@ func (in *SystemRecaptchaSpec) DeepCopy() *SystemRecaptchaSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SystemSearchdSpec) DeepCopyInto(out *SystemSearchdSpec) { + *out = *in + if in.Enabled != nil { + in, out := &in.Enabled, &out.Enabled + *out = new(bool) + **out = **in + } + if in.Image != nil { + in, out := &in.Image, &out.Image + *out = new(ImageSpec) + (*in).DeepCopyInto(*out) + } + if in.Config != nil { + in, out := &in.Config, &out.Config + *out = new(SearchdConfig) + (*in).DeepCopyInto(*out) + } + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = new(ResourceRequirementsSpec) + (*in).DeepCopyInto(*out) + } + if in.LivenessProbe != nil { + in, out := &in.LivenessProbe, &out.LivenessProbe + *out = new(ProbeSpec) + (*in).DeepCopyInto(*out) + } + if in.ReadinessProbe != nil { + in, out := &in.ReadinessProbe, &out.ReadinessProbe + *out = new(ProbeSpec) + (*in).DeepCopyInto(*out) + } + if in.NodeAffinity != nil { + in, out := &in.NodeAffinity, &out.NodeAffinity + *out = new(v1.NodeAffinity) + (*in).DeepCopyInto(*out) + } + if in.Tolerations != nil { + in, out := &in.Tolerations, &out.Tolerations + *out = make([]v1.Toleration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.TerminationGracePeriodSeconds != nil { + in, out := &in.TerminationGracePeriodSeconds, &out.TerminationGracePeriodSeconds + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SystemSearchdSpec. +func (in *SystemSearchdSpec) DeepCopy() *SystemSearchdSpec { + if in == nil { + return nil + } + out := new(SystemSearchdSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SystemSidekiqSpec) DeepCopyInto(out *SystemSidekiqSpec) { *out = *in @@ -3082,6 +3215,11 @@ func (in *SystemSpec) DeepCopyInto(out *SystemSpec) { *out = new(SystemSphinxSpec) (*in).DeepCopyInto(*out) } + if in.Searchd != nil { + in, out := &in.Searchd, &out.Searchd + *out = new(SystemSearchdSpec) + (*in).DeepCopyInto(*out) + } if in.Console != nil { in, out := &in.Console, &out.Console *out = new(SystemRailsConsoleSpec) @@ -3200,6 +3338,11 @@ func (in *SystemZyncSpec) DeepCopy() *SystemZyncSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ThinkingSpec) DeepCopyInto(out *ThinkingSpec) { *out = *in + if in.ServiceName != nil { + in, out := &in.ServiceName, &out.ServiceName + *out = new(string) + **out = **in + } if in.Port != nil { in, out := &in.Port, &out.Port *out = new(int32) diff --git a/bundle/manifests/saas-operator.clusterserviceversion.yaml b/bundle/manifests/saas-operator.clusterserviceversion.yaml index 48a3eda2..6bb96afa 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-04-28T10:01:10Z" + createdAt: "2023-05-09T08:16:49Z" 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.6 + name: saas-operator.v0.19.7 namespace: placeholder spec: apiservicedefinitions: {} @@ -3093,6 +3093,15 @@ spec: - description: OpenSSL verification mode for sandbox proxy displayName: Sandbox Proxy Openssl Verify Mode path: config.sandboxProxyOpensslVerifyMode + - description: Search service options + displayName: Search Server + path: config.searchServer + - description: Defines the address host + displayName: Host + path: config.searchServer.host + - description: Defines the address port + displayName: Port + path: config.searchServer.port - description: SecretKeyBase displayName: Secret Key Base path: config.secretKeyBase @@ -3305,6 +3314,105 @@ spec: - description: Image tag displayName: Tag path: image.tag + - description: Searchd specific configuration options + displayName: Searchd + path: searchd + - description: Configuration options for System's Searchd + displayName: Config + path: searchd.config + - description: Searchd database path + displayName: Database Path + path: searchd.config.databasePath + - description: Searchd database storage type + displayName: Database Storage Class + path: searchd.config.databaseStorageClass + - description: Searchd database storage size + displayName: Database Storage Size + path: searchd.config.databaseStorageSize + - description: The TCP port Searchd will run its daemon on + displayName: Port + path: searchd.config.port + - description: Allows setting the service name for Searchd + displayName: Service Name + path: searchd.config.serviceName + - description: Deploy searchd instance + displayName: Enabled + path: searchd.enabled + - description: Image specification for the Searchd component. Defaults to system + image if not defined. + displayName: Image + path: searchd.image + - description: Docker repository of the image + displayName: Name + path: searchd.image.name + - description: Pull policy for the image + displayName: Pull Policy + path: searchd.image.pullPolicy + - description: Name of the Secret that holds quay.io credentials to access the + image repository + displayName: Pull Secret Name + path: searchd.image.pullSecretName + - description: Image tag + displayName: Tag + path: searchd.image.tag + - description: Liveness probe for the Searchd component + displayName: Liveness Probe + path: searchd.livenessProbe + - description: Minimum consecutive failures for the probe to be considered failed + after having succeeded + displayName: Failure Threshold + path: searchd.livenessProbe.failureThreshold + - description: Number of seconds after the container has started before liveness + probes are initiated + displayName: Initial Delay Seconds + path: searchd.livenessProbe.initialDelaySeconds + - description: How often (in seconds) to perform the probe + displayName: Period Seconds + path: searchd.livenessProbe.periodSeconds + - description: Minimum consecutive successes for the probe to be considered + successful after having failed + displayName: Success Threshold + path: searchd.livenessProbe.successThreshold + - description: Number of seconds after which the probe times out + displayName: Timeout Seconds + path: searchd.livenessProbe.timeoutSeconds + - description: Readiness probe for the Searchd component + displayName: Readiness Probe + path: searchd.readinessProbe + - description: Minimum consecutive failures for the probe to be considered failed + after having succeeded + displayName: Failure Threshold + path: searchd.readinessProbe.failureThreshold + - description: Number of seconds after the container has started before liveness + probes are initiated + displayName: Initial Delay Seconds + path: searchd.readinessProbe.initialDelaySeconds + - description: How often (in seconds) to perform the probe + displayName: Period Seconds + path: searchd.readinessProbe.periodSeconds + - description: Minimum consecutive successes for the probe to be considered + successful after having failed + displayName: Success Threshold + path: searchd.readinessProbe.successThreshold + - description: Number of seconds after which the probe times out + displayName: Timeout Seconds + path: searchd.readinessProbe.timeoutSeconds + - description: Resource requirements for the Searchd component + displayName: Resources + path: searchd.resources + - description: 'Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' + displayName: Limits + path: searchd.resources.limits + - description: 'Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is + explicitly specified, otherwise to an implementation-defined value. More + info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' + displayName: Requests + path: searchd.resources.requests + - description: Configures the TerminationGracePeriodSeconds for Searchd + displayName: Termination Grace Period Seconds + path: searchd.terminationGracePeriodSeconds - description: Sidekiq Billing specific configuration options displayName: Sidekiq Billing path: sidekiqBilling @@ -3698,6 +3806,9 @@ spec: - description: Configuration options for System's sphinx displayName: Config path: sphinx.config + - description: Deploy Sphinx instance + displayName: Enabled + path: sphinx.config.enabled - description: Thinking configuration for sphinx displayName: Thinking path: sphinx.config.thinking @@ -3725,6 +3836,9 @@ spec: - description: The TCP port Sphinx will run its daemon on displayName: Port path: sphinx.config.thinking.port + - description: Allows setting the service name for Sphinx + displayName: Service Name + path: sphinx.config.thinking.serviceName - description: Image specification for the Sphinx component. Defaults to system image if not defined. displayName: Image @@ -4339,7 +4453,7 @@ spec: valueFrom: fieldRef: fieldPath: metadata.annotations['olm.targetNamespaces'] - image: quay.io/3scale/saas-operator:v0.19.6 + image: quay.io/3scale/saas-operator:v0.19.7 livenessProbe: httpGet: path: /healthz @@ -4853,4 +4967,4 @@ spec: provider: name: Red Hat url: https://www.3scale.net/ - version: 0.19.6 + version: 0.19.7 diff --git a/bundle/manifests/saas.3scale.net_systems.yaml b/bundle/manifests/saas.3scale.net_systems.yaml index 56d45374..cbfc7d2c 100644 --- a/bundle/manifests/saas.3scale.net_systems.yaml +++ b/bundle/manifests/saas.3scale.net_systems.yaml @@ -1139,6 +1139,17 @@ spec: sandboxProxyOpensslVerifyMode: description: OpenSSL verification mode for sandbox proxy type: string + searchServer: + description: Search service options + properties: + host: + description: Defines the address host + type: string + port: + description: Defines the address port + format: int32 + type: integer + type: object secretKeyBase: description: SecretKeyBase properties: @@ -1716,6 +1727,411 @@ spec: description: Image tag type: string type: object + searchd: + description: Searchd specific configuration options + properties: + config: + description: Configuration options for System's Searchd + properties: + databasePath: + description: Searchd database path + type: string + databaseStorageClass: + description: Searchd database storage type + type: string + databaseStorageSize: + anyOf: + - type: integer + - type: string + description: Searchd database storage size + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + port: + description: The TCP port Searchd will run its daemon on + format: int32 + type: integer + serviceName: + description: Allows setting the service name for Searchd + type: string + type: object + enabled: + description: Deploy searchd instance + type: boolean + image: + description: Image specification for the Searchd component. Defaults + to system image if not defined. + properties: + name: + description: Docker repository of the image + type: string + pullPolicy: + description: Pull policy for the image + type: string + pullSecretName: + description: Name of the Secret that holds quay.io credentials + to access the image repository + type: string + tag: + description: Image tag + type: string + type: object + livenessProbe: + description: Liveness probe for the Searchd component + properties: + failureThreshold: + description: Minimum consecutive failures for the probe to + be considered failed after having succeeded + format: int32 + type: integer + initialDelaySeconds: + description: Number of seconds after the container has started + before liveness probes are initiated + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the probe + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the probe to + be considered successful after having failed + format: int32 + type: integer + timeoutSeconds: + description: Number of seconds after which the probe times + out + format: int32 + type: integer + type: object + nodeAffinity: + description: Describes node affinity scheduling rules for the + Searchd pod + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: The scheduler will prefer to schedule pods to + nodes that satisfy the affinity expressions specified by + this field, but it may choose a node that violates one or + more of the expressions. The node that is most preferred + is the one with the greatest sum of weights, i.e. for each + node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, + etc.), compute a sum by iterating through the elements of + this field and adding "weight" to the sum if the node matches + the corresponding matchExpressions; the node(s) with the + highest sum are the most preferred. + items: + description: An empty preferred scheduling term matches + all objects with implicit weight 0 (i.e. it's a no-op). + A null preferred scheduling term matches no objects (i.e. + is also a no-op). + properties: + preference: + description: A node selector term, associated with the + corresponding weight. + properties: + matchExpressions: + description: A list of node selector requirements + by node's labels. + items: + description: A node selector requirement is a + selector that contains values, a key, and an + operator that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: Represents a key's relationship + to a set of values. Valid operators are + In, NotIn, Exists, DoesNotExist. Gt, and + Lt. + type: string + values: + description: An array of string values. If + the operator is In or NotIn, the values + array must be non-empty. If the operator + is Exists or DoesNotExist, the values array + must be empty. If the operator is Gt or + Lt, the values array must have a single + element, which will be interpreted as an + integer. This array is replaced during a + strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchFields: + description: A list of node selector requirements + by node's fields. + items: + description: A node selector requirement is a + selector that contains values, a key, and an + operator that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: Represents a key's relationship + to a set of values. Valid operators are + In, NotIn, Exists, DoesNotExist. Gt, and + Lt. + type: string + values: + description: An array of string values. If + the operator is In or NotIn, the values + array must be non-empty. If the operator + is Exists or DoesNotExist, the values array + must be empty. If the operator is Gt or + Lt, the values array must have a single + element, which will be interpreted as an + integer. This array is replaced during a + strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + x-kubernetes-map-type: atomic + weight: + description: Weight associated with matching the corresponding + nodeSelectorTerm, in the range 1-100. + format: int32 + type: integer + required: + - preference + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + description: If the affinity requirements specified by this + field are not met at scheduling time, the pod will not be + scheduled onto the node. If the affinity requirements specified + by this field cease to be met at some point during pod execution + (e.g. due to an update), the system may or may not try to + eventually evict the pod from its node. + properties: + nodeSelectorTerms: + description: Required. A list of node selector terms. + The terms are ORed. + items: + description: A null or empty node selector term matches + no objects. The requirements of them are ANDed. The + TopologySelectorTerm type implements a subset of the + NodeSelectorTerm. + properties: + matchExpressions: + description: A list of node selector requirements + by node's labels. + items: + description: A node selector requirement is a + selector that contains values, a key, and an + operator that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: Represents a key's relationship + to a set of values. Valid operators are + In, NotIn, Exists, DoesNotExist. Gt, and + Lt. + type: string + values: + description: An array of string values. If + the operator is In or NotIn, the values + array must be non-empty. If the operator + is Exists or DoesNotExist, the values array + must be empty. If the operator is Gt or + Lt, the values array must have a single + element, which will be interpreted as an + integer. This array is replaced during a + strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchFields: + description: A list of node selector requirements + by node's fields. + items: + description: A node selector requirement is a + selector that contains values, a key, and an + operator that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: Represents a key's relationship + to a set of values. Valid operators are + In, NotIn, Exists, DoesNotExist. Gt, and + Lt. + type: string + values: + description: An array of string values. If + the operator is In or NotIn, the values + array must be non-empty. If the operator + is Exists or DoesNotExist, the values array + must be empty. If the operator is Gt or + Lt, the values array must have a single + element, which will be interpreted as an + integer. This array is replaced during a + strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + x-kubernetes-map-type: atomic + type: array + required: + - nodeSelectorTerms + type: object + x-kubernetes-map-type: atomic + type: object + readinessProbe: + description: Readiness probe for the Searchd component + properties: + failureThreshold: + description: Minimum consecutive failures for the probe to + be considered failed after having succeeded + format: int32 + type: integer + initialDelaySeconds: + description: Number of seconds after the container has started + before liveness probes are initiated + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the probe + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the probe to + be considered successful after having failed + format: int32 + type: integer + timeoutSeconds: + description: Number of seconds after which the probe times + out + format: int32 + type: integer + type: object + resources: + description: Resource requirements for the Searchd component + properties: + claims: + description: "Claims lists the names of resources, defined + in spec.resourceClaims, that are used by this container. + \n This is an alpha field and requires enabling the DynamicResourceAllocation + feature gate. \n This field is immutable." + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the name of one entry in + pod.spec.resourceClaims of the Pod where this field + is used. It makes that resource available inside a + container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute + resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of compute + resources required. If Requests is omitted for a container, + it defaults to Limits if that is explicitly specified, otherwise + to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' + type: object + type: object + terminationGracePeriodSeconds: + description: Configures the TerminationGracePeriodSeconds for + Searchd + format: int64 + type: integer + tolerations: + description: If specified, the Searchd pod's tolerations. + items: + description: The pod this Toleration is attached to tolerates + any taint that matches the triple using + the matching operator . + properties: + effect: + description: Effect indicates the taint effect to match. + Empty means match all taint effects. When specified, allowed + values are NoSchedule, PreferNoSchedule and NoExecute. + type: string + key: + description: Key is the taint key that the toleration applies + to. Empty means match all taint keys. If the key is empty, + operator must be Exists; this combination means to match + all values and all keys. + type: string + operator: + description: Operator represents a key's relationship to + the value. Valid operators are Exists and Equal. Defaults + to Equal. Exists is equivalent to wildcard for value, + so that a pod can tolerate all taints of a particular + category. + type: string + tolerationSeconds: + description: TolerationSeconds represents the period of + time the toleration (which must be of effect NoExecute, + otherwise this field is ignored) tolerates the taint. + By default, it is not set, which means tolerate the taint + forever (do not evict). Zero and negative values will + be treated as 0 (evict immediately) by the system. + format: int64 + type: integer + value: + description: Value is the taint value the toleration matches + to. If the operator is Exists, the value should be empty, + otherwise just a regular string. + type: string + type: object + type: array + type: object sidekiqBilling: description: Sidekiq Billing specific configuration options properties: @@ -3612,6 +4028,9 @@ spec: config: description: Configuration options for System's sphinx properties: + enabled: + description: Deploy Sphinx instance + type: boolean thinking: description: Thinking configuration for sphinx properties: @@ -3646,6 +4065,9 @@ spec: description: The TCP port Sphinx will run its daemon on format: int32 type: integer + serviceName: + description: Allows setting the service name for Sphinx + type: string type: object type: object image: diff --git a/config/crd/bases/saas.3scale.net_systems.yaml b/config/crd/bases/saas.3scale.net_systems.yaml index 122ac4fc..c1137f82 100644 --- a/config/crd/bases/saas.3scale.net_systems.yaml +++ b/config/crd/bases/saas.3scale.net_systems.yaml @@ -1140,6 +1140,17 @@ spec: sandboxProxyOpensslVerifyMode: description: OpenSSL verification mode for sandbox proxy type: string + searchServer: + description: Search service options + properties: + host: + description: Defines the address host + type: string + port: + description: Defines the address port + format: int32 + type: integer + type: object secretKeyBase: description: SecretKeyBase properties: @@ -1717,6 +1728,411 @@ spec: description: Image tag type: string type: object + searchd: + description: Searchd specific configuration options + properties: + config: + description: Configuration options for System's Searchd + properties: + databasePath: + description: Searchd database path + type: string + databaseStorageClass: + description: Searchd database storage type + type: string + databaseStorageSize: + anyOf: + - type: integer + - type: string + description: Searchd database storage size + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + port: + description: The TCP port Searchd will run its daemon on + format: int32 + type: integer + serviceName: + description: Allows setting the service name for Searchd + type: string + type: object + enabled: + description: Deploy searchd instance + type: boolean + image: + description: Image specification for the Searchd component. Defaults + to system image if not defined. + properties: + name: + description: Docker repository of the image + type: string + pullPolicy: + description: Pull policy for the image + type: string + pullSecretName: + description: Name of the Secret that holds quay.io credentials + to access the image repository + type: string + tag: + description: Image tag + type: string + type: object + livenessProbe: + description: Liveness probe for the Searchd component + properties: + failureThreshold: + description: Minimum consecutive failures for the probe to + be considered failed after having succeeded + format: int32 + type: integer + initialDelaySeconds: + description: Number of seconds after the container has started + before liveness probes are initiated + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the probe + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the probe to + be considered successful after having failed + format: int32 + type: integer + timeoutSeconds: + description: Number of seconds after which the probe times + out + format: int32 + type: integer + type: object + nodeAffinity: + description: Describes node affinity scheduling rules for the + Searchd pod + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: The scheduler will prefer to schedule pods to + nodes that satisfy the affinity expressions specified by + this field, but it may choose a node that violates one or + more of the expressions. The node that is most preferred + is the one with the greatest sum of weights, i.e. for each + node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, + etc.), compute a sum by iterating through the elements of + this field and adding "weight" to the sum if the node matches + the corresponding matchExpressions; the node(s) with the + highest sum are the most preferred. + items: + description: An empty preferred scheduling term matches + all objects with implicit weight 0 (i.e. it's a no-op). + A null preferred scheduling term matches no objects (i.e. + is also a no-op). + properties: + preference: + description: A node selector term, associated with the + corresponding weight. + properties: + matchExpressions: + description: A list of node selector requirements + by node's labels. + items: + description: A node selector requirement is a + selector that contains values, a key, and an + operator that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: Represents a key's relationship + to a set of values. Valid operators are + In, NotIn, Exists, DoesNotExist. Gt, and + Lt. + type: string + values: + description: An array of string values. If + the operator is In or NotIn, the values + array must be non-empty. If the operator + is Exists or DoesNotExist, the values array + must be empty. If the operator is Gt or + Lt, the values array must have a single + element, which will be interpreted as an + integer. This array is replaced during a + strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchFields: + description: A list of node selector requirements + by node's fields. + items: + description: A node selector requirement is a + selector that contains values, a key, and an + operator that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: Represents a key's relationship + to a set of values. Valid operators are + In, NotIn, Exists, DoesNotExist. Gt, and + Lt. + type: string + values: + description: An array of string values. If + the operator is In or NotIn, the values + array must be non-empty. If the operator + is Exists or DoesNotExist, the values array + must be empty. If the operator is Gt or + Lt, the values array must have a single + element, which will be interpreted as an + integer. This array is replaced during a + strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + x-kubernetes-map-type: atomic + weight: + description: Weight associated with matching the corresponding + nodeSelectorTerm, in the range 1-100. + format: int32 + type: integer + required: + - preference + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + description: If the affinity requirements specified by this + field are not met at scheduling time, the pod will not be + scheduled onto the node. If the affinity requirements specified + by this field cease to be met at some point during pod execution + (e.g. due to an update), the system may or may not try to + eventually evict the pod from its node. + properties: + nodeSelectorTerms: + description: Required. A list of node selector terms. + The terms are ORed. + items: + description: A null or empty node selector term matches + no objects. The requirements of them are ANDed. The + TopologySelectorTerm type implements a subset of the + NodeSelectorTerm. + properties: + matchExpressions: + description: A list of node selector requirements + by node's labels. + items: + description: A node selector requirement is a + selector that contains values, a key, and an + operator that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: Represents a key's relationship + to a set of values. Valid operators are + In, NotIn, Exists, DoesNotExist. Gt, and + Lt. + type: string + values: + description: An array of string values. If + the operator is In or NotIn, the values + array must be non-empty. If the operator + is Exists or DoesNotExist, the values array + must be empty. If the operator is Gt or + Lt, the values array must have a single + element, which will be interpreted as an + integer. This array is replaced during a + strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchFields: + description: A list of node selector requirements + by node's fields. + items: + description: A node selector requirement is a + selector that contains values, a key, and an + operator that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: Represents a key's relationship + to a set of values. Valid operators are + In, NotIn, Exists, DoesNotExist. Gt, and + Lt. + type: string + values: + description: An array of string values. If + the operator is In or NotIn, the values + array must be non-empty. If the operator + is Exists or DoesNotExist, the values array + must be empty. If the operator is Gt or + Lt, the values array must have a single + element, which will be interpreted as an + integer. This array is replaced during a + strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + x-kubernetes-map-type: atomic + type: array + required: + - nodeSelectorTerms + type: object + x-kubernetes-map-type: atomic + type: object + readinessProbe: + description: Readiness probe for the Searchd component + properties: + failureThreshold: + description: Minimum consecutive failures for the probe to + be considered failed after having succeeded + format: int32 + type: integer + initialDelaySeconds: + description: Number of seconds after the container has started + before liveness probes are initiated + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the probe + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the probe to + be considered successful after having failed + format: int32 + type: integer + timeoutSeconds: + description: Number of seconds after which the probe times + out + format: int32 + type: integer + type: object + resources: + description: Resource requirements for the Searchd component + properties: + claims: + description: "Claims lists the names of resources, defined + in spec.resourceClaims, that are used by this container. + \n This is an alpha field and requires enabling the DynamicResourceAllocation + feature gate. \n This field is immutable." + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the name of one entry in + pod.spec.resourceClaims of the Pod where this field + is used. It makes that resource available inside a + container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute + resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of compute + resources required. If Requests is omitted for a container, + it defaults to Limits if that is explicitly specified, otherwise + to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' + type: object + type: object + terminationGracePeriodSeconds: + description: Configures the TerminationGracePeriodSeconds for + Searchd + format: int64 + type: integer + tolerations: + description: If specified, the Searchd pod's tolerations. + items: + description: The pod this Toleration is attached to tolerates + any taint that matches the triple using + the matching operator . + properties: + effect: + description: Effect indicates the taint effect to match. + Empty means match all taint effects. When specified, allowed + values are NoSchedule, PreferNoSchedule and NoExecute. + type: string + key: + description: Key is the taint key that the toleration applies + to. Empty means match all taint keys. If the key is empty, + operator must be Exists; this combination means to match + all values and all keys. + type: string + operator: + description: Operator represents a key's relationship to + the value. Valid operators are Exists and Equal. Defaults + to Equal. Exists is equivalent to wildcard for value, + so that a pod can tolerate all taints of a particular + category. + type: string + tolerationSeconds: + description: TolerationSeconds represents the period of + time the toleration (which must be of effect NoExecute, + otherwise this field is ignored) tolerates the taint. + By default, it is not set, which means tolerate the taint + forever (do not evict). Zero and negative values will + be treated as 0 (evict immediately) by the system. + format: int64 + type: integer + value: + description: Value is the taint value the toleration matches + to. If the operator is Exists, the value should be empty, + otherwise just a regular string. + type: string + type: object + type: array + type: object sidekiqBilling: description: Sidekiq Billing specific configuration options properties: @@ -3613,6 +4029,9 @@ spec: config: description: Configuration options for System's sphinx properties: + enabled: + description: Deploy Sphinx instance + type: boolean thinking: description: Thinking configuration for sphinx properties: @@ -3647,6 +4066,9 @@ spec: description: The TCP port Sphinx will run its daemon on format: int32 type: integer + serviceName: + description: Allows setting the service name for Sphinx + type: string type: object type: object image: diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index 263966b2..87479a39 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.6 + newTag: v0.19.7 diff --git a/config/manifests/bases/saas-operator.clusterserviceversion.yaml b/config/manifests/bases/saas-operator.clusterserviceversion.yaml index f14d3a4c..59e07bf4 100644 --- a/config/manifests/bases/saas-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/saas-operator.clusterserviceversion.yaml @@ -2605,6 +2605,15 @@ spec: - description: OpenSSL verification mode for sandbox proxy displayName: Sandbox Proxy Openssl Verify Mode path: config.sandboxProxyOpensslVerifyMode + - description: Search service options + displayName: Search Server + path: config.searchServer + - description: Defines the address host + displayName: Host + path: config.searchServer.host + - description: Defines the address port + displayName: Port + path: config.searchServer.port - description: SecretKeyBase displayName: Secret Key Base path: config.secretKeyBase @@ -2817,6 +2826,105 @@ spec: - description: Image tag displayName: Tag path: image.tag + - description: Searchd specific configuration options + displayName: Searchd + path: searchd + - description: Configuration options for System's Searchd + displayName: Config + path: searchd.config + - description: Searchd database path + displayName: Database Path + path: searchd.config.databasePath + - description: Searchd database storage type + displayName: Database Storage Class + path: searchd.config.databaseStorageClass + - description: Searchd database storage size + displayName: Database Storage Size + path: searchd.config.databaseStorageSize + - description: The TCP port Searchd will run its daemon on + displayName: Port + path: searchd.config.port + - description: Allows setting the service name for Searchd + displayName: Service Name + path: searchd.config.serviceName + - description: Deploy searchd instance + displayName: Enabled + path: searchd.enabled + - description: Image specification for the Searchd component. Defaults to system + image if not defined. + displayName: Image + path: searchd.image + - description: Docker repository of the image + displayName: Name + path: searchd.image.name + - description: Pull policy for the image + displayName: Pull Policy + path: searchd.image.pullPolicy + - description: Name of the Secret that holds quay.io credentials to access the + image repository + displayName: Pull Secret Name + path: searchd.image.pullSecretName + - description: Image tag + displayName: Tag + path: searchd.image.tag + - description: Liveness probe for the Searchd component + displayName: Liveness Probe + path: searchd.livenessProbe + - description: Minimum consecutive failures for the probe to be considered failed + after having succeeded + displayName: Failure Threshold + path: searchd.livenessProbe.failureThreshold + - description: Number of seconds after the container has started before liveness + probes are initiated + displayName: Initial Delay Seconds + path: searchd.livenessProbe.initialDelaySeconds + - description: How often (in seconds) to perform the probe + displayName: Period Seconds + path: searchd.livenessProbe.periodSeconds + - description: Minimum consecutive successes for the probe to be considered + successful after having failed + displayName: Success Threshold + path: searchd.livenessProbe.successThreshold + - description: Number of seconds after which the probe times out + displayName: Timeout Seconds + path: searchd.livenessProbe.timeoutSeconds + - description: Readiness probe for the Searchd component + displayName: Readiness Probe + path: searchd.readinessProbe + - description: Minimum consecutive failures for the probe to be considered failed + after having succeeded + displayName: Failure Threshold + path: searchd.readinessProbe.failureThreshold + - description: Number of seconds after the container has started before liveness + probes are initiated + displayName: Initial Delay Seconds + path: searchd.readinessProbe.initialDelaySeconds + - description: How often (in seconds) to perform the probe + displayName: Period Seconds + path: searchd.readinessProbe.periodSeconds + - description: Minimum consecutive successes for the probe to be considered + successful after having failed + displayName: Success Threshold + path: searchd.readinessProbe.successThreshold + - description: Number of seconds after which the probe times out + displayName: Timeout Seconds + path: searchd.readinessProbe.timeoutSeconds + - description: Resource requirements for the Searchd component + displayName: Resources + path: searchd.resources + - description: 'Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' + displayName: Limits + path: searchd.resources.limits + - description: 'Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is + explicitly specified, otherwise to an implementation-defined value. More + info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' + displayName: Requests + path: searchd.resources.requests + - description: Configures the TerminationGracePeriodSeconds for Searchd + displayName: Termination Grace Period Seconds + path: searchd.terminationGracePeriodSeconds - description: Sidekiq Billing specific configuration options displayName: Sidekiq Billing path: sidekiqBilling @@ -3210,6 +3318,9 @@ spec: - description: Configuration options for System's sphinx displayName: Config path: sphinx.config + - description: Deploy Sphinx instance + displayName: Enabled + path: sphinx.config.enabled - description: Thinking configuration for sphinx displayName: Thinking path: sphinx.config.thinking @@ -3237,6 +3348,9 @@ spec: - description: The TCP port Sphinx will run its daemon on displayName: Port path: sphinx.config.thinking.port + - description: Allows setting the service name for Sphinx + displayName: Service Name + path: sphinx.config.thinking.serviceName - description: Image specification for the Sphinx component. Defaults to system image if not defined. displayName: Image diff --git a/controllers/apicast_controller_suite_test.go b/controllers/apicast_controller_suite_test.go index ce52d8d5..243e0c93 100644 --- a/controllers/apicast_controller_suite_test.go +++ b/controllers/apicast_controller_suite_test.go @@ -419,14 +419,14 @@ var _ = Describe("Apicast controller", func() { patch := client.MergeFrom(apicast.DeepCopy()) apicast.Spec.Production.Canary = &saasv1alpha1.Canary{ - ImageName: pointer.StringPtr("newImage"), - ImageTag: pointer.StringPtr("newTag"), - Replicas: pointer.Int32Ptr(1), + ImageName: pointer.String("newImage"), + ImageTag: pointer.String("newTag"), + Replicas: pointer.Int32(1), } apicast.Spec.Staging.Canary = &saasv1alpha1.Canary{ - ImageName: pointer.StringPtr("newImage"), - ImageTag: pointer.StringPtr("newTag"), - Replicas: pointer.Int32Ptr(1), + ImageName: pointer.String("newImage"), + ImageTag: pointer.String("newTag"), + Replicas: pointer.Int32(1), } if err := k8sClient.Patch(context.Background(), apicast, patch); err != nil { diff --git a/controllers/autossl_controller_suite_test.go b/controllers/autossl_controller_suite_test.go index 98047e36..2f718ee8 100644 --- a/controllers/autossl_controller_suite_test.go +++ b/controllers/autossl_controller_suite_test.go @@ -256,9 +256,9 @@ var _ = Describe("AutoSSL controller", func() { patch := client.MergeFrom(autossl.DeepCopy()) autossl.Spec.Canary = &saasv1alpha1.Canary{ - ImageName: pointer.StringPtr("newImage"), - ImageTag: pointer.StringPtr("newTag"), - Replicas: pointer.Int32Ptr(1), + ImageName: pointer.String("newImage"), + ImageTag: pointer.String("newTag"), + Replicas: pointer.Int32(1), } return k8sClient.Patch(context.Background(), autossl, patch) diff --git a/controllers/backend_controller_suite_test.go b/controllers/backend_controller_suite_test.go index b924b1bf..c6917022 100644 --- a/controllers/backend_controller_suite_test.go +++ b/controllers/backend_controller_suite_test.go @@ -64,7 +64,7 @@ var _ = Describe("Backend controller", func() { Config: saasv1alpha1.BackendConfig{ RedisStorageDSN: "storageDSN", RedisQueuesDSN: "queuesDSN", - SystemEventsHookURL: saasv1alpha1.SecretReference{Override: pointer.StringPtr("system-app")}, + SystemEventsHookURL: saasv1alpha1.SecretReference{Override: pointer.String("system-app")}, SystemEventsHookPassword: saasv1alpha1.SecretReference{ FromVault: &saasv1alpha1.VaultSecretReference{ Path: "some-path-hook-password", @@ -307,13 +307,13 @@ var _ = Describe("Backend controller", func() { patch := client.MergeFrom(backend.DeepCopy()) backend.Spec.Image = &saasv1alpha1.ImageSpec{ - Name: pointer.StringPtr("newImage"), - Tag: pointer.StringPtr("newTag"), + Name: pointer.String("newImage"), + Tag: pointer.String("newTag"), } backend.Spec.Listener.Replicas = pointer.Int32(3) backend.Spec.Listener.HPA = &saasv1alpha1.HorizontalPodAutoscalerSpec{} backend.Spec.Listener.Config = &saasv1alpha1.ListenerConfig{ - RedisAsync: pointer.BoolPtr(true), + RedisAsync: pointer.Bool(true), } backend.Spec.Worker = &saasv1alpha1.WorkerSpec{ HPA: &saasv1alpha1.HorizontalPodAutoscalerSpec{ @@ -324,12 +324,12 @@ var _ = Describe("Backend controller", func() { Replicas: pointer.Int32(3), } backend.Spec.Listener.LoadBalancer = &saasv1alpha1.NLBLoadBalancerSpec{ - CrossZoneLoadBalancingEnabled: pointer.BoolPtr(false), + CrossZoneLoadBalancingEnabled: pointer.Bool(false), } backend.Spec.Config.ExternalSecret.RefreshInterval = &metav1.Duration{Duration: 1 * time.Second} backend.Spec.Config.ExternalSecret.SecretStoreRef = &saasv1alpha1.ExternalSecretSecretStoreReferenceSpec{ - Name: pointer.StringPtr("other-store"), - Kind: pointer.StringPtr("SecretStore"), + Name: pointer.String("other-store"), + Kind: pointer.String("SecretStore"), } backend.Spec.Config.InternalAPIUser.FromVault.Path = "secret/data/updated-path-api" backend.Spec.Config.SystemEventsHookPassword.FromVault.Path = "secret/data/updated-path-hook" @@ -490,13 +490,13 @@ var _ = Describe("Backend controller", func() { patch := client.MergeFrom(backend.DeepCopy()) backend.Spec.Listener.Canary = &saasv1alpha1.Canary{ - ImageName: pointer.StringPtr("newImage"), - ImageTag: pointer.StringPtr("newTag"), + ImageName: pointer.String("newImage"), + ImageTag: pointer.String("newTag"), } backend.Spec.Worker = &saasv1alpha1.WorkerSpec{ Canary: &saasv1alpha1.Canary{ - ImageName: pointer.StringPtr("newImage"), - ImageTag: pointer.StringPtr("newTag"), + ImageName: pointer.String("newImage"), + ImageTag: pointer.String("newTag"), Patches: []string{ `[{"op": "add", "path": "/config/rackEnv", "value": "test"}]`, `[{"op": "replace", "path": "/config/redisStorageDSN", "value": "testDSN"}]`, @@ -740,7 +740,7 @@ var _ = Describe("Backend controller", func() { backend.Spec.Twemproxy = &saasv1alpha1.TwemproxySpec{ TwemproxyConfigRef: "backend-twemproxyconfig", Options: &saasv1alpha1.TwemproxyOptions{ - LogLevel: pointer.Int32Ptr(2), + LogLevel: pointer.Int32(2), }, } diff --git a/controllers/corsproxy_controller_suite_test.go b/controllers/corsproxy_controller_suite_test.go index ffdecc3a..a88d8e83 100644 --- a/controllers/corsproxy_controller_suite_test.go +++ b/controllers/corsproxy_controller_suite_test.go @@ -165,8 +165,8 @@ var _ = Describe("CORSProxy controller", func() { corsproxy.Spec.ReadinessProbe = &saasv1alpha1.ProbeSpec{} corsproxy.Spec.Config.ExternalSecret.RefreshInterval = &metav1.Duration{Duration: 1 * time.Second} corsproxy.Spec.Config.ExternalSecret.SecretStoreRef = &saasv1alpha1.ExternalSecretSecretStoreReferenceSpec{ - Name: pointer.StringPtr("other-store"), - Kind: pointer.StringPtr("SecretStore"), + Name: pointer.String("other-store"), + Kind: pointer.String("SecretStore"), } corsproxy.Spec.Config.SystemDatabaseDSN.FromVault.Path = "secret/data/updated-path" corsproxy.Spec.GrafanaDashboard = &saasv1alpha1.GrafanaDashboardSpec{} diff --git a/controllers/coverage/coverage.html b/controllers/coverage/coverage.html index 96298027..ef33ae63 100644 --- a/controllers/coverage/coverage.html +++ b/controllers/coverage/coverage.html @@ -1,97 +1,154 @@ - - - - controllers: Go Coverage Report - - - -
- -
- not tracked - - not covered - covered - -
-
-
- -
+ + diff --git a/controllers/mappingservice_controller_suite_test.go b/controllers/mappingservice_controller_suite_test.go index 90819f53..c26cd087 100644 --- a/controllers/mappingservice_controller_suite_test.go +++ b/controllers/mappingservice_controller_suite_test.go @@ -158,8 +158,8 @@ var _ = Describe("MappingService controller", func() { mappingservice.Spec.Config.ExternalSecret.RefreshInterval = &metav1.Duration{Duration: 1 * time.Second} mappingservice.Spec.Config.ExternalSecret.SecretStoreRef = &saasv1alpha1.ExternalSecretSecretStoreReferenceSpec{ - Name: pointer.StringPtr("other-store"), - Kind: pointer.StringPtr("SecretStore"), + Name: pointer.String("other-store"), + Kind: pointer.String("SecretStore"), } mappingservice.Spec.Config.SystemAdminToken.FromVault.Path = "secret/data/updated-path" mappingservice.Spec.HPA = &saasv1alpha1.HorizontalPodAutoscalerSpec{ diff --git a/controllers/redisshard_controller.go b/controllers/redisshard_controller.go index f05b24d7..59f21b3c 100644 --- a/controllers/redisshard_controller.go +++ b/controllers/redisshard_controller.go @@ -139,7 +139,7 @@ func (r *RedisShardReconciler) updateStatus(ctx context.Context, shard *redis.Sh for _, server := range shard.Servers { if server.Role == client.Master { - status.ShardNodes.Master = pointer.StringPtr(server.Name) + status.ShardNodes.Master = pointer.String(server.Name) } else if server.Role == client.Slave { status.ShardNodes.Slaves = append(status.ShardNodes.Slaves, server.Name) } diff --git a/controllers/system_controller.go b/controllers/system_controller.go index 354ab137..e607a066 100644 --- a/controllers/system_controller.go +++ b/controllers/system_controller.go @@ -114,6 +114,9 @@ func (r *SystemReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr // Sphinx resources resources = append(resources, gen.Sphinx.StatefulSetWithTraffic()...) + // Searchd resources + resources = append(resources, gen.Searchd.StatefulSetWithTraffic()...) + // Console resources resources = append(resources, gen.Console.StatefulSet()) diff --git a/controllers/system_controller_suite_test.go b/controllers/system_controller_suite_test.go index 2501dd5a..f59a8e4f 100644 --- a/controllers/system_controller_suite_test.go +++ b/controllers/system_controller_suite_test.go @@ -64,63 +64,63 @@ var _ = Describe("System controller", func() { Key: "some-key-db", }, }, - EventsSharedSecret: saasv1alpha1.SecretReference{Override: pointer.StringPtr("override")}, + EventsSharedSecret: saasv1alpha1.SecretReference{Override: pointer.String("override")}, Recaptcha: saasv1alpha1.SystemRecaptchaSpec{ - PublicKey: saasv1alpha1.SecretReference{Override: pointer.StringPtr("override")}, - PrivateKey: saasv1alpha1.SecretReference{Override: pointer.StringPtr("override")}, + PublicKey: saasv1alpha1.SecretReference{Override: pointer.String("override")}, + PrivateKey: saasv1alpha1.SecretReference{Override: pointer.String("override")}, }, - SecretKeyBase: saasv1alpha1.SecretReference{Override: pointer.StringPtr("override")}, - AccessCode: &saasv1alpha1.SecretReference{Override: pointer.StringPtr("override")}, + SecretKeyBase: saasv1alpha1.SecretReference{Override: pointer.String("override")}, + AccessCode: &saasv1alpha1.SecretReference{Override: pointer.String("override")}, Segment: saasv1alpha1.SegmentSpec{ DeletionWorkspace: "value", - DeletionToken: saasv1alpha1.SecretReference{Override: pointer.StringPtr("override")}, - WriteKey: saasv1alpha1.SecretReference{Override: pointer.StringPtr("override")}, + DeletionToken: saasv1alpha1.SecretReference{Override: pointer.String("override")}, + WriteKey: saasv1alpha1.SecretReference{Override: pointer.String("override")}, }, Github: saasv1alpha1.GithubSpec{ - ClientID: saasv1alpha1.SecretReference{Override: pointer.StringPtr("override")}, - ClientSecret: saasv1alpha1.SecretReference{Override: pointer.StringPtr("override")}, + ClientID: saasv1alpha1.SecretReference{Override: pointer.String("override")}, + ClientSecret: saasv1alpha1.SecretReference{Override: pointer.String("override")}, }, RedHatCustomerPortal: saasv1alpha1.RedHatCustomerPortalSpec{ - ClientID: saasv1alpha1.SecretReference{Override: pointer.StringPtr("override")}, - ClientSecret: saasv1alpha1.SecretReference{Override: pointer.StringPtr("override")}, - Realm: pointer.StringPtr("sso.example.net"), + ClientID: saasv1alpha1.SecretReference{Override: pointer.String("override")}, + ClientSecret: saasv1alpha1.SecretReference{Override: pointer.String("override")}, + Realm: pointer.String("sso.example.net"), }, Bugsnag: &saasv1alpha1.BugsnagSpec{ - ReleaseStage: pointer.StringPtr("staging"), - APIKey: saasv1alpha1.SecretReference{Override: pointer.StringPtr("override")}, + ReleaseStage: pointer.String("staging"), + APIKey: saasv1alpha1.SecretReference{Override: pointer.String("override")}, }, - DatabaseSecret: saasv1alpha1.SecretReference{Override: pointer.StringPtr("override")}, + DatabaseSecret: saasv1alpha1.SecretReference{Override: pointer.String("override")}, MemcachedServers: "value", Redis: saasv1alpha1.RedisSpec{ QueuesDSN: "value", }, SMTP: saasv1alpha1.SMTPSpec{ Address: "value", - User: saasv1alpha1.SecretReference{Override: pointer.StringPtr("override")}, - Password: saasv1alpha1.SecretReference{Override: pointer.StringPtr("override")}, + User: saasv1alpha1.SecretReference{Override: pointer.String("override")}, + Password: saasv1alpha1.SecretReference{Override: pointer.String("override")}, Port: 1000, AuthProtocol: "value", OpenSSLVerifyMode: "value", - STARTTLS: pointer.BoolPtr(false), + STARTTLS: pointer.Bool(false), }, - MappingServiceAccessToken: saasv1alpha1.SecretReference{Override: pointer.StringPtr("override")}, + MappingServiceAccessToken: saasv1alpha1.SecretReference{Override: pointer.String("override")}, Zync: &saasv1alpha1.SystemZyncSpec{ - AuthToken: saasv1alpha1.SecretReference{Override: pointer.StringPtr("override")}, + AuthToken: saasv1alpha1.SecretReference{Override: pointer.String("override")}, Endpoint: "value", }, Backend: saasv1alpha1.SystemBackendSpec{ ExternalEndpoint: "value", InternalEndpoint: "value", - InternalAPIUser: saasv1alpha1.SecretReference{Override: pointer.StringPtr("override")}, - InternalAPIPassword: saasv1alpha1.SecretReference{Override: pointer.StringPtr("override")}, + InternalAPIUser: saasv1alpha1.SecretReference{Override: pointer.String("override")}, + InternalAPIPassword: saasv1alpha1.SecretReference{Override: pointer.String("override")}, RedisDSN: "value", }, Assets: saasv1alpha1.AssetsSpec{ - Host: pointer.StringPtr("test.cloudfront.net"), + Host: pointer.String("test.cloudfront.net"), Bucket: "bucket", Region: "us-east-1", - AccessKey: saasv1alpha1.SecretReference{Override: pointer.StringPtr("override")}, - SecretKey: saasv1alpha1.SecretReference{Override: pointer.StringPtr("override")}, + AccessKey: saasv1alpha1.SecretReference{Override: pointer.String("override")}, + SecretKey: saasv1alpha1.SecretReference{Override: pointer.String("override")}, }, }, App: &saasv1alpha1.SystemAppSpec{ @@ -292,6 +292,8 @@ var _ = Describe("System controller", func() { switch env.Name { case "SECRET_KEY_BASE": Expect(env.Value).NotTo(Equal("")) + case "THINKING_SPHINX_ADDRESS": + Expect(env.Value).NotTo(Equal("system-sphinx")) } } @@ -353,6 +355,10 @@ var _ = Describe("System controller", func() { (&testutil.ExpectedResource{Name: "system-console", Namespace: namespace, Missing: true}). Assert(k8sClient, sts, timeout, poll)) + By("ensuring the system-searchd statefulset", + (&testutil.ExpectedResource{Name: "system-searchd", Namespace: namespace, Missing: true}). + Assert(k8sClient, sts, timeout, poll)) + dep := &appsv1.Deployment{} By("ensuring the system-app-canary deployment", (&testutil.ExpectedResource{Name: "system-app-canary", Namespace: namespace, Missing: true}). @@ -372,6 +378,115 @@ var _ = Describe("System controller", func() { }) + When("updating a System resource with searchd", func() { + + // Resource Versions + rvs := make(map[string]string) + + BeforeEach(func() { + Eventually(func() error { + err := k8sClient.Get( + context.Background(), + types.NamespacedName{Name: "instance", Namespace: namespace}, + system, + ) + Expect(err).ToNot(HaveOccurred()) + + rvs["deployment/system-app"] = testutil.GetResourceVersion( + 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.Searchd = &saasv1alpha1.SystemSearchdSpec{ + Enabled: pointer.Bool(true), + Image: &saasv1alpha1.ImageSpec{ + Name: pointer.String("newImage"), + Tag: pointer.String("newTag"), + }, + } + return k8sClient.Patch(context.Background(), system, patch) + }, timeout, poll).ShouldNot(HaveOccurred()) + }) + + It("creates the system-searchd resources", func() { + + dep := &appsv1.Deployment{} + By("deploying a system-app workload", + (&testutil.ExpectedWorkload{ + Name: "system-app", + Namespace: namespace, + Replicas: 2, + ContainerName: "system-app", + PDB: true, + HPA: true, + PodMonitor: true, + LastVersion: rvs["deployment/system-app"], + }).Assert(k8sClient, dep, timeout, poll)) + + for _, env := range dep.Spec.Template.Spec.Containers[0].Env { + switch env.Name { + case "THINKING_SPHINX_ADDRESS": + Expect(env.Value).To(Equal("system-searchd")) + case "THINKING_SPHINX_PORT": + Expect(env.Value).To(Equal("1234")) + } + } + + sts := &appsv1.StatefulSet{} + By("deploying the system-searchd statefulset", + (&testutil.ExpectedResource{Name: "system-searchd", Namespace: namespace}). + Assert(k8sClient, sts, timeout, poll)) + + Expect(sts.Spec.Template.Spec.Containers[0].Args).To(BeEmpty()) + Expect(sts.Spec.Template.Spec.TerminationGracePeriodSeconds).To(Equal(pointer.Int64(60))) + + Expect(sts.Spec.Template.Spec.Containers[0].Env).To(BeEmpty()) + + svc := &corev1.Service{} + By("deploying the system-searchd service", + (&testutil.ExpectedResource{Name: "system-searchd", Namespace: namespace}). + Assert(k8sClient, svc, timeout, poll)) + Expect(svc.Spec.Selector["deployment"]).To(Equal("system-searchd")) + + }) + + }) + + When("updating a System resource disabling sphinx", func() { + + BeforeEach(func() { + Eventually(func() error { + err := k8sClient.Get( + context.Background(), + types.NamespacedName{Name: "instance", Namespace: namespace}, + system, + ) + Expect(err).ToNot(HaveOccurred()) + patch := client.MergeFrom(system.DeepCopy()) + system.Spec.Sphinx = &saasv1alpha1.SystemSphinxSpec{ + Config: &saasv1alpha1.SphinxConfig{ + Enabled: pointer.Bool(false), + }, + } + return k8sClient.Patch(context.Background(), system, patch) + }, timeout, poll).ShouldNot(HaveOccurred()) + }) + + It("removes the system-sphinx resources", func() { + + sts := &appsv1.StatefulSet{} + By("removing the system-sphinx statefulset", + (&testutil.ExpectedResource{Name: "system-sphinx", Namespace: namespace, Missing: true}). + Assert(k8sClient, sts, timeout, poll)) + + }) + + }) + When("updating a System resource with console", func() { BeforeEach(func() { @@ -388,8 +503,8 @@ var _ = Describe("System controller", func() { } system.Spec.Console = &saasv1alpha1.SystemRailsConsoleSpec{ Image: &saasv1alpha1.ImageSpec{ - Name: pointer.StringPtr("newImage"), - Tag: pointer.StringPtr("newTag"), + Name: pointer.String("newImage"), + Tag: pointer.String("newTag"), }, } return k8sClient.Patch(context.Background(), system, patch) @@ -444,27 +559,27 @@ var _ = Describe("System controller", func() { patch := client.MergeFrom(system.DeepCopy()) system.Spec.App = &saasv1alpha1.SystemAppSpec{ Canary: &saasv1alpha1.Canary{ - ImageName: pointer.StringPtr("newImage"), - ImageTag: pointer.StringPtr("newTag"), - Replicas: pointer.Int32Ptr(2)}, + ImageName: pointer.String("newImage"), + ImageTag: pointer.String("newTag"), + Replicas: pointer.Int32(2)}, } system.Spec.SidekiqDefault = &saasv1alpha1.SystemSidekiqSpec{ Canary: &saasv1alpha1.Canary{ - ImageName: pointer.StringPtr("newImage"), - ImageTag: pointer.StringPtr("newTag"), - Replicas: pointer.Int32Ptr(2)}, + ImageName: pointer.String("newImage"), + ImageTag: pointer.String("newTag"), + Replicas: pointer.Int32(2)}, } system.Spec.SidekiqBilling = &saasv1alpha1.SystemSidekiqSpec{ Canary: &saasv1alpha1.Canary{ - ImageName: pointer.StringPtr("newImage"), - ImageTag: pointer.StringPtr("newTag"), - Replicas: pointer.Int32Ptr(2)}, + ImageName: pointer.String("newImage"), + ImageTag: pointer.String("newTag"), + Replicas: pointer.Int32(2)}, } system.Spec.SidekiqLow = &saasv1alpha1.SystemSidekiqSpec{ Canary: &saasv1alpha1.Canary{ - ImageName: pointer.StringPtr("newImage"), - ImageTag: pointer.StringPtr("newTag"), - Replicas: pointer.Int32Ptr(2)}, + ImageName: pointer.String("newImage"), + ImageTag: pointer.String("newTag"), + Replicas: pointer.Int32(2)}, } // return k8sClient.Patch(context.Background(), system, patch) @@ -689,7 +804,7 @@ var _ = Describe("System controller", func() { system.Spec.Twemproxy = &saasv1alpha1.TwemproxySpec{ TwemproxyConfigRef: "system-twemproxyconfig", Options: &saasv1alpha1.TwemproxyOptions{ - LogLevel: pointer.Int32Ptr(2), + LogLevel: pointer.Int32(2), }, } @@ -911,8 +1026,8 @@ var _ = Describe("System controller", func() { system.Spec.Config.ExternalSecret.RefreshInterval = &metav1.Duration{Duration: 1 * time.Second} system.Spec.Config.ExternalSecret.SecretStoreRef = &saasv1alpha1.ExternalSecretSecretStoreReferenceSpec{ - Name: pointer.StringPtr("other-store"), - Kind: pointer.StringPtr("SecretStore"), + Name: pointer.String("other-store"), + Kind: pointer.String("SecretStore"), } system.Spec.Config.DatabaseDSN.FromVault.Path = "secret/data/updated-path" diff --git a/controllers/zync_controller_suite_test.go b/controllers/zync_controller_suite_test.go index 36866ab8..7eec1866 100644 --- a/controllers/zync_controller_suite_test.go +++ b/controllers/zync_controller_suite_test.go @@ -72,7 +72,7 @@ var _ = Describe("Zync controller", func() { }, }, Bugsnag: &saasv1alpha1.BugsnagSpec{ - ReleaseStage: pointer.StringPtr("staging"), + ReleaseStage: pointer.String("staging"), APIKey: saasv1alpha1.SecretReference{ FromVault: &saasv1alpha1.VaultSecretReference{ Path: "some-path-bugsnag", @@ -229,8 +229,8 @@ var _ = Describe("Zync controller", func() { } zync.Spec.Config.ExternalSecret.RefreshInterval = &metav1.Duration{Duration: 1 * time.Second} zync.Spec.Config.ExternalSecret.SecretStoreRef = &saasv1alpha1.ExternalSecretSecretStoreReferenceSpec{ - Name: pointer.StringPtr("other-store"), - Kind: pointer.StringPtr("SecretStore"), + Name: pointer.String("other-store"), + Kind: pointer.String("SecretStore"), } zync.Spec.Config.SecretKeyBase.FromVault.Path = "secret/data/updated-path" diff --git a/docs/api-reference/reference.asciidoc b/docs/api-reference/reference.asciidoc index 06697102..5740c093 100644 --- a/docs/api-reference/reference.asciidoc +++ b/docs/api-reference/reference.asciidoc @@ -52,6 +52,24 @@ APISpec is the configuration for main Zync api component |=== +[id="{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-addressspec"] +==== AddressSpec + +AddressSpec allows the definition of an address + +.Appears In: +**** +- xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-systemconfig[$$SystemConfig$$] +**** + +[cols="25a,75a", options="header"] +|=== +| Field | Description +| *`host`* __string__ | Defines the address host +| *`port`* __integer__ | Defines the address port +|=== + + [id="{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-apicast"] ==== Apicast @@ -701,6 +719,7 @@ ImageSpec defines the image for the component - xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-redisshardspec[$$RedisShardSpec$$] - xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-sentinelspec[$$SentinelSpec$$] - xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-systemrailsconsolespec[$$SystemRailsConsoleSpec$$] +- xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-systemsearchdspec[$$SystemSearchdSpec$$] - xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-systemspec[$$SystemSpec$$] - xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-systemsphinxspec[$$SystemSphinxSpec$$] - xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-twemproxyspec[$$TwemproxySpec$$] @@ -1003,6 +1022,7 @@ ProbeSpec specifies configuration for a probe - xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-quespec[$$QueSpec$$] - xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-sentinelspec[$$SentinelSpec$$] - xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-systemappspec[$$SystemAppSpec$$] +- xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-systemsearchdspec[$$SystemSearchdSpec$$] - xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-systemsidekiqspec[$$SystemSidekiqSpec$$] - xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-systemsphinxspec[$$SystemSphinxSpec$$] - xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-twemproxyspec[$$TwemproxySpec$$] @@ -1229,6 +1249,7 @@ ResourceRequirementsSpec defines the resource requirements for the component - xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-sentinelspec[$$SentinelSpec$$] - xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-systemappspec[$$SystemAppSpec$$] - xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-systemrailsconsolespec[$$SystemRailsConsoleSpec$$] +- xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-systemsearchdspec[$$SystemSearchdSpec$$] - xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-systemsidekiqspec[$$SystemSidekiqSpec$$] - xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-systemsphinxspec[$$SystemSphinxSpec$$] - xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-twemproxyspec[$$TwemproxySpec$$] @@ -1302,6 +1323,27 @@ SMTPSpec has options to configure system's SMTP |=== +[id="{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-searchdconfig"] +==== SearchdConfig + +SearchdConfig has configuration options for System's sphinx + +.Appears In: +**** +- xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-systemsearchdspec[$$SystemSearchdSpec$$] +**** + +[cols="25a,75a", options="header"] +|=== +| Field | Description +| *`serviceName`* __string__ | Allows setting the service name for Searchd +| *`port`* __integer__ | The TCP port Searchd will run its daemon on +| *`databasePath`* __string__ | Searchd database path +| *`databaseStorageSize`* __Quantity__ | Searchd database storage size +| *`databaseStorageClass`* __string__ | Searchd database storage type +|=== + + [id="{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-secretreference"] ==== SecretReference @@ -1502,6 +1544,7 @@ SphinxConfig has configuration options for System's sphinx [cols="25a,75a", options="header"] |=== | Field | Description +| *`enabled`* __boolean__ | Deploy Sphinx instance | *`thinking`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-thinkingspec[$$ThinkingSpec$$]__ | Thinking configuration for sphinx |=== @@ -1590,6 +1633,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 | *`threescaleProviderPlan`* __string__ | 3scale provider plan | *`threescaleSuperdomain`* __string__ | 3scale superdomain | *`configFilesSecret`* __string__ | Secret containging system configuration files to be mounted in the pods @@ -1672,6 +1716,31 @@ SystemRecaptchaSpec holds recaptcha configurations |=== +[id="{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-systemsearchdspec"] +==== SystemSearchdSpec + +SystemSearchdSpec configures the App component of System + +.Appears In: +**** +- xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-systemspec[$$SystemSpec$$] +**** + +[cols="25a,75a", options="header"] +|=== +| Field | Description +| *`enabled`* __boolean__ | Deploy searchd instance +| *`image`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-imagespec[$$ImageSpec$$]__ | Image specification for the Searchd component. Defaults to system image if not defined. +| *`config`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-searchdconfig[$$SearchdConfig$$]__ | Configuration options for System's Searchd +| *`resources`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-resourcerequirementsspec[$$ResourceRequirementsSpec$$]__ | Resource requirements for the Searchd component +| *`livenessProbe`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-probespec[$$ProbeSpec$$]__ | Liveness probe for the Searchd component +| *`readinessProbe`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-probespec[$$ProbeSpec$$]__ | Readiness probe for the Searchd component +| *`nodeAffinity`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#nodeaffinity-v1-core[$$NodeAffinity$$]__ | Describes node affinity scheduling rules for the Searchd pod +| *`tolerations`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#toleration-v1-core[$$Toleration$$] array__ | If specified, the Searchd pod's tolerations. +| *`terminationGracePeriodSeconds`* __integer__ | Configures the TerminationGracePeriodSeconds for Searchd +|=== + + [id="{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-systemsidekiqspec"] ==== SystemSidekiqSpec @@ -1720,6 +1789,7 @@ SystemSpec defines the desired state of System | *`sidekiqBilling`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-systemsidekiqspec[$$SystemSidekiqSpec$$]__ | Sidekiq Billing specific configuration options | *`sidekiqLow`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-systemsidekiqspec[$$SystemSidekiqSpec$$]__ | Sidekiq Low specific configuration options | *`sphinx`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-systemsphinxspec[$$SystemSphinxSpec$$]__ | Sphinx specific configuration options +| *`searchd`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-systemsearchdspec[$$SystemSearchdSpec$$]__ | Searchd specific configuration options | *`console`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-systemrailsconsolespec[$$SystemRailsConsoleSpec$$]__ | Console specific configuration options | *`grafanaDashboard`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-grafanadashboardspec[$$GrafanaDashboardSpec$$]__ | Configures the Grafana Dashboard for the component | *`twemproxy`* __xref:{anchor_prefix}-github-com-3scale-saas-operator-api-v1alpha1-twemproxyspec[$$TwemproxySpec$$]__ | Configures twemproxy @@ -1795,6 +1865,7 @@ ThinkingSpec configures the thinking library for sphinx [cols="25a,75a", options="header"] |=== | Field | Description +| *`serviceName`* __string__ | Allows setting the service name 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 diff --git a/examples/system.yaml b/examples/system.yaml new file mode 100644 index 00000000..02adc543 --- /dev/null +++ b/examples/system.yaml @@ -0,0 +1,155 @@ +apiVersion: saas.3scale.net/v1alpha1 +kind: System +metadata: + name: system +spec: + image: + name: quay.io/3scale/porta + pullSecretName: quay-pull-secret + config: + assets: + host: kustomize-overlay + bucket: kustomize-overlay + region: us-east-1 + accessKey: + fromVault: + path: system-aws-multitenant-assets-bucket-iam # prefixed by kustomize + key: AWS_ACCESS_KEY_ID + secretKey: + fromVault: + path: system-aws-multitenant-assets-bucket-iam # prefixed by kustomize + key: AWS_SECRET_ACCESS_KEY + backend: + externalEndpoint: kustomize-overlay + internalEndpoint: kustomize-overlay + redisDSN: redis://127.0.0.1:22121 + internalAPIUser: + fromVault: + path: backend # prefixed by kustomize + key: internalApiUsername + internalAPIPassword: + fromVault: + path: backend # prefixed by kustomize + key: internalApiPassword + bugsnag: + apiKey: + fromVault: + path: system # prefixed by kustomize + key: bugsnagApiKey + configFilesSecret: system-config + databaseDSN: + fromVault: + path: system-database-app-credentials # prefixed by kustomize + key: dsn + databaseSecret: + fromVault: + path: system # prefixed by kustomize + key: databaseSecret + eventsSharedSecret: + fromVault: + path: system # prefixed by kustomize + key: eventsSharedSecret + github: + clientID: + fromVault: + path: system # prefixed by kustomize + key: githubClientId + clientSecret: + fromVault: + path: system # prefixed by kustomize + key: githubClientSecret + mappingServiceAccessToken: + fromVault: + path: system # prefixed by kustomize + key: mappingServiceAccessToken + memcachedServers: kustomize-overlay + rails: + console: true + environment: production + logLevel: info + recaptcha: + publicKey: + fromVault: + path: system # prefixed by kustomize + key: recaptchaPublicKey + privateKey: + fromVault: + path: system # prefixed by kustomize + key: recaptchaPrivateKey + redhatCustomerPortal: + clientID: + fromVault: + path: system # prefixed by kustomize + key: redhatCustomerPortalClientId + clientSecret: + fromVault: + path: system # prefixed by kustomize + key: redhatCustomerPortalClientName + redis: + queuesDSN: kustomize-overlay + secretKeyBase: + fromVault: + path: system # prefixed by kustomize + key: secretKeyBase + segment: + deletionWorkspace: 3scale-dev + deletionToken: + fromVault: + path: system # prefixed by kustomize + key: segmentDeletionToken + writeKey: + fromVault: + path: system # prefixed by kustomize + key: segmentWriteKey + smtp: + address: smtp.sendgrid.net + user: + fromVault: + path: system-smtp # prefixed by kustomize + key: username + password: + fromVault: + path: system-smtp # prefixed by kustomize + key: password + port: 587 + authProtocol: plain + opensslVerifyMode: peer + starttlsAuto: false + starttls: true + threescaleSuperdomain: kustomize-overlay + zync: + endpoint: http://zync:8080 + authToken: + fromVault: + path: zync # prefixed by kustomize + key: authenticationToken + console: + resources: + requests: + cpu: "500m" + memory: "1Gi" + limits: + cpu: "1200m" + memory: "1Gi" + sidekiqDefault: + config: + maxThreads: 5 + sidekiqBilling: + config: + maxThreads: 5 + sidekiqLow: + config: + maxThreads: 5 + searchd: + enabled: true + twemproxy: + twemproxyConfigRef: system-twemproxyconfig + options: + logLevel: 4 + resources: + limits: + cpu: 200m + memory: 50Mi + requests: + cpu: 50m + memory: 20Mi diff --git a/pkg/assets/bindata.go b/pkg/assets/bindata.go index 5bc7172d..c78b1d7b 100644 --- a/pkg/assets/bindata.go +++ b/pkg/assets/bindata.go @@ -101,7 +101,7 @@ func dashboardsApicastServicesJsonGtpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "dashboards/apicast-services.json.gtpl", size: 17460, mode: os.FileMode(420), modTime: time.Unix(1679676915, 0)} + info := bindataFileInfo{name: "dashboards/apicast-services.json.gtpl", size: 17460, mode: os.FileMode(436), modTime: time.Unix(1679645064, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -121,7 +121,7 @@ func dashboardsApicastJsonGtpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "dashboards/apicast.json.gtpl", size: 84552, mode: os.FileMode(420), modTime: time.Unix(1679676915, 0)} + info := bindataFileInfo{name: "dashboards/apicast.json.gtpl", size: 84552, mode: os.FileMode(436), modTime: time.Unix(1679645064, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -141,7 +141,7 @@ func dashboardsAutosslJsonGtpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "dashboards/autossl.json.gtpl", size: 59366, mode: os.FileMode(420), modTime: time.Unix(1679676915, 0)} + info := bindataFileInfo{name: "dashboards/autossl.json.gtpl", size: 59366, mode: os.FileMode(436), modTime: time.Unix(1679645064, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -161,7 +161,7 @@ func dashboardsBackendJsonGtpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "dashboards/backend.json.gtpl", size: 122812, mode: os.FileMode(420), modTime: time.Unix(1679676915, 0)} + info := bindataFileInfo{name: "dashboards/backend.json.gtpl", size: 122812, mode: os.FileMode(436), modTime: time.Unix(1679645064, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -181,7 +181,7 @@ func dashboardsCorsProxyJsonGtpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "dashboards/cors-proxy.json.gtpl", size: 78737, mode: os.FileMode(420), modTime: time.Unix(1679676915, 0)} + info := bindataFileInfo{name: "dashboards/cors-proxy.json.gtpl", size: 78737, mode: os.FileMode(436), modTime: time.Unix(1679645064, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -201,7 +201,7 @@ func dashboardsMappingServiceJsonGtpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "dashboards/mapping-service.json.gtpl", size: 70528, mode: os.FileMode(420), modTime: time.Unix(1679676915, 0)} + info := bindataFileInfo{name: "dashboards/mapping-service.json.gtpl", size: 70528, mode: os.FileMode(436), modTime: time.Unix(1679645064, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -221,7 +221,7 @@ func dashboardsRedisSentinelJsonGtpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "dashboards/redis-sentinel.json.gtpl", size: 131661, mode: os.FileMode(420), modTime: time.Unix(1679676915, 0)} + info := bindataFileInfo{name: "dashboards/redis-sentinel.json.gtpl", size: 131661, mode: os.FileMode(436), modTime: time.Unix(1679645064, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -241,7 +241,7 @@ func dashboardsSystemJsonGtpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "dashboards/system.json.gtpl", size: 81338, mode: os.FileMode(420), modTime: time.Unix(1679676915, 0)} + info := bindataFileInfo{name: "dashboards/system.json.gtpl", size: 81338, mode: os.FileMode(436), modTime: time.Unix(1679645064, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -261,7 +261,7 @@ func dashboardsTwemproxyJsonGtpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "dashboards/twemproxy.json.gtpl", size: 130875, mode: os.FileMode(420), modTime: time.Unix(1679676915, 0)} + info := bindataFileInfo{name: "dashboards/twemproxy.json.gtpl", size: 130875, mode: os.FileMode(436), modTime: time.Unix(1679645064, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -281,7 +281,7 @@ func dashboardsZyncJsonGtpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "dashboards/zync.json.gtpl", size: 70304, mode: os.FileMode(420), modTime: time.Unix(1679676915, 0)} + info := bindataFileInfo{name: "dashboards/zync.json.gtpl", size: 70304, mode: os.FileMode(436), modTime: time.Unix(1679645064, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/pkg/generators/sentinel/statefulset.go b/pkg/generators/sentinel/statefulset.go index 77fac3ed..347e549f 100644 --- a/pkg/generators/sentinel/statefulset.go +++ b/pkg/generators/sentinel/statefulset.go @@ -137,7 +137,7 @@ func (gen *Generator) statefulSet() func() *appsv1.StatefulSet { AccessModes: []corev1.PersistentVolumeAccessMode{corev1.ReadWriteOnce}, Resources: corev1.ResourceRequirements{Requests: corev1.ResourceList{corev1.ResourceStorage: *gen.Spec.Config.StorageSize}}, StorageClassName: gen.Spec.Config.StorageClass, - VolumeMode: (*corev1.PersistentVolumeMode)(pointer.StringPtr(string(corev1.PersistentVolumeFilesystem))), + VolumeMode: (*corev1.PersistentVolumeMode)(pointer.String(string(corev1.PersistentVolumeFilesystem))), DataSource: &corev1.TypedLocalObjectReference{}, }, Status: corev1.PersistentVolumeClaimStatus{ diff --git a/pkg/generators/system/app_deployment.go b/pkg/generators/system/app_deployment.go index dfec6c64..4b32f232 100644 --- a/pkg/generators/system/app_deployment.go +++ b/pkg/generators/system/app_deployment.go @@ -87,7 +87,7 @@ func (gen *AppGenerator) deployment() func() *appsv1.Deployment { Name: "system-config", VolumeSource: corev1.VolumeSource{ Secret: &corev1.SecretVolumeSource{ - DefaultMode: pointer.Int32Ptr(420), + DefaultMode: pointer.Int32(420), SecretName: gen.ConfigFilesSecret, }, }, diff --git a/pkg/generators/system/config/options.go b/pkg/generators/system/config/options.go index 337f3268..e9a220f4 100644 --- a/pkg/generators/system/config/options.go +++ b/pkg/generators/system/config/options.go @@ -20,8 +20,8 @@ type Options struct { RailsLogLevel pod.EnvVarValue `env:"RAILS_LOG_LEVEL"` RailsLogToStdout pod.EnvVarValue `env:"RAILS_LOG_TO_STDOUT"` - SphinxAddress pod.EnvVarValue `env:"THINKING_SPHINX_ADDRESS"` - SphinxPort pod.EnvVarValue `env:"THINKING_SPHINX_PORT"` + SearchServerAddress pod.EnvVarValue `env:"THINKING_SPHINX_ADDRESS"` + SearchServerPort pod.EnvVarValue `env:"THINKING_SPHINX_PORT"` DatabaseURL pod.EnvVarValue `env:"DATABASE_URL" secret:"system-database"` @@ -94,8 +94,8 @@ func NewOptions(spec saasv1alpha1.SystemSpec) Options { RailsLogLevel: &pod.ClearTextValue{Value: *spec.Config.Rails.LogLevel}, RailsLogToStdout: &pod.ClearTextValue{Value: "true"}, - SphinxAddress: &pod.ClearTextValue{Value: SystemSphinxServiceName}, - SphinxPort: &pod.ClearTextValue{Value: fmt.Sprintf("%d", *spec.Sphinx.Config.Thinking.Port)}, + SearchServerAddress: &pod.ClearTextValue{Value: *spec.Config.SearchServer.Host}, + SearchServerPort: &pod.ClearTextValue{Value: fmt.Sprintf("%d", *spec.Config.SearchServer.Port)}, DatabaseURL: &pod.SecretValue{Value: spec.Config.DatabaseDSN}, @@ -153,7 +153,7 @@ func NewOptions(spec saasv1alpha1.SystemSpec) Options { } } else { - opts.BugsnagAPIKey = &pod.SecretValue{Value: saasv1alpha1.SecretReference{Override: pointer.StringPtr("")}} + opts.BugsnagAPIKey = &pod.SecretValue{Value: saasv1alpha1.SecretReference{Override: pointer.String("")}} } if spec.Config.Assets.Host == nil { diff --git a/pkg/generators/system/config/static.go b/pkg/generators/system/config/static.go deleted file mode 100644 index 288c4069..00000000 --- a/pkg/generators/system/config/static.go +++ /dev/null @@ -1,5 +0,0 @@ -package config - -const ( - SystemSphinxServiceName = "system-sphinx" -) diff --git a/pkg/generators/system/console_statefulset.go b/pkg/generators/system/console_statefulset.go index 663b3484..a7287760 100644 --- a/pkg/generators/system/console_statefulset.go +++ b/pkg/generators/system/console_statefulset.go @@ -26,7 +26,7 @@ func (gen *ConsoleGenerator) statefulset() func() *appsv1.StatefulSet { Labels: gen.GetLabels(), }, Spec: appsv1.StatefulSetSpec{ - Replicas: pointer.Int32Ptr(1), + Replicas: pointer.Int32(1), Selector: &metav1.LabelSelector{MatchLabels: gen.GetSelector()}, UpdateStrategy: appsv1.StatefulSetUpdateStrategy{ Type: appsv1.RollingUpdateStatefulSetStrategyType, @@ -73,7 +73,7 @@ func (gen *ConsoleGenerator) statefulset() func() *appsv1.StatefulSet { Name: "system-config", VolumeSource: corev1.VolumeSource{ Secret: &corev1.SecretVolumeSource{ - DefaultMode: pointer.Int32Ptr(420), + DefaultMode: pointer.Int32(420), SecretName: gen.ConfigFilesSecret, }, }, diff --git a/pkg/generators/system/generator.go b/pkg/generators/system/generator.go index c905a9e6..ee56c45b 100644 --- a/pkg/generators/system/generator.go +++ b/pkg/generators/system/generator.go @@ -27,6 +27,7 @@ const ( sidekiqBilling string = "sidekiq-billing" sidekiqLow string = "sidekiq-low" sphinx string = "sphinx" + searchd string = "searchd" ) // Generator configures the generators for System @@ -41,6 +42,7 @@ type Generator struct { SidekiqLow SidekiqGenerator CanarySidekiqLow *SidekiqGenerator Sphinx SphinxGenerator + Searchd SearchdGenerator Console ConsoleGenerator Config saasv1alpha1.SystemConfig GrafanaDashboardSpec saasv1alpha1.GrafanaDashboardSpec @@ -130,6 +132,25 @@ func NewGenerator(instance, namespace string, spec saasv1alpha1.SystemSpec) (Gen ConfigFilesSecret: *spec.Config.ConfigFilesSecret, TwemproxySpec: spec.Twemproxy, }, + Searchd: SearchdGenerator{ + BaseOptionsV2: generators.BaseOptionsV2{ + Component: strings.Join([]string{component, searchd}, "-"), + InstanceName: instance, + Namespace: namespace, + Labels: map[string]string{ + "app": "3scale-api-management", + "threescale_component": component, + "threescale_component_element": searchd, + }, + }, + Enabled: *spec.Searchd.Enabled, + Spec: *spec.Searchd, + Image: *spec.Searchd.Image, + DatabasePort: *spec.Searchd.Config.Port, + DatabasePath: *spec.Searchd.Config.DatabasePath, + DatabaseStorageSize: *spec.Searchd.Config.DatabaseStorageSize, + DatabaseStorageClass: spec.Searchd.Config.DatabaseStorageClass, + }, Sphinx: SphinxGenerator{ BaseOptionsV2: generators.BaseOptionsV2{ Component: strings.Join([]string{component, sphinx}, "-"), @@ -141,6 +162,7 @@ func NewGenerator(instance, namespace string, spec saasv1alpha1.SystemSpec) (Gen "threescale_component_element": sphinx, }, }, + Enabled: *spec.Sphinx.Config.Enabled, Spec: *spec.Sphinx, Options: config.NewSphinxOptions(spec), Image: *spec.Sphinx.Image, @@ -452,6 +474,7 @@ type SphinxGenerator struct { DatabasePath string DatabaseStorageSize resource.Quantity DatabaseStorageClass *string + Enabled bool } func (gen *SphinxGenerator) StatefulSetWithTraffic() []basereconciler.Resource { @@ -466,14 +489,46 @@ func (gen *SphinxGenerator) StatefulSet() basereconciler_resources.StatefulSetTe RolloutTriggers: []basereconciler_resources.RolloutTrigger{ {Name: "system-database", SecretName: pointer.String("system-database")}, }, - IsEnabled: true, + IsEnabled: gen.Enabled, } } func (gen *SphinxGenerator) Service() basereconciler_resources.ServiceTemplate { return basereconciler_resources.ServiceTemplate{ Template: gen.service(), - IsEnabled: true, + IsEnabled: gen.Enabled, + } +} + +// SearchdGenerator has methods to generate resources for system-Searchd +type SearchdGenerator struct { + generators.BaseOptionsV2 + Spec saasv1alpha1.SystemSearchdSpec + Image saasv1alpha1.ImageSpec + DatabasePort int32 + DatabasePath string + DatabaseStorageSize resource.Quantity + DatabaseStorageClass *string + Enabled bool +} + +func (gen *SearchdGenerator) StatefulSetWithTraffic() []basereconciler.Resource { + return []basereconciler.Resource{ + gen.StatefulSet(), gen.Service(), + } +} + +func (gen *SearchdGenerator) StatefulSet() basereconciler_resources.StatefulSetTemplate { + return basereconciler_resources.StatefulSetTemplate{ + Template: gen.statefulset(), + IsEnabled: gen.Enabled, + } +} + +func (gen *SearchdGenerator) Service() basereconciler_resources.ServiceTemplate { + return basereconciler_resources.ServiceTemplate{ + Template: gen.service(), + IsEnabled: gen.Enabled, } } diff --git a/pkg/generators/system/searchd_service.go b/pkg/generators/system/searchd_service.go new file mode 100644 index 00000000..50a3224f --- /dev/null +++ b/pkg/generators/system/searchd_service.go @@ -0,0 +1,30 @@ +package system + +import ( + "github.com/3scale/saas-operator/pkg/resource_builders/service" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" +) + +// service returns a function that will return the corev1.Service for sphinx +func (gen *SearchdGenerator) service() func() *corev1.Service { + + return func() *corev1.Service { + + return &corev1.Service{ + ObjectMeta: metav1.ObjectMeta{ + Name: *gen.Spec.Config.ServiceName, + Namespace: gen.GetNamespace(), + }, + Spec: corev1.ServiceSpec{ + Type: corev1.ServiceTypeClusterIP, + SessionAffinity: corev1.ServiceAffinityNone, + Ports: service.Ports( + service.TCPPort("searchd", gen.DatabasePort, intstr.FromString("searchd")), + ), + Selector: gen.GetSelector(), + }, + } + } +} diff --git a/pkg/generators/system/searchd_statefulset.go b/pkg/generators/system/searchd_statefulset.go new file mode 100644 index 00000000..bb8d1560 --- /dev/null +++ b/pkg/generators/system/searchd_statefulset.go @@ -0,0 +1,91 @@ +package system + +import ( + "fmt" + "strings" + + "github.com/3scale/saas-operator/pkg/resource_builders/pod" + "github.com/3scale/saas-operator/pkg/util" + appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" + "k8s.io/utils/pointer" +) + +// StatefulSet returns a basereconciler.GeneratorFunction function that will return +// a StatefulSet resource when called +func (gen *SearchdGenerator) statefulset() func() *appsv1.StatefulSet { + + return func() *appsv1.StatefulSet { + + return &appsv1.StatefulSet{ + ObjectMeta: metav1.ObjectMeta{ + Name: gen.GetComponent(), + Namespace: gen.Namespace, + Labels: gen.GetLabels(), + }, + Spec: appsv1.StatefulSetSpec{ + Replicas: pointer.Int32(1), + Selector: &metav1.LabelSelector{MatchLabels: gen.GetSelector()}, + UpdateStrategy: appsv1.StatefulSetUpdateStrategy{ + Type: appsv1.RollingUpdateStatefulSetStrategyType, + }, + PodManagementPolicy: appsv1.OrderedReadyPodManagement, + Template: corev1.PodTemplateSpec{ + ObjectMeta: metav1.ObjectMeta{ + Labels: util.MergeMaps(map[string]string{}, gen.GetLabels(), gen.GetSelector()), + }, + Spec: corev1.PodSpec{ + ImagePullSecrets: func() []corev1.LocalObjectReference { + if gen.Image.PullSecretName != nil { + return []corev1.LocalObjectReference{{Name: *gen.Image.PullSecretName}} + } + return nil + }(), + Containers: []corev1.Container{ + { + Name: strings.Join([]string{component, searchd}, "-"), + Image: fmt.Sprintf("%s:%s", *gen.Image.Name, *gen.Image.Tag), + Args: []string{}, + Ports: pod.ContainerPorts( + pod.ContainerPortTCP("searchd", gen.DatabasePort), + ), + Resources: corev1.ResourceRequirements(*gen.Spec.Resources), + LivenessProbe: pod.TCPProbe(intstr.FromString("searchd"), *gen.Spec.LivenessProbe), + ReadinessProbe: pod.TCPProbe(intstr.FromString("searchd"), *gen.Spec.ReadinessProbe), + ImagePullPolicy: *gen.Image.PullPolicy, + TerminationMessagePath: corev1.TerminationMessagePathDefault, + TerminationMessagePolicy: corev1.TerminationMessageReadFile, + VolumeMounts: []corev1.VolumeMount{{ + Name: "system-searchd-database", + MountPath: gen.DatabasePath, + }}, + }, + }, + Affinity: pod.Affinity(gen.GetSelector(), gen.Spec.NodeAffinity), + RestartPolicy: corev1.RestartPolicyAlways, + SecurityContext: &corev1.PodSecurityContext{}, + Tolerations: gen.Spec.Tolerations, + TerminationGracePeriodSeconds: gen.Spec.TerminationGracePeriodSeconds, + }, + }, + VolumeClaimTemplates: []corev1.PersistentVolumeClaim{{ + ObjectMeta: metav1.ObjectMeta{ + Name: "system-searchd-database", + }, + Status: corev1.PersistentVolumeClaimStatus{ + Phase: corev1.ClaimPending, + }, + Spec: corev1.PersistentVolumeClaimSpec{ + AccessModes: []corev1.PersistentVolumeAccessMode{corev1.ReadWriteOnce}, + Resources: corev1.ResourceRequirements{Requests: corev1.ResourceList{corev1.ResourceStorage: gen.DatabaseStorageSize}}, + StorageClassName: gen.DatabaseStorageClass, + VolumeMode: (*corev1.PersistentVolumeMode)(pointer.String(string(corev1.PersistentVolumeFilesystem))), + DataSource: &corev1.TypedLocalObjectReference{}, + }, + }}, + }, + } + } +} diff --git a/pkg/generators/system/sidekiq_deployment.go b/pkg/generators/system/sidekiq_deployment.go index 7fb1ded8..8f3c6c66 100644 --- a/pkg/generators/system/sidekiq_deployment.go +++ b/pkg/generators/system/sidekiq_deployment.go @@ -89,7 +89,7 @@ func (gen *SidekiqGenerator) deployment() func() *appsv1.Deployment { Name: "system-config", VolumeSource: corev1.VolumeSource{ Secret: &corev1.SecretVolumeSource{ - DefaultMode: pointer.Int32Ptr(420), + DefaultMode: pointer.Int32(420), SecretName: gen.ConfigFilesSecret, }, }, diff --git a/pkg/generators/system/sphinx_service.go b/pkg/generators/system/sphinx_service.go index da77a30c..9757a19e 100644 --- a/pkg/generators/system/sphinx_service.go +++ b/pkg/generators/system/sphinx_service.go @@ -1,7 +1,6 @@ package system import ( - "github.com/3scale/saas-operator/pkg/generators/system/config" "github.com/3scale/saas-operator/pkg/resource_builders/service" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -15,7 +14,7 @@ func (gen *SphinxGenerator) service() func() *corev1.Service { return &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ - Name: config.SystemSphinxServiceName, + Name: *gen.Spec.Config.Thinking.ServiceName, Namespace: gen.GetNamespace(), }, Spec: corev1.ServiceSpec{ diff --git a/pkg/generators/system/sphinx_statefulset.go b/pkg/generators/system/sphinx_statefulset.go index c36d47d9..9300d221 100644 --- a/pkg/generators/system/sphinx_statefulset.go +++ b/pkg/generators/system/sphinx_statefulset.go @@ -26,7 +26,7 @@ func (gen *SphinxGenerator) statefulset() func() *appsv1.StatefulSet { Labels: gen.GetLabels(), }, Spec: appsv1.StatefulSetSpec{ - Replicas: pointer.Int32Ptr(1), + Replicas: pointer.Int32(1), Selector: &metav1.LabelSelector{MatchLabels: gen.GetSelector()}, UpdateStrategy: appsv1.StatefulSetUpdateStrategy{ Type: appsv1.RollingUpdateStatefulSetStrategyType, @@ -53,7 +53,7 @@ func (gen *SphinxGenerator) statefulset() func() *appsv1.StatefulSet { }, Env: pod.BuildEnvironment(gen.Options), Ports: pod.ContainerPorts( - pod.ContainerPortTCP("sphinx", 9306), + pod.ContainerPortTCP("sphinx", gen.DatabasePort), ), Resources: corev1.ResourceRequirements(*gen.Spec.Resources), LivenessProbe: pod.TCPProbe(intstr.FromString("sphinx"), *gen.Spec.LivenessProbe), @@ -85,7 +85,7 @@ func (gen *SphinxGenerator) statefulset() func() *appsv1.StatefulSet { AccessModes: []corev1.PersistentVolumeAccessMode{corev1.ReadWriteOnce}, Resources: corev1.ResourceRequirements{Requests: corev1.ResourceList{corev1.ResourceStorage: gen.DatabaseStorageSize}}, StorageClassName: gen.DatabaseStorageClass, - VolumeMode: (*corev1.PersistentVolumeMode)(pointer.StringPtr(string(corev1.PersistentVolumeFilesystem))), + VolumeMode: (*corev1.PersistentVolumeMode)(pointer.String(string(corev1.PersistentVolumeFilesystem))), DataSource: &corev1.TypedLocalObjectReference{}, }, }}, diff --git a/pkg/generators/zync/config/api_options.go b/pkg/generators/zync/config/api_options.go index 2518c14c..3ec18d03 100644 --- a/pkg/generators/zync/config/api_options.go +++ b/pkg/generators/zync/config/api_options.go @@ -42,7 +42,7 @@ func NewAPIOptions(spec saasv1alpha1.ZyncSpec) APIOptions { } } else { - opts.BugsnagAPIKey = &pod.SecretValue{Value: saasv1alpha1.SecretReference{Override: pointer.StringPtr("")}} + opts.BugsnagAPIKey = &pod.SecretValue{Value: saasv1alpha1.SecretReference{Override: pointer.String("")}} } return opts diff --git a/pkg/generators/zync/config/que_options.go b/pkg/generators/zync/config/que_options.go index c3a80b04..80b789a7 100644 --- a/pkg/generators/zync/config/que_options.go +++ b/pkg/generators/zync/config/que_options.go @@ -38,7 +38,7 @@ func NewQueOptions(spec saasv1alpha1.ZyncSpec) QueOptions { } } else { - opts.BugsnagAPIKey = &pod.SecretValue{Value: saasv1alpha1.SecretReference{Override: pointer.StringPtr("")}} + opts.BugsnagAPIKey = &pod.SecretValue{Value: saasv1alpha1.SecretReference{Override: pointer.String("")}} } return opts diff --git a/pkg/reconcilers/workloads/resources_test.go b/pkg/reconcilers/workloads/resources_test.go index 46fac6a7..bcff1113 100644 --- a/pkg/reconcilers/workloads/resources_test.go +++ b/pkg/reconcilers/workloads/resources_test.go @@ -36,7 +36,7 @@ func (gen *TestWorkloadGenerator) Deployment() basereconciler_resources.Deployme Template: func() *appsv1.Deployment { return &appsv1.Deployment{ Spec: appsv1.DeploymentSpec{ - Replicas: pointer.Int32Ptr(1), + Replicas: pointer.Int32(1), Template: corev1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{"orig-key": "orig-value"}, @@ -72,10 +72,10 @@ func (gen *TestWorkloadGenerator) GetSelector() map[string]string { } func (gen *TestWorkloadGenerator) HPASpec() *saasv1alpha1.HorizontalPodAutoscalerSpec { return &saasv1alpha1.HorizontalPodAutoscalerSpec{ - MinReplicas: pointer.Int32Ptr(1), - MaxReplicas: pointer.Int32Ptr(2), - ResourceUtilization: pointer.Int32Ptr(90), - ResourceName: pointer.StringPtr("cpu"), + MinReplicas: pointer.Int32(1), + MaxReplicas: pointer.Int32(2), + ResourceUtilization: pointer.Int32(90), + ResourceName: pointer.String("cpu"), } } func (gen *TestWorkloadGenerator) PDBSpec() *saasv1alpha1.PodDisruptionBudgetSpec { diff --git a/pkg/reconcilers/workloads/test/test_controller.go b/pkg/reconcilers/workloads/test/test_controller.go index c2382e08..761f17a5 100644 --- a/pkg/reconcilers/workloads/test/test_controller.go +++ b/pkg/reconcilers/workloads/test/test_controller.go @@ -165,7 +165,7 @@ func (gen *TestWorkloadGenerator) Deployment() resources.DeploymentTemplate { Template: func() *appsv1.Deployment { return &appsv1.Deployment{ Spec: appsv1.DeploymentSpec{ - Replicas: pointer.Int32Ptr(1), + Replicas: pointer.Int32(1), Template: corev1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{"orig-key": "orig-value"}, @@ -202,10 +202,10 @@ func (gen *TestWorkloadGenerator) GetSelector() map[string]string { } func (gen *TestWorkloadGenerator) HPASpec() *saasv1alpha1.HorizontalPodAutoscalerSpec { return &saasv1alpha1.HorizontalPodAutoscalerSpec{ - MinReplicas: pointer.Int32Ptr(1), - MaxReplicas: pointer.Int32Ptr(2), - ResourceUtilization: pointer.Int32Ptr(90), - ResourceName: pointer.StringPtr("cpu"), + MinReplicas: pointer.Int32(1), + MaxReplicas: pointer.Int32(2), + ResourceUtilization: pointer.Int32(90), + ResourceName: pointer.String("cpu"), } } func (gen *TestWorkloadGenerator) PDBSpec() *saasv1alpha1.PodDisruptionBudgetSpec { diff --git a/pkg/resource_builders/envoyconfig/resource.go b/pkg/resource_builders/envoyconfig/resource.go index d6fafcec..f2ccb81b 100644 --- a/pkg/resource_builders/envoyconfig/resource.go +++ b/pkg/resource_builders/envoyconfig/resource.go @@ -92,7 +92,7 @@ func newFromProtos(key types.NamespacedName, nodeID string, resources []envoy.Re Namespace: key.Namespace, }, Spec: marin3rv1alpha1.EnvoyConfigSpec{ - EnvoyAPI: pointer.StringPtr(envoy.APIv3.String()), + EnvoyAPI: pointer.String(envoy.APIv3.String()), NodeID: nodeID, Serialization: pointer.String(string(envoy_serializer.YAML)), EnvoyResources: &marin3rv1alpha1.EnvoyResources{ diff --git a/pkg/resource_builders/envoyconfig/resource_test.go b/pkg/resource_builders/envoyconfig/resource_test.go index aacb1afe..f0366672 100644 --- a/pkg/resource_builders/envoyconfig/resource_test.go +++ b/pkg/resource_builders/envoyconfig/resource_test.go @@ -260,7 +260,7 @@ func Test_newFromProtos(t *testing.T) { Spec: marin3rv1alpha1.EnvoyConfigSpec{ NodeID: "test", Serialization: pointer.String(string(envoy_serializer.YAML)), - EnvoyAPI: pointer.StringPtr(envoy.APIv3.String()), + EnvoyAPI: pointer.String(envoy.APIv3.String()), EnvoyResources: &marin3rv1alpha1.EnvoyResources{ Clusters: []marin3rv1alpha1.EnvoyResource{{ Value: heredoc.Doc(` diff --git a/pkg/resource_builders/marin3r/util_test.go b/pkg/resource_builders/marin3r/util_test.go index 03caaf4b..23f37abf 100644 --- a/pkg/resource_builders/marin3r/util_test.go +++ b/pkg/resource_builders/marin3r/util_test.go @@ -33,9 +33,9 @@ func TestEnableSidecar(t *testing.T) { }, }, spec: saasv1alpha1.Marin3rSidecarSpec{ - EnvoyAPIVersion: pointer.StringPtr("xx"), - EnvoyImage: pointer.StringPtr("image"), - NodeID: pointer.StringPtr("node-id"), + EnvoyAPIVersion: pointer.String("xx"), + EnvoyImage: pointer.String("image"), + NodeID: pointer.String("node-id"), ShutdownManagerPort: func() *uint32 { var v uint32 = 5000; return &v }(), ShutdownManagerExtraLifecycleHooks: []string{"container1", "container2"}, Ports: []saasv1alpha1.SidecarPort{ @@ -123,7 +123,7 @@ func TestEnableSidecar(t *testing.T) { }, }, spec: saasv1alpha1.Marin3rSidecarSpec{ - EnvoyImage: pointer.StringPtr("image"), + EnvoyImage: pointer.String("image"), ExtraPodAnnotations: map[string]string{ "marin3r.3scale.net/envoy-image": "override", }, diff --git a/pkg/resource_builders/pod/environment_test.go b/pkg/resource_builders/pod/environment_test.go index 1c6a20e1..f04af3c3 100644 --- a/pkg/resource_builders/pod/environment_test.go +++ b/pkg/resource_builders/pod/environment_test.go @@ -73,7 +73,7 @@ func TestSecretValue_ToEnvVar(t *testing.T) { }, { name: "Returns EnvVar from an overrided Secret", - fields: fields{Value: saasv1alpha1.SecretReference{Override: pointer.StringPtr("override")}}, + fields: fields{Value: saasv1alpha1.SecretReference{Override: pointer.String("override")}}, args: args{key: "key:my-secret"}, want: corev1.EnvVar{Name: "key", Value: "override"}, }, @@ -145,7 +145,7 @@ func TestBuildEnvironment(t *testing.T) { Option3 EnvVarValue `env:"OPTION3" secret:"my-secret"` }{ Option1: &ClearTextValue{Value: "value1"}, - Option2: &SecretValue{Value: v1alpha1.SecretReference{Override: pointer.StringPtr("override")}}, + Option2: &SecretValue{Value: v1alpha1.SecretReference{Override: pointer.String("override")}}, Option3: &SecretValue{Value: v1alpha1.SecretReference{}}, }, }, diff --git a/pkg/resource_builders/pod/externalsecrets_test.go b/pkg/resource_builders/pod/externalsecrets_test.go index cd311769..41bd9c4a 100644 --- a/pkg/resource_builders/pod/externalsecrets_test.go +++ b/pkg/resource_builders/pod/externalsecrets_test.go @@ -211,7 +211,7 @@ func Test_keysSlice(t *testing.T) { Option2: &SecretValue{Value: saasv1alpha1.SecretReference{ FromVault: &saasv1alpha1.VaultSecretReference{Key: "key2", Path: "path2"}}}, Option3: &SecretValue{Value: saasv1alpha1.SecretReference{ - Override: pointer.StringPtr("override")}}, + Override: pointer.String("override")}}, Option4: &SecretValue{Value: saasv1alpha1.SecretReference{ FromVault: &saasv1alpha1.VaultSecretReference{Key: "key4", Path: "path4"}}}, }, diff --git a/pkg/resource_builders/twemproxy/util_test.go b/pkg/resource_builders/twemproxy/util_test.go index 956d5394..5091478c 100644 --- a/pkg/resource_builders/twemproxy/util_test.go +++ b/pkg/resource_builders/twemproxy/util_test.go @@ -44,22 +44,22 @@ func Test_AddTwemproxySidecar(t *testing.T) { Image: &saasv1alpha1.ImageSpec{ Name: pointer.String("twemproxy"), Tag: pointer.String("latest"), - PullPolicy: (*corev1.PullPolicy)(pointer.StringPtr(string(corev1.PullIfNotPresent))), + PullPolicy: (*corev1.PullPolicy)(pointer.String(string(corev1.PullIfNotPresent))), }, Resources: &saasv1alpha1.ResourceRequirementsSpec{}, LivenessProbe: &saasv1alpha1.ProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(1), - TimeoutSeconds: pointer.Int32Ptr(3), - PeriodSeconds: pointer.Int32Ptr(5), - SuccessThreshold: pointer.Int32Ptr(1), - FailureThreshold: pointer.Int32Ptr(3), + InitialDelaySeconds: pointer.Int32(1), + TimeoutSeconds: pointer.Int32(3), + PeriodSeconds: pointer.Int32(5), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(3), }, ReadinessProbe: &saasv1alpha1.ProbeSpec{ - InitialDelaySeconds: pointer.Int32Ptr(1), - TimeoutSeconds: pointer.Int32Ptr(3), - PeriodSeconds: pointer.Int32Ptr(5), - SuccessThreshold: pointer.Int32Ptr(1), - FailureThreshold: pointer.Int32Ptr(3), + InitialDelaySeconds: pointer.Int32(1), + TimeoutSeconds: pointer.Int32(3), + PeriodSeconds: pointer.Int32(5), + SuccessThreshold: pointer.Int32(1), + FailureThreshold: pointer.Int32(3), }, TwemproxyConfigRef: "twem-config", Options: &saasv1alpha1.TwemproxyOptions{ diff --git a/pkg/version/version.go b/pkg/version/version.go index 33150336..0f230164 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -1,7 +1,7 @@ package version const ( - version string = "v0.19.6" + version string = "v0.19.7" ) // Current returns the current marin3r operator version diff --git a/test/e2e/suite_test.go b/test/e2e/suite_test.go index 454017bf..e7a056c8 100644 --- a/test/e2e/suite_test.go +++ b/test/e2e/suite_test.go @@ -67,7 +67,7 @@ var _ = BeforeSuite(func() { By("bootstrapping test environment") testEnv = &envtest.Environment{ - UseExistingCluster: pointer.BoolPtr(true), + UseExistingCluster: pointer.Bool(true), } // cfg is defined in this file globally. diff --git a/test/util/assert.go b/test/util/assert.go index d8da0870..a0530205 100644 --- a/test/util/assert.go +++ b/test/util/assert.go @@ -71,9 +71,9 @@ func (ew *ExpectedWorkload) Assert(c client.Client, dep *appsv1.Deployment, time if ew.HPA { Expect(hpa.Spec.ScaleTargetRef.Kind).Should(Equal("Deployment")) Expect(hpa.Spec.ScaleTargetRef.Name).Should(Equal(ew.Name)) - Expect(hpa.Spec.MinReplicas).Should(Equal(pointer.Int32Ptr(ew.Replicas))) + Expect(hpa.Spec.MinReplicas).Should(Equal(pointer.Int32(ew.Replicas))) } else { - Expect(dep.Spec.Replicas).To(Equal(pointer.Int32Ptr(ew.Replicas))) + Expect(dep.Spec.Replicas).To(Equal(pointer.Int32(ew.Replicas))) } pdb := &policyv1.PodDisruptionBudget{}