Skip to content

Commit

Permalink
Add SingleStore Ops-Request API (#1211)
Browse files Browse the repository at this point in the history
Signed-off-by: ashraful <[email protected]>
  • Loading branch information
AshrafulHaqueToni authored May 30, 2024
1 parent 2c4d34e commit 85c1f2a
Show file tree
Hide file tree
Showing 24 changed files with 1,823 additions and 33 deletions.
12 changes: 6 additions & 6 deletions apis/kubedb/v1alpha2/openapi_generated.go

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

3 changes: 0 additions & 3 deletions apis/kubedb/v1alpha2/singlestore_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,6 @@ func (s *Singlestore) SetDefaults() {
}

if s.Spec.Topology == nil {
if s.Spec.Replicas == nil {
s.Spec.Replicas = pointer.Int32P(1)
}
if s.Spec.PodTemplate == nil {
s.Spec.PodTemplate = &ofst.PodTemplateSpec{}
}
Expand Down
8 changes: 5 additions & 3 deletions apis/kubedb/v1alpha2/singlestore_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ type SinglestoreSpec struct {
// +optional
Version string `json:"version"`

// +optional
Replicas *int32 `json:"replicas,omitempty"`

// Singlestore topology for node specification
// +optional
Topology *SinglestoreTopology `json:"topology,omitempty"`
Expand Down Expand Up @@ -137,6 +134,11 @@ type SinglestoreNode struct {
// +optional
Suffix string `json:"suffix,omitempty"`

// ConfigSecret is an optional field to provide custom configuration file for database (i.e config.properties).
// If specified, this file will be used as configuration file otherwise default configuration file will be used.
// +optional
ConfigSecret *core.LocalObjectReference `json:"configSecret,omitempty"`

// Storage to specify how storage shall be used.
// +optional
Storage *core.PersistentVolumeClaimSpec `json:"storage,omitempty"`
Expand Down
13 changes: 0 additions & 13 deletions apis/kubedb/v1alpha2/singlestore_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,7 @@ func (s *Singlestore) ValidateCreate() (admission.Warnings, error) {
func (s *Singlestore) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
singlestorelog.Info("validate update", "name", s.Name)

oldConnect := old.(*Singlestore)
allErr := s.ValidateCreateOrUpdate()

if s.Spec.Topology == nil && *oldConnect.Spec.Replicas == 1 && *s.Spec.Replicas > 1 {
allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("replicas"),
s.Name,
"Cannot scale up from 1 to more than 1 in standalone mode"))
}

if len(allErr) == 0 {
return nil, nil
}
Expand Down Expand Up @@ -111,11 +103,6 @@ func (s *Singlestore) ValidateCreateOrUpdate() field.ErrorList {
}

if s.Spec.Topology == nil {
if *s.Spec.Replicas != 1 {
allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("replicas"),
s.Name,
"number of replicas for standalone must be one "))
}
err := sdbValidateVolumes(s.Spec.PodTemplate)
if err != nil {
allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("podTemplate").Child("spec").Child("volumes"),
Expand Down
10 changes: 5 additions & 5 deletions apis/kubedb/v1alpha2/zz_generated.deepcopy.go

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

6 changes: 6 additions & 0 deletions apis/ops/v1alpha1/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,3 +287,9 @@ const (
HorizontalScaleSentinelUp = "HorizontalScaleSentinelUp"
HorizontalScaleSentinelDown = "HorizontalScaleSentinelDown"
)

// SingleStore Constants
const (
UpdateAggregatorNodePVCs = "UpdateAggregatorNodePVCs"
UpdateLeafNodePVCs = "UpdateLeafNodePVCs"
)
Loading

0 comments on commit 85c1f2a

Please sign in to comment.