Skip to content

Commit

Permalink
Add autoscaler api for solr (#1330)
Browse files Browse the repository at this point in the history
* Update autoscaler api for solr

Signed-off-by: pritamdas99 <[email protected]>
  • Loading branch information
pritamdas99 authored Nov 7, 2024
1 parent 3a305bf commit 51975b8
Show file tree
Hide file tree
Showing 7 changed files with 368 additions and 13 deletions.
41 changes: 38 additions & 3 deletions apis/autoscaling/v1alpha1/openapi_generated.go

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

13 changes: 11 additions & 2 deletions apis/autoscaling/v1alpha1/solr_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,20 @@ type SolrComputeAutoscalerSpec struct {
// +optional
NodeTopology *NodeTopology `json:"nodeTopology,omitempty"`

Solr *ComputeAutoscalerSpec `json:"solr,omitempty"`
Node *ComputeAutoscalerSpec `json:"node,omitempty"`
Overseer *ComputeAutoscalerSpec `json:"overseer,omitempty"`
Data *ComputeAutoscalerSpec `json:"data,omitempty"`
Coordinator *ComputeAutoscalerSpec `json:"coordinator,omitempty"`
}

type SolrStorageAutoscalerSpec struct {
Solr *StorageAutoscalerSpec `json:"solr,omitempty"`
// +optional
NodeTopology *NodeTopology `json:"nodeTopology,omitempty"`

Node *StorageAutoscalerSpec `json:"node,omitempty"`
Overseer *StorageAutoscalerSpec `json:"overseer,omitempty"`
Data *StorageAutoscalerSpec `json:"data,omitempty"`
Coordinator *StorageAutoscalerSpec `json:"coordinator,omitempty"`
}

type SolrOpsRequestOptions struct {
Expand Down
10 changes: 8 additions & 2 deletions apis/autoscaling/v1alpha1/solr_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,17 @@ func (r *SolrAutoscaler) setDefaults() {
r.setOpsReqOptsDefaults()

if r.Spec.Storage != nil {
setDefaultStorageValues(r.Spec.Storage.Solr)
setDefaultStorageValues(r.Spec.Storage.Node)
setDefaultStorageValues(r.Spec.Storage.Overseer)
setDefaultStorageValues(r.Spec.Storage.Data)
setDefaultStorageValues(r.Spec.Storage.Coordinator)
}

if r.Spec.Compute != nil {
setDefaultComputeValues(r.Spec.Compute.Solr)
setDefaultStorageValues(r.Spec.Storage.Node)
setDefaultStorageValues(r.Spec.Storage.Overseer)
setDefaultStorageValues(r.Spec.Storage.Data)
setDefaultStorageValues(r.Spec.Storage.Coordinator)
}
}

Expand Down
43 changes: 39 additions & 4 deletions apis/autoscaling/v1alpha1/zz_generated.deepcopy.go

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

16 changes: 16 additions & 0 deletions apis/kubedb/v1alpha2/solr_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,22 @@ func (s *Solr) PVCName(alias string) string {
return meta_util.NameWithSuffix(s.Name, alias)
}

func (s Solr) NodeRoleSpecificLabelKey(roleType SolrNodeRoleType) string {
return kubedb.GroupName + "/role-" + string(roleType)
}

func (s Solr) OverseerSelectors() map[string]string {
return s.OffshootSelectors(map[string]string{string(SolrNodeRoleOverseer): SolrNodeRoleSet})
}

func (s Solr) DataSelectors() map[string]string {
return s.OffshootSelectors(map[string]string{string(SolrNodeRoleData): SolrNodeRoleSet})
}

func (s Solr) CoordinatorSelectors() map[string]string {
return s.OffshootSelectors(map[string]string{string(SolrNodeRoleCoordinator): SolrNodeRoleSet})
}

func (s *Solr) SetDefaults() {
if s.Spec.DeletionPolicy == "" {
s.Spec.DeletionPolicy = TerminationPolicyDelete
Expand Down
1 change: 1 addition & 0 deletions apis/kubedb/v1alpha2/solr_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ const (
SolrNodeRoleOverseer SolrNodeRoleType = "overseer"
SolrNodeRoleData SolrNodeRoleType = "data"
SolrNodeRoleCoordinator SolrNodeRoleType = "coordinator"
SolrNodeRoleCombined SolrNodeRoleType = "combined"
SolrNodeRoleSet = "set"
)

Expand Down
Loading

0 comments on commit 51975b8

Please sign in to comment.