From 265872411e11b77ad9936e17f642f5cf12c4c4a1 Mon Sep 17 00:00:00 2001 From: ByronHsu Date: Mon, 10 Apr 2023 17:32:53 -0700 Subject: [PATCH] Remove resource injection on the node for container task (#544) * Remove resource injection on the node for container task Signed-off-by: byhsu * fix conflict Signed-off-by: byhsu * fix lint Signed-off-by: byhsu * downgrade plugin Signed-off-by: byhsu --------- Signed-off-by: byhsu Co-authored-by: byhsu --- flytepropeller/go.mod | 2 +- flytepropeller/go.sum | 4 ++-- .../pkg/compiler/transformers/k8s/node.go | 2 -- .../pkg/compiler/transformers/k8s/node_test.go | 16 ---------------- .../pkg/compiler/transformers/k8s/utils.go | 12 ------------ 5 files changed, 3 insertions(+), 33 deletions(-) diff --git a/flytepropeller/go.mod b/flytepropeller/go.mod index ca9d98ee2..cca83ecda 100644 --- a/flytepropeller/go.mod +++ b/flytepropeller/go.mod @@ -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 diff --git a/flytepropeller/go.sum b/flytepropeller/go.sum index f84741c20..c4379d8fb 100644 --- a/flytepropeller/go.sum +++ b/flytepropeller/go.sum @@ -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= diff --git a/flytepropeller/pkg/compiler/transformers/k8s/node.go b/flytepropeller/pkg/compiler/transformers/k8s/node.go index f8d5947c9..d9ac41dd4 100644 --- a/flytepropeller/pkg/compiler/transformers/k8s/node.go +++ b/flytepropeller/pkg/compiler/transformers/k8s/node.go @@ -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) } } diff --git a/flytepropeller/pkg/compiler/transformers/k8s/node_test.go b/flytepropeller/pkg/compiler/transformers/k8s/node_test.go index 010eb0c3d..a9732d9d7 100644 --- a/flytepropeller/pkg/compiler/transformers/k8s/node_test.go +++ b/flytepropeller/pkg/compiler/transformers/k8s/node_test.go @@ -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{ diff --git a/flytepropeller/pkg/compiler/transformers/k8s/utils.go b/flytepropeller/pkg/compiler/transformers/k8s/utils.go index 1cf9a521c..5f8a0f85a 100644 --- a/flytepropeller/pkg/compiler/transformers/k8s/utils.go +++ b/flytepropeller/pkg/compiler/transformers/k8s/utils.go @@ -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