Skip to content

Commit

Permalink
Remove DefaultForTaskType field from plugin entries (flyteorg#248)
Browse files Browse the repository at this point in the history
* deprecate enbaled-plugins configuration

Signed-off-by: Daniel Rammer <daniel@union.ai>

* removed DefaultForTaskType field from plugin entries

Signed-off-by: Daniel Rammer <daniel@union.ai>

* fixed compilation issues

Signed-off-by: Daniel Rammer <daniel@union.ai>

* fixed setting default configuration

Signed-off-by: Daniel Rammer <daniel@union.ai>

* generated new config flags

Signed-off-by: Daniel Rammer <daniel@union.ai>

* removed EnabledPlugins field

Signed-off-by: Daniel Rammer <daniel@union.ai>
  • Loading branch information
hamersaw committed Mar 2, 2022
1 parent 5a80da6 commit 9e00636
Show file tree
Hide file tree
Showing 17 changed files with 0 additions and 213 deletions.
10 changes: 0 additions & 10 deletions go/tasks/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@ package config

import (
"github.com/flyteorg/flytestdlib/config"

"github.com/flyteorg/flyteplugins/go/tasks/pluginmachinery/utils"
)

//go:generate pflags Config

const configSectionKey = "plugins"

var (
Expand All @@ -18,12 +14,6 @@ var (

// Top level plugins config.
type Config struct {
EnabledPlugins []string `json:"enabled-plugins" pflag:"[]string{\"*\"},List of enabled plugins, default value is to enable all plugins."`
}

func (cfg Config) IsEnabled(pluginToCheck string) bool {
return cfg.EnabledPlugins != nil && len(cfg.EnabledPlugins) >= 1 &&
(cfg.EnabledPlugins[0] == "*" || utils.Contains(cfg.EnabledPlugins, pluginToCheck))
}

// Retrieves the current config value or default.
Expand Down
55 changes: 0 additions & 55 deletions go/tasks/config/config_flags.go

This file was deleted.

116 changes: 0 additions & 116 deletions go/tasks/config/config_flags_test.go

This file was deleted.

5 changes: 0 additions & 5 deletions go/tasks/config_load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/stretchr/testify/assert"
v1 "k8s.io/api/core/v1"

pluginsConfig "github.com/flyteorg/flyteplugins/go/tasks/config"
"github.com/flyteorg/flyteplugins/go/tasks/logs"
flyteK8sConfig "github.com/flyteorg/flyteplugins/go/tasks/pluginmachinery/flytek8s/config"
"github.com/flyteorg/flyteplugins/go/tasks/plugins/k8s/spark"
Expand All @@ -28,10 +27,6 @@ func TestLoadConfig(t *testing.T) {
err := configAccessor.UpdateConfig(context.TODO())
assert.NoError(t, err)

t.Run("root-config-test", func(t *testing.T) {
assert.Equal(t, 1, len(pluginsConfig.GetConfig().EnabledPlugins))
})

t.Run("k8s-config-test", func(t *testing.T) {

k8sConfig := flyteK8sConfig.GetK8sPluginConfig()
Expand Down
4 changes: 0 additions & 4 deletions go/tasks/pluginmachinery/core/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ type PluginEntry struct {
// Boolean that indicates if this plugin can be used as the default for unknown task types. There can only be
// one default in the system
IsDefault bool
// A list of all task types for which this plugin should be default handler when multiple registered plugins
// support the same task type. This must be a subset of RegisteredTaskTypes and at most one default per task type
// is supported.
DefaultForTaskTypes []TaskType
}

// System level properties that this Plugin supports
Expand Down
3 changes: 0 additions & 3 deletions go/tasks/pluginmachinery/flytek8s/testdata/config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# Sample plugins config
plugins:
# Set of enabled plugins at root level
enabled-plugins:
- container
# All k8s plugins default configuration
k8s:
scheduler-name: flyte-scheduler
Expand Down
4 changes: 0 additions & 4 deletions go/tasks/pluginmachinery/k8s/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ type PluginEntry struct {
// Boolean that indicates if this plugin can be used as the default for unknown task types. There can only be
// one default in the system
IsDefault bool
// A list of all task types for which this plugin should be default handler when multiple registered plugins
// support the same task type. This must be a subset of RegisteredTaskTypes and at most one default per task type
// is supported.
DefaultForTaskTypes []pluginsCore.TaskType
// Returns a new KubeClient to be used instead of the internal controller-runtime client.
CustomKubeClient func(ctx context.Context) (pluginsCore.KubeClient, error)
}
Expand Down
1 change: 0 additions & 1 deletion go/tasks/plugins/array/awsbatch/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ func init() {
RegisteredTaskTypes: []core.TaskType{arrayTaskType, array.AwsBatchTaskType},
LoadPlugin: createNewExecutorPlugin,
IsDefault: false,
DefaultForTaskTypes: []core.TaskType{arrayTaskType, array.AwsBatchTaskType},
})
}

Expand Down
1 change: 0 additions & 1 deletion go/tasks/plugins/hive/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,5 @@ func init() {
RegisteredTaskTypes: []core.TaskType{hiveTaskType},
LoadPlugin: QuboleHiveExecutorLoader,
IsDefault: false,
DefaultForTaskTypes: []core.TaskType{hiveTaskType},
})
}
1 change: 0 additions & 1 deletion go/tasks/plugins/k8s/kfoperators/mpi/mpi.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,5 @@ func init() {
ResourceToWatch: &mpi.MPIJob{},
Plugin: mpiOperatorResourceHandler{},
IsDefault: false,
DefaultForTaskTypes: []pluginsCore.TaskType{common.MPITaskType},
})
}
1 change: 0 additions & 1 deletion go/tasks/plugins/k8s/kfoperators/pytorch/pytorch.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,5 @@ func init() {
ResourceToWatch: &ptOp.PyTorchJob{},
Plugin: pytorchOperatorResourceHandler{},
IsDefault: false,
DefaultForTaskTypes: []pluginsCore.TaskType{common.PytorchTaskType},
})
}
1 change: 0 additions & 1 deletion go/tasks/plugins/k8s/kfoperators/tensorflow/tensorflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,5 @@ func init() {
ResourceToWatch: &tfOp.TFJob{},
Plugin: tensorflowOperatorResourceHandler{},
IsDefault: false,
DefaultForTaskTypes: []pluginsCore.TaskType{common.TensorflowTaskType},
})
}
3 changes: 0 additions & 3 deletions go/tasks/plugins/k8s/pod/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ func init() {
ResourceToWatch: &v1.Pod{},
Plugin: podPlugin,
IsDefault: true,
DefaultForTaskTypes: []pluginsCore.TaskType{containerTaskType},
})

pluginmachinery.PluginRegistry().RegisterK8sPlugin(
Expand All @@ -154,7 +153,6 @@ func init() {
ResourceToWatch: &v1.Pod{},
Plugin: podPlugin,
IsDefault: false,
DefaultForTaskTypes: []pluginsCore.TaskType{sidecarTaskType},
})

// register podTaskType plugin entry
Expand All @@ -165,6 +163,5 @@ func init() {
ResourceToWatch: &v1.Pod{},
Plugin: podPlugin,
IsDefault: true,
DefaultForTaskTypes: []pluginsCore.TaskType{containerTaskType, sidecarTaskType},
})
}
3 changes: 0 additions & 3 deletions go/tasks/plugins/k8s/sagemaker/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ func init() {
ResourceToWatch: &hpojobv1.HyperparameterTuningJob{},
Plugin: awsSagemakerPlugin{TaskType: hyperparameterTuningJobTaskType},
IsDefault: false,
DefaultForTaskTypes: []pluginsCore.TaskType{hyperparameterTuningJobTaskType},
})

// Registering the plugin for standalone TrainingJob
Expand All @@ -92,7 +91,6 @@ func init() {
ResourceToWatch: &trainingjobv1.TrainingJob{},
Plugin: awsSagemakerPlugin{TaskType: trainingJobTaskType},
IsDefault: false,
DefaultForTaskTypes: []pluginsCore.TaskType{trainingJobTaskType},
})

// Registering the plugin for custom TrainingJob
Expand All @@ -103,6 +101,5 @@ func init() {
ResourceToWatch: &trainingjobv1.TrainingJob{},
Plugin: awsSagemakerPlugin{TaskType: customTrainingJobTaskType},
IsDefault: false,
DefaultForTaskTypes: []pluginsCore.TaskType{customTrainingJobTaskType},
})
}
1 change: 0 additions & 1 deletion go/tasks/plugins/k8s/spark/spark.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@ func init() {
ResourceToWatch: &sparkOp.SparkApplication{},
Plugin: sparkResourceHandler{},
IsDefault: false,
DefaultForTaskTypes: []pluginsCore.TaskType{sparkTaskType},
})
}

Expand Down
1 change: 0 additions & 1 deletion go/tasks/plugins/presto/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,5 @@ func init() {
RegisteredTaskTypes: []core.TaskType{prestoTaskType},
LoadPlugin: ExecutorLoader,
IsDefault: false,
DefaultForTaskTypes: []core.TaskType{prestoTaskType},
})
}
3 changes: 0 additions & 3 deletions go/tasks/testdata/config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# Sample plugins config
plugins:
# Set of enabled plugins at root level
enabled-plugins:
- container
# All k8s plugins default configuration
sagemaker:
roleArn: test-role
Expand Down

0 comments on commit 9e00636

Please sign in to comment.