diff --git a/apis/kubedb/v1alpha2/openapi_generated.go b/apis/kubedb/v1alpha2/openapi_generated.go index 96a6b3b98c..04e0994625 100644 --- a/apis/kubedb/v1alpha2/openapi_generated.go +++ b/apis/kubedb/v1alpha2/openapi_generated.go @@ -30325,13 +30325,6 @@ func schema_apimachinery_apis_kubedb_v1alpha2_SinglestoreSpec(ref common.Referen Ref: ref("k8s.io/api/core/v1.PersistentVolumeClaimSpec"), }, }, - "enableSSL": { - SchemaProps: spec.SchemaProps{ - Description: "To enable ssl for http layer", - Type: []string{"boolean"}, - Format: "", - }, - }, "init": { SchemaProps: spec.SchemaProps{ Description: "Init is used to initialize database", diff --git a/apis/kubedb/v1alpha2/singlestore_helpers.go b/apis/kubedb/v1alpha2/singlestore_helpers.go index 42de018785..d1eb2e6fdc 100644 --- a/apis/kubedb/v1alpha2/singlestore_helpers.go +++ b/apis/kubedb/v1alpha2/singlestore_helpers.go @@ -21,6 +21,7 @@ import ( "fmt" "strings" + "kubedb.dev/apimachinery/apis" catalog "kubedb.dev/apimachinery/apis/catalog/v1alpha1" "kubedb.dev/apimachinery/apis/kubedb" "kubedb.dev/apimachinery/crds" @@ -277,10 +278,16 @@ func (s *Singlestore) SetDefaults() { s.setDefaultContainerSecurityContext(&sdbVersion, s.Spec.Topology.Leaf.PodTemplate) } - if s.Spec.EnableSSL { - s.SetTLSDefaults() - } + s.SetTLSDefaults() + s.SetHealthCheckerDefaults() + + if s.IsClustering() { + s.setDefaultContainerResourceLimits(s.Spec.Topology.Aggregator.PodTemplate) + s.setDefaultContainerResourceLimits(s.Spec.Topology.Leaf.PodTemplate) + } else { + s.setDefaultContainerResourceLimits(s.Spec.PodTemplate) + } } func (s *Singlestore) setDefaultContainerSecurityContext(sdbVersion *catalog.SinglestoreVersion, podTemplate *ofst.PodTemplateSpec) { @@ -379,6 +386,25 @@ func (s *Singlestore) assignDefaultContainerSecurityContext(sdbVersion *catalog. } } +func (s *Singlestore) setDefaultContainerResourceLimits(podTemplate *ofst.PodTemplateSpec) { + dbContainer := coreutil.GetContainerByName(podTemplate.Spec.Containers, SinglestoreContainerName) + if dbContainer != nil && (dbContainer.Resources.Requests == nil || dbContainer.Resources.Limits == nil) { + apis.SetDefaultResourceLimits(&dbContainer.Resources, DefaultResources) + } + + initContainer := coreutil.GetContainerByName(podTemplate.Spec.InitContainers, SinglestoreInitContainerName) + if initContainer != nil && (initContainer.Resources.Requests == nil || initContainer.Resources.Limits == nil) { + apis.SetDefaultResourceLimits(&initContainer.Resources, DefaultInitContainerResource) + } + + if s.IsClustering() { + coordinatorContainer := coreutil.GetContainerByName(podTemplate.Spec.Containers, SinglestoreCoordinatorContainerName) + if coordinatorContainer != nil && (coordinatorContainer.Resources.Requests == nil || coordinatorContainer.Resources.Limits == nil) { + apis.SetDefaultResourceLimits(&coordinatorContainer.Resources, CoordinatorDefaultResources) + } + } +} + func (s *Singlestore) SetTLSDefaults() { if s.Spec.TLS == nil || s.Spec.TLS.IssuerRef == nil { return diff --git a/apis/kubedb/v1alpha2/singlestore_types.go b/apis/kubedb/v1alpha2/singlestore_types.go index 446aaacf45..0a101bc7d9 100644 --- a/apis/kubedb/v1alpha2/singlestore_types.go +++ b/apis/kubedb/v1alpha2/singlestore_types.go @@ -70,9 +70,6 @@ type SinglestoreSpec struct { // Storage to specify how storage shall be used. Storage *core.PersistentVolumeClaimSpec `json:"storage,omitempty"` - // To enable ssl for http layer - EnableSSL bool `json:"enableSSL,omitempty"` - // Init is used to initialize database // +optional Init *InitSpec `json:"init,omitempty"` diff --git a/apis/kubedb/v1alpha2/singlestore_webhook.go b/apis/kubedb/v1alpha2/singlestore_webhook.go index 7c4c178de0..2bb627e9d8 100644 --- a/apis/kubedb/v1alpha2/singlestore_webhook.go +++ b/apis/kubedb/v1alpha2/singlestore_webhook.go @@ -97,20 +97,6 @@ func (s *Singlestore) ValidateDelete() (admission.Warnings, error) { func (s *Singlestore) ValidateCreateOrUpdate() field.ErrorList { var allErr field.ErrorList - if s.Spec.EnableSSL { - if s.Spec.TLS == nil { - allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("enableSSL"), - s.Name, - ".spec.tls can't be nil, if .spec.enableSSL is true")) - } - } else { - if s.Spec.TLS != nil { - allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("enableSSL"), - s.Name, - ".spec.tls must be nil, if .spec.enableSSL is disabled")) - } - } - if s.Spec.Version == "" { allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("version"), s.Name, diff --git a/crds/kubedb.com_singlestores.yaml b/crds/kubedb.com_singlestores.yaml index 0e44d645df..49e0156aed 100644 --- a/crds/kubedb.com_singlestores.yaml +++ b/crds/kubedb.com_singlestores.yaml @@ -55,8 +55,6 @@ spec: type: string type: object x-kubernetes-map-type: atomic - enableSSL: - type: boolean halted: type: boolean healthChecker: