Merge pull request #48050 from thaJeztah/deprecate_graphdriver_plugins

deprecate experimental Graphdriver plugins, and disable by default
This commit is contained in:
Paweł Gronowski
2024-06-21 15:12:12 +02:00
committed by GitHub
2 changed files with 10 additions and 6 deletions

View File

@@ -2,6 +2,7 @@ package graphdriver // import "github.com/docker/docker/daemon/graphdriver"
import (
"fmt"
"os"
"path/filepath"
"github.com/docker/docker/errdefs"
@@ -12,6 +13,9 @@ import (
)
func lookupPlugin(name string, pg plugingetter.PluginGetter, config Options) (Driver, error) {
if os.Getenv("DOCKERD_DEPRECATED_GRAPHDRIVER_PLUGINS") == "" {
return nil, fmt.Errorf("DEPRECATED: Experimental graphdriver plugins are deprecated, and disabled by default. This feature will be removed in the next release. See https://docs.docker.com/go/deprecated/")
}
if !config.ExperimentalEnabled {
return nil, fmt.Errorf("graphdriver plugins are only supported with experimental mode")
}

View File

@@ -60,7 +60,7 @@ func TestExternalGraphDriver(t *testing.T) {
sserver := setupPluginViaSpecFile(t, ec)
jserver := setupPluginViaJSONFile(t, ec)
// Create daemon
d := daemon.New(t, daemon.WithExperimental())
d := daemon.New(t, daemon.WithExperimental(), daemon.WithEnvVars("DOCKERD_DEPRECATED_GRAPHDRIVER_PLUGINS=1"))
c := d.NewClientT(t)
for _, tc := range []struct {
@@ -418,16 +418,16 @@ func TestGraphdriverPluginV2(t *testing.T) {
ctx := testutil.StartSpan(baseContext, t)
d := daemon.New(t, daemon.WithExperimental())
d := daemon.New(t, daemon.WithExperimental(), daemon.WithEnvVars("DOCKERD_DEPRECATED_GRAPHDRIVER_PLUGINS=1"))
d.Start(t)
defer d.Stop(t)
client := d.NewClientT(t)
defer client.Close()
apiClient := d.NewClientT(t)
defer apiClient.Close()
// install the plugin
plugin := "cpuguy83/docker-overlay2-graphdriver-plugin"
responseReader, err := client.PluginInstall(ctx, plugin, types.PluginInstallOptions{
responseReader, err := apiClient.PluginInstall(ctx, plugin, types.PluginInstallOptions{
RemoteRef: plugin,
AcceptAllPermissions: true,
})
@@ -441,7 +441,7 @@ func TestGraphdriverPluginV2(t *testing.T) {
d.Stop(t)
d.StartWithBusybox(ctx, t, "-s", plugin)
testGraphDriver(ctx, t, client, plugin, nil)
testGraphDriver(ctx, t, apiClient, plugin, nil)
}
func testGraphDriver(ctx context.Context, t *testing.T, c client.APIClient, driverName string, afterContainerRunFn func(*testing.T)) {