diff --git a/pkg/manager/impl/execution_manager.go b/pkg/manager/impl/execution_manager.go index 2c924a63c3..e7469388aa 100644 --- a/pkg/manager/impl/execution_manager.go +++ b/pkg/manager/impl/execution_manager.go @@ -408,8 +408,9 @@ func (m *ExecutionManager) setCompiledTaskDefaults(ctx context.Context, task *co if resource != nil && resource.Attributes != nil && resource.Attributes.GetTaskResourceAttributes() != nil { taskResourceSpec = resource.Attributes.GetTaskResourceAttributes().Limits } + task.Template.GetContainer().Resources.Limits = assignResourcesIfUnset( - ctx, task.Template.Id, createTaskDefaultLimits(ctx, task, m.config.TaskResourceConfiguration().GetLimits()), task.Template.GetContainer().Resources.Limits, + ctx, task.Template.Id, createTaskDefaultLimits(ctx, task, m.config.TaskResourceConfiguration().GetDefaults()), task.Template.GetContainer().Resources.Limits, taskResourceSpec) checkTaskRequestsLessThanLimits(ctx, task.Template.Id, task.Template.GetContainer().Resources) } diff --git a/pkg/manager/impl/execution_manager_test.go b/pkg/manager/impl/execution_manager_test.go index 280f0b6e71..a7d9b94b92 100644 --- a/pkg/manager/impl/execution_manager_test.go +++ b/pkg/manager/impl/execution_manager_test.go @@ -277,7 +277,7 @@ func TestCreateExecution(t *testing.T) { for _, task := range tasks { assert.EqualValues(t, resources.Requests, task.Template.GetContainer().Resources.Requests) - assert.EqualValues(t, resources.Limits, + assert.EqualValues(t, resources.Requests, task.Template.GetContainer().Resources.Limits) } return &workflowengineInterfaces.ExecutionInfo{ @@ -2933,15 +2933,15 @@ func TestSetDefaults(t *testing.T) { Limits: []*core.Resources_ResourceEntry{ { Name: core.Resources_CPU, - Value: "300m", + Value: "200m", }, { Name: core.Resources_MEMORY, - Value: "500Gi", + Value: "200Gi", }, { Name: core.Resources_EPHEMERAL_STORAGE, - Value: "501Mi", + Value: "500Mi", }, }, }, @@ -3004,7 +3004,7 @@ func TestSetDefaults_MissingDefaults(t *testing.T) { Limits: []*core.Resources_ResourceEntry{ { Name: core.Resources_CPU, - Value: "300m", + Value: "200m", }, { Name: core.Resources_MEMORY,