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

Commit

Permalink
Remove resource injection on the node for container task (#544)
Browse files Browse the repository at this point in the history
* Remove resource injection on the node for container task

Signed-off-by: byhsu <byhsu@linkedin.com>

* fix conflict

Signed-off-by: byhsu <byhsu@linkedin.com>

* fix lint

Signed-off-by: byhsu <byhsu@linkedin.com>

* downgrade plugin

Signed-off-by: byhsu <byhsu@linkedin.com>

---------

Signed-off-by: byhsu <byhsu@linkedin.com>
Co-authored-by: byhsu <byhsu@linkedin.com>
  • Loading branch information
ByronHsu and byhsu committed Apr 11, 2023
1 parent 7abdcd7 commit ef164c5
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 33 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/benlaurie/objecthash v0.0.0-20180202135721-d1e3d6079fc1
github.com/fatih/color v1.13.0
github.com/flyteorg/flyteidl v1.3.14
github.com/flyteorg/flyteplugins v1.0.45
github.com/flyteorg/flyteplugins v1.0.47
github.com/flyteorg/flytestdlib v1.0.15
github.com/ghodss/yaml v1.0.0
github.com/go-redis/redis v6.15.7+incompatible
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYF
github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/flyteorg/flyteidl v1.3.14 h1:o5M0g/r6pXTPu5PEurbYxbQmuOu3hqqsaI2M6uvK0N8=
github.com/flyteorg/flyteidl v1.3.14/go.mod h1:Pkt2skI1LiHs/2ZoekBnyPhuGOFMiuul6HHcKGZBsbM=
github.com/flyteorg/flyteplugins v1.0.45 h1:I/N4ehOxX6ln8DivyZ9gayp/UYiBcqoizBbG1hfwIXM=
github.com/flyteorg/flyteplugins v1.0.45/go.mod h1:ztsonku5fKwyxcIg1k69PTiBVjRI6d3nK5DnC+iwx08=
github.com/flyteorg/flyteplugins v1.0.47 h1:+SnRM7Z257xiIg5B5i3gLJxEUtZJlEyrzCPCAMolsug=
github.com/flyteorg/flyteplugins v1.0.47/go.mod h1:ztsonku5fKwyxcIg1k69PTiBVjRI6d3nK5DnC+iwx08=
github.com/flyteorg/flytestdlib v1.0.15 h1:kv9jDQmytbE84caY+pkZN8trJU2ouSAmESzpTEhfTt0=
github.com/flyteorg/flytestdlib v1.0.15/go.mod h1:ghw/cjY0sEWIIbyCtcJnL/Gt7ZS7gf9SUi0CCPhbz3s=
github.com/flyteorg/stow v0.3.6 h1:jt50ciM14qhKBaIrB+ppXXY+SXB59FNREFgTJqCyqIk=
Expand Down
2 changes: 0 additions & 2 deletions pkg/compiler/transformers/k8s/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ func buildNodeSpec(n *core.Node, tasks []*core.CompiledTask, errs errors.Compile

if n.GetTaskNode().Overrides != nil && n.GetTaskNode().Overrides.Resources != nil {
resources = n.GetTaskNode().Overrides.Resources
} else {
resources = getResources(task)
}
}

Expand Down
16 changes: 0 additions & 16 deletions pkg/compiler/transformers/k8s/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,6 @@ func TestBuildNodeSpec(t *testing.T) {
mustBuild(t, n, 1, errs.NewScope())
})

t.Run("Task with resources", func(t *testing.T) {
expectedCPU := resource.MustParse("10Mi")
n.Node.Target = &core.Node_TaskNode{
TaskNode: &core.TaskNode{
Reference: &core.TaskNode_ReferenceId{
ReferenceId: &core.Identifier{Name: "ref_2"},
},
},
}

spec := mustBuild(t, n, 1, errs.NewScope())
assert.NotNil(t, spec.Resources)
assert.NotNil(t, spec.Resources.Requests.Cpu())
assert.Equal(t, expectedCPU.Value(), spec.Resources.Requests.Cpu().Value())
})

t.Run("node with resource overrides", func(t *testing.T) {
expectedCPU := resource.MustParse("20Mi")
n.Node.Target = &core.Node_TaskNode{
Expand Down
12 changes: 0 additions & 12 deletions pkg/compiler/transformers/k8s/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,6 @@ func computeDeadline(n *core.Node) (*v1.Duration, error) {
return deadline, nil
}

func getResources(task *core.TaskTemplate) *core.Resources {
if task == nil {
return nil
}

if task.GetContainer() == nil {
return nil
}

return task.GetContainer().Resources
}

func toAliasValueArray(aliases []*core.Alias) []v1alpha1.Alias {
if aliases == nil {
return nil
Expand Down

0 comments on commit ef164c5

Please sign in to comment.