From 550b052ca9af54dc931a4be134ac76ae4bc7ee6c Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Wed, 7 Jun 2023 23:05:30 +0800 Subject: [PATCH] Register gRPC plugin after reading configmap (#564) Signed-off-by: Kevin Su --- flytepropeller/go.mod | 4 ++-- flytepropeller/go.sum | 8 ++++---- flytepropeller/pkg/controller/nodes/task/plugin_config.go | 6 ++++++ flytepropeller/plugins/loader.go | 1 - 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/flytepropeller/go.mod b/flytepropeller/go.mod index 118f6e4fd2..0727e71a81 100644 --- a/flytepropeller/go.mod +++ b/flytepropeller/go.mod @@ -6,8 +6,8 @@ require ( github.com/DiSiqueira/GoTree v1.0.1-0.20180907134536-53a8e837f295 github.com/benlaurie/objecthash v0.0.0-20180202135721-d1e3d6079fc1 github.com/fatih/color v1.13.0 - github.com/flyteorg/flyteidl v1.5.2 - github.com/flyteorg/flyteplugins v1.0.63 + github.com/flyteorg/flyteidl v1.5.10 + github.com/flyteorg/flyteplugins v1.0.64 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 98cb6acc63..f172dcae34 100644 --- a/flytepropeller/go.sum +++ b/flytepropeller/go.sum @@ -260,10 +260,10 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/flyteorg/flyteidl v1.5.2 h1:DZPzYkTg92qA4e17fd0ZW1M+gh1gJKh/VOK+F4bYgM8= -github.com/flyteorg/flyteidl v1.5.2/go.mod h1:ckLjB51moX4L0oQml+WTCrPK50zrJf6IZJ6LPC0RB4I= -github.com/flyteorg/flyteplugins v1.0.63 h1:9qLUWQz+ReDmXpkWRd0F72jRE7wh5U/L4Iu/hsH9iNw= -github.com/flyteorg/flyteplugins v1.0.63/go.mod h1:RUQgydOtY+8dkOdV0orxDdAyAyQT6EIz4qdvHO5h6R8= +github.com/flyteorg/flyteidl v1.5.10 h1:SHeiaWRt8EAVuFsat+BJswtc07HTZ4DqhfTEYSm621k= +github.com/flyteorg/flyteidl v1.5.10/go.mod h1:EtE/muM2lHHgBabjYcxqe9TWeJSL0kXwbI0RgVwI4Og= +github.com/flyteorg/flyteplugins v1.0.64 h1:t9S59C0s2nXsUEqKbQZJYHQzSfkhjJh1dcXlBlxhEUk= +github.com/flyteorg/flyteplugins v1.0.64/go.mod h1:HHt4nKDKVwrZPKDsj99dNtDSIJL378xNotYMA3a/TFA= 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/controller/nodes/task/plugin_config.go b/flytepropeller/pkg/controller/nodes/task/plugin_config.go index e6f546219d..07f6d3a7a4 100644 --- a/flytepropeller/pkg/controller/nodes/task/plugin_config.go +++ b/flytepropeller/pkg/controller/nodes/task/plugin_config.go @@ -4,21 +4,27 @@ import ( "context" "fmt" "strings" + "sync" "github.com/flyteorg/flytepropeller/pkg/controller/nodes/task/backoff" "github.com/flyteorg/flyteplugins/go/tasks/pluginmachinery/core" "github.com/flyteorg/flytestdlib/logger" + "github.com/flyteorg/flyteplugins/go/tasks/plugins/webapi/agent" "github.com/flyteorg/flytepropeller/pkg/controller/nodes/task/config" "github.com/flyteorg/flytepropeller/pkg/controller/nodes/task/k8s" ) +var once sync.Once + func WranglePluginsAndGenerateFinalList(ctx context.Context, cfg *config.TaskPluginConfig, pr PluginRegistryIface) (enabledPlugins []core.PluginEntry, defaultForTaskTypes map[pluginID][]taskType, err error) { if cfg == nil { return nil, nil, fmt.Errorf("unable to initialize plugin list, cfg is a required argument") } + // Register the GRPC plugin after the config is loaded + once.Do(func() { agent.RegisterAgentPlugin() }) pluginsConfigMeta, err := cfg.GetEnabledPlugins() if err != nil { return nil, nil, err diff --git a/flytepropeller/plugins/loader.go b/flytepropeller/plugins/loader.go index 388367ba37..68635dc786 100644 --- a/flytepropeller/plugins/loader.go +++ b/flytepropeller/plugins/loader.go @@ -17,6 +17,5 @@ import ( _ "github.com/flyteorg/flyteplugins/go/tasks/plugins/webapi/athena" _ "github.com/flyteorg/flyteplugins/go/tasks/plugins/webapi/bigquery" _ "github.com/flyteorg/flyteplugins/go/tasks/plugins/webapi/databricks" - _ "github.com/flyteorg/flyteplugins/go/tasks/plugins/webapi/grpc" _ "github.com/flyteorg/flyteplugins/go/tasks/plugins/webapi/snowflake" )