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 datanode resource limits #69

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
12 changes: 6 additions & 6 deletions pkg/k8sutil/k8sutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -800,8 +800,8 @@ func (k *K8sutil) CreateDataNodeDeployment(replicas *int32, baseImage, storageCl
volumeSize, _ := resource.ParseQuantity(dataDiskSize)

// Parse CPU / Memory
// limitCPU, _ := resource.ParseQuantity(resources.Limits.CPU)
// limitMemory, _ := resource.ParseQuantity(resources.Limits.Memory)
limitCPU, _ := resource.ParseQuantity(resources.Limits.CPU)
limitMemory, _ := resource.ParseQuantity(resources.Limits.Memory)
requestCPU, _ := resource.ParseQuantity(resources.Requests.CPU)
requestMemory, _ := resource.ParseQuantity(resources.Requests.Memory)

Expand Down Expand Up @@ -900,10 +900,10 @@ func (k *K8sutil) CreateDataNodeDeployment(replicas *int32, baseImage, storageCl
},
},
Resources: v1.ResourceRequirements{
// Limits: v1.ResourceList{
// "cpu": limitCPU,
// "memory": limitMemory,
// },
Limits: v1.ResourceList{
"cpu": limitCPU,
"memory": limitMemory,
},
Requests: v1.ResourceList{
"cpu": requestCPU,
"memory": requestMemory,
Expand Down
4 changes: 2 additions & 2 deletions pkg/processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,15 @@ func (p *Processor) processElasticSearchCluster(c *myspec.ElasticsearchCluster)
zoneDistribution := p.calculateZoneDistribution(c.Spec.DataNodeReplicas, zoneCount)

for index, count := range zoneDistribution {
p.k8sclient.CreateDataNodeDeployment(&count, baseImage, c.Spec.Zones[index], c.Spec.DataDiskSize, c.Spec.Resources,
p.k8sclient.CreateDataNodeDeployment(&count, baseImage, c.Spec.Zones[index], c.Spec.DataDiskSize, c.Spec.DataNodeResources,
c.Spec.ImagePullSecrets, c.ObjectMeta.Name, c.Spec.Instrumentation.StatsdHost, c.Spec.NetworkHost, c.ObjectMeta.Namespace)
}
} else {
// No zones defined, rely on current provisioning logic which may break. Other strategy is to use emptyDir?
// NOTE: Issue with dynamic PV provisioning (https://github.com/kubernetes/kubernetes/issues/34583)
p.k8sclient.CreateStorageClass("standard", c.Spec.Storage.StorageClassProvisoner, c.Spec.Storage.StorageType, c.ObjectMeta.Name)
p.k8sclient.CreateDataNodeDeployment(func() *int32 { i := int32(c.Spec.DataNodeReplicas); return &i }(), baseImage, "standard",
c.Spec.DataDiskSize, c.Spec.Resources, c.Spec.ImagePullSecrets, c.ObjectMeta.Name, c.Spec.Instrumentation.StatsdHost, c.Spec.NetworkHost, c.ObjectMeta.Namespace)
c.Spec.DataDiskSize, c.Spec.DataNodeResources, c.Spec.ImagePullSecrets, c.ObjectMeta.Name, c.Spec.Instrumentation.StatsdHost, c.Spec.NetworkHost, c.ObjectMeta.Namespace)
}

// Setup CronSchedule
Expand Down
3 changes: 3 additions & 0 deletions pkg/spec/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ type ClusterSpec struct {
// Resources defines memory / cpu constraints
Resources Resources `json:"resources"`

// Resources for data nodes
DataNodeResources Resources `json:"data-node-resources"`

// Instrumentation defines metrics for the cluster
Instrumentation Instrumentation `json:"instrumentation"`

Expand Down