Skip to content

Commit

Permalink
Fix resources limits conversion in ToInt64() (elastic#5596)
Browse files Browse the repository at this point in the history
  • Loading branch information
thbkrkr authored and fantapsody committed Jan 3, 2023
1 parent 04a85d4 commit a923501
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pkg/controller/autoscaling/elasticsearch/resources/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,20 +316,20 @@ func (nr NodeResources) ToInt64() NodeResourcesInt64 {
Requests: make(ResourceListInt64),
Limits: make(ResourceListInt64),
}
for resource, value := range nr.Requests {
switch resource {
for res, value := range nr.Requests {
switch res {
case corev1.ResourceCPU:
rs64.Requests[resource] = value.MilliValue()
rs64.Requests[res] = value.MilliValue()
default:
rs64.Requests[resource] = value.Value()
rs64.Requests[res] = value.Value()
}
}
for resource, value := range nr.Limits {
switch resource {
for res, value := range nr.Limits {
switch res {
case corev1.ResourceCPU:
rs64.Requests[resource] = value.MilliValue()
rs64.Limits[res] = value.MilliValue()
default:
rs64.Requests[resource] = value.Value()
rs64.Limits[res] = value.Value()
}
}
return rs64
Expand Down

0 comments on commit a923501

Please sign in to comment.