Merge pull request #50869 from vvoland/c8d-fix-windows-migration

daemon: Fix unwanted c8d migration on Windows
This commit is contained in:
Paweł Gronowski
2025-09-25 11:13:39 +00:00
committed by GitHub
2 changed files with 10 additions and 6 deletions

View File

@@ -785,6 +785,10 @@ func (daemon *Daemon) IsSwarmCompatible() error {
return daemon.config().IsSwarmCompatible()
}
func useContainerdByDefault() bool {
return os.Getenv("TEST_INTEGRATION_USE_GRAPHDRIVER") == "" && runtime.GOOS != "windows"
}
// NewDaemon sets up everything for the daemon to be able to service
// requests from the webserver.
func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.Store, authzMiddleware *authorization.Middleware) (_ *Daemon, retErr error) {
@@ -894,7 +898,7 @@ func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.S
log.G(ctx).WithField("env", os.Environ()).Info("Migration to containerd is enabled, driver will be switched to snapshotter if there are no images or containers")
}
}
if config.Features["containerd-snapshotter"] {
if config.Features["containerd-snapshotter"] && useContainerdByDefault() {
log.G(ctx).Warn(`"containerd-snapshotter" is now the default and no longer needed to be set`)
}
@@ -1113,11 +1117,10 @@ func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.S
case "windowsfilter":
// Docker WCOW graphdriver
case "":
// Use graph driver but enable migration
// Use graph driver unless opted-in to containerd store
driverName = "windowsfilter"
if os.Getenv("TEST_INTEGRATION_USE_GRAPHDRIVER") == "" {
// Don't force migration if graph driver is explicit
migrationThreshold = 0
if useContainerdByDefault() || config.Features["containerd-snapshotter"] {
driverName = "windows"
}
default:
log.G(ctx).Infof("Using non-default snapshotter %s", driverName)

View File

@@ -5,6 +5,7 @@ import (
"fmt"
"os"
"path/filepath"
"runtime"
"strings"
"testing"
@@ -190,7 +191,7 @@ func (e *Execution) IsUserNamespaceInKernel() bool {
// UsingSnapshotter returns whether containerd snapshotters are used for the
// tests by checking if the "TEST_INTEGRATION_USE_GRAPHDRIVER" is empty
func (e *Execution) UsingSnapshotter() bool {
return os.Getenv("TEST_INTEGRATION_USE_GRAPHDRIVER") == ""
return os.Getenv("TEST_INTEGRATION_USE_GRAPHDRIVER") == "" && runtime.GOOS != "windows"
}
// HasExistingImage checks whether there is an image with the given reference.