Skip to content

Commit 20b5258

Browse files
committed
Enable prepare data plugins behind a feature flag
1 parent a36ceeb commit 20b5258

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
@@ -482,8 +482,9 @@ func (r *Runner) parseConfigurationPhaseTwo(ctx context.Context, rawConfig *conf
482482

483483
// Add requestControl plugins
484484
r.requestControlConfig.AddPlugins(handle.GetAllPlugins()...)
485+
485486
// Sort prepare data plugins in DAG order (topological sort). Also check prepare data plugins for cycles.
486-
if r.requestControlConfig.PrepareDataPluginGraph() != nil {
487+
if r.requestControlConfig.PrepareDataPluginGraph(r.featureGates[datalayer.PrepareDataPluginsFeatureGate]) != nil {
487488
return nil, errors.New("failed to load the configuration - prepare data plugins have cyclic dependencies")
488489
}
489490

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)