Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Add ephemeral storage to node resource requirements
Browse files Browse the repository at this point in the history
Signed-off-by: Katrina Rogan <katroganGH@gmail.com>
  • Loading branch information
katrogan committed Aug 10, 2021
1 parent 5fe91f3 commit 7bd2037
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/utils/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ func ToK8sResourceList(resources []*core.Resources_ResourceEntry) (v1.ResourceLi
if !v.IsZero() {
k8sResources[ResourceNvidiaGPU] = v
}
case core.Resources_EPHEMERAL_STORAGE:
if !v.IsZero() {
k8sResources[v1.ResourceEphemeralStorage] = v
}
}
}
return k8sResources, nil
Expand Down
2 changes: 2 additions & 0 deletions pkg/utils/k8s_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func TestToK8sResourceList(t *testing.T) {
{Name: core.Resources_GPU, Value: "1"},
{Name: core.Resources_MEMORY, Value: "1024Mi"},
{Name: core.Resources_STORAGE, Value: "1024Mi"},
{Name: core.Resources_EPHEMERAL_STORAGE, Value: "1024Mi"},
})

assert.NoError(t, err)
Expand All @@ -46,6 +47,7 @@ func TestToK8sResourceList(t *testing.T) {
assert.Equal(t, resource.MustParse("1"), r[ResourceNvidiaGPU])
assert.Equal(t, resource.MustParse("1024Mi"), r[v1.ResourceMemory])
assert.Equal(t, resource.MustParse("1024Mi"), r[v1.ResourceStorage])
assert.Equal(t, resource.MustParse("1024Mi"), r[v1.ResourceEphemeralStorage])
}
{
r, err := ToK8sResourceList([]*core.Resources_ResourceEntry{})
Expand Down

0 comments on commit 7bd2037

Please sign in to comment.