Skip to content

Commit

Permalink
scheduler support ephemeral-storage resources
Browse files Browse the repository at this point in the history
Signed-off-by: wulixuan <[email protected]>
  • Loading branch information
wulixuan committed Sep 30, 2022
1 parent c1537d5 commit e916867
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions pkg/scheduler/api/resource_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ func NewResource(rl v1.ResourceList) *Resource {
r.Memory += float64(rQuant.Value())
case v1.ResourcePods:
r.MaxTaskNum += int(rQuant.Value())
case v1.ResourceEphemeralStorage:
r.AddScalar(rName, float64(rQuant.MilliValue()))
default:
if IsCountQuota(rName) {
continue
Expand Down
10 changes: 7 additions & 3 deletions pkg/scheduler/api/resource_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,15 @@ func TestNewResource(t *testing.T) {
v1.ResourceMemory: *resource.NewQuantity(2000, resource.BinarySI),
"scalar.test/" + "scalar1": *resource.NewQuantity(1, resource.DecimalSI),
v1.ResourceHugePagesPrefix + "test": *resource.NewQuantity(2, resource.BinarySI),
v1.ResourceEphemeralStorage: *resource.NewQuantity(3, resource.BinarySI),
},
expected: &Resource{
MilliCPU: 4,
Memory: 2000,
ScalarResources: map[v1.ResourceName]float64{"scalar.test/scalar1": 1000, "hugepages-test": 2000},
MilliCPU: 4,
Memory: 2000,
ScalarResources: map[v1.ResourceName]float64{
"scalar.test/scalar1": 1000,
"hugepages-test": 2000,
v1.ResourceEphemeralStorage: 3000},
},
},
}
Expand Down

0 comments on commit e916867

Please sign in to comment.