Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add autoscaler api for solr #1330

Merged
merged 5 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading