Skip to content

Commit

Permalink
Add FlyteAgent Default Service Config Using Round Robin Mechanism
Browse files Browse the repository at this point in the history
Signed-off-by: Future-Outlier <[email protected]>
  • Loading branch information
Future-Outlier committed Jan 17, 2025
1 parent ab463c3 commit a433b33
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
7 changes: 4 additions & 3 deletions flyteplugins/go/tasks/plugins/webapi/agent/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ var (
},
},
DefaultAgent: Deployment{
Endpoint: "",
Insecure: true,
DefaultTimeout: config.Duration{Duration: 10 * time.Second},
Endpoint: "",
Insecure: true,
DefaultTimeout: config.Duration{Duration: 10 * time.Second},
DefaultServiceConfig: `{"loadBalancingConfig": [{"round_robin":{}}]}`,
},
// AsyncPlugin should be registered to at least one task type.
// Reference: https://github.com/flyteorg/flyte/blob/master/flyteplugins/go/tasks/pluginmachinery/registry.go#L27
Expand Down
20 changes: 20 additions & 0 deletions flyteplugins/go/tasks/plugins/webapi/agent/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,23 @@ func TestGetAndSetConfig(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, &cfg, GetConfig())
}

func TestDefaultAgentConfig(t *testing.T) {
cfg := defaultConfig

assert.Equal(t, "", cfg.DefaultAgent.Endpoint)
assert.True(t, cfg.DefaultAgent.Insecure)
assert.Equal(t, 10*time.Second, cfg.DefaultAgent.DefaultTimeout.Duration)
assert.Equal(t, `{"loadBalancingConfig": [{"round_robin":{}}]}`, cfg.DefaultAgent.DefaultServiceConfig)

assert.Empty(t, cfg.DefaultAgent.Timeouts)

expectedTaskTypes := []string{"task_type_1", "task_type_2"}
assert.Equal(t, expectedTaskTypes, cfg.SupportedTaskTypes)

assert.Empty(t, cfg.AgentDeployments)

assert.Empty(t, cfg.AgentForTaskTypes)

assert.Equal(t, 10*time.Second, cfg.PollInterval.Duration)
}

0 comments on commit a433b33

Please sign in to comment.