Skip to content

Commit 214d28d

Browse files
committed
Enable prepare data plugins behind a feature flag
1 parent 50e340d commit 214d28d

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

cmd/epp/runner/runner.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,8 +504,9 @@ func (r *Runner) parseConfigurationPhaseTwo(ctx context.Context, rawConfig *conf
504504

505505
// Add requestControl plugins
506506
r.requestControlConfig.AddPlugins(handle.GetAllPlugins()...)
507+
507508
// Sort prepare data plugins in DAG order (topological sort). Also check prepare data plugins for cycles.
508-
if r.requestControlConfig.PrepareDataPluginGraph() != nil {
509+
if r.requestControlConfig.PrepareDataPluginGraph(r.featureGates[datalayer.PrepareDataPluginsFeatureGate]) != nil {
509510
return nil, errors.New("failed to load the configuration - prepare data plugins have cyclic dependencies")
510511
}
511512

pkg/epp/datalayer/factory.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ import (
2626
)
2727

2828
const (
29-
FeatureGate = "dataLayer"
29+
FeatureGate = "dataLayer"
30+
PrepareDataPluginsFeatureGate = "prepareDataPlugins"
3031
)
3132

3233
// PoolInfo represents the DataStore information needed for endpoints.

pkg/epp/requestcontrol/request_control_config.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,11 @@ func (c *Config) AddPlugins(pluginObjects ...plugins.Plugin) {
107107

108108
// PrepareDataPluginGraph creates data dependency graph and sorts the plugins in topological order.
109109
// If a cycle is detected, it returns an error.
110-
func (c *Config) PrepareDataPluginGraph() error {
110+
func (c *Config) PrepareDataPluginGraph(enablePrepareDataPlugins bool) error {
111+
if !enablePrepareDataPlugins {
112+
c.prepareDataPlugins = []PrepareDataPlugin{}
113+
return nil
114+
}
111115
dag := buildDAG(c.prepareDataPlugins)
112116
plugins, err := sortPlugins(dag, c.prepareDataPlugins)
113117
if err != nil {

0 commit comments

Comments
 (0)