Merge pull request #45484 from thaJeztah/remove_deprecated_stubs
remove deprecated types, fields, and functions
This commit is contained in:
commit
bafcfdf8c5
18 changed files with 8 additions and 175 deletions
|
@ -1,7 +0,0 @@
|
||||||
package types // import "github.com/docker/docker/api/types"
|
|
||||||
import "github.com/docker/docker/api/types/registry"
|
|
||||||
|
|
||||||
// AuthConfig contains authorization information for connecting to a Registry.
|
|
||||||
//
|
|
||||||
// Deprecated: use github.com/docker/docker/api/types/registry.AuthConfig
|
|
||||||
type AuthConfig = registry.AuthConfig
|
|
|
@ -1,6 +0,0 @@
|
||||||
package container
|
|
||||||
|
|
||||||
// ContainerChangeResponseItem change item in response to ContainerChanges operation
|
|
||||||
//
|
|
||||||
// Deprecated: use [FilesystemChange].
|
|
||||||
type ContainerChangeResponseItem = FilesystemChange
|
|
|
@ -46,6 +46,7 @@ func installConfigFlags(conf *config.Config, flags *pflag.FlagSet) error {
|
||||||
flags.StringVar(&conf.CgroupParent, "cgroup-parent", "", "Set parent cgroup for all containers")
|
flags.StringVar(&conf.CgroupParent, "cgroup-parent", "", "Set parent cgroup for all containers")
|
||||||
flags.StringVar(&conf.RemappedRoot, "userns-remap", "", "User/Group setting for user namespaces")
|
flags.StringVar(&conf.RemappedRoot, "userns-remap", "", "User/Group setting for user namespaces")
|
||||||
flags.BoolVar(&conf.LiveRestoreEnabled, "live-restore", false, "Enable live restore of docker when containers are still running")
|
flags.BoolVar(&conf.LiveRestoreEnabled, "live-restore", false, "Enable live restore of docker when containers are still running")
|
||||||
|
// TODO(thaJeztah): Used to produce a deprecation error; remove the flag and the OOMScoreAdjust field for the next release after v25.0.0.
|
||||||
flags.IntVar(&conf.OOMScoreAdjust, "oom-score-adjust", 0, "Set the oom_score_adj for the daemon (deprecated)")
|
flags.IntVar(&conf.OOMScoreAdjust, "oom-score-adjust", 0, "Set the oom_score_adj for the daemon (deprecated)")
|
||||||
_ = flags.MarkDeprecated("oom-score-adjust", "and will be removed in the next release.")
|
_ = flags.MarkDeprecated("oom-score-adjust", "and will be removed in the next release.")
|
||||||
flags.BoolVar(&conf.Init, "init", false, "Run an init in the container to forward signals and reap processes")
|
flags.BoolVar(&conf.Init, "init", false, "Run an init in the container to forward signals and reap processes")
|
||||||
|
|
|
@ -629,11 +629,7 @@ func initMiddlewares(s *apiserver.Server, cfg *config.Config, pluginStore plugin
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *DaemonCli) getContainerdDaemonOpts() ([]supervisor.DaemonOpt, error) {
|
func (cli *DaemonCli) getContainerdDaemonOpts() ([]supervisor.DaemonOpt, error) {
|
||||||
opts, err := cli.getPlatformContainerdDaemonOpts()
|
var opts []supervisor.DaemonOpt
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if cli.Debug {
|
if cli.Debug {
|
||||||
opts = append(opts, supervisor.WithLogLevel("debug"))
|
opts = append(opts, supervisor.WithLogLevel("debug"))
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -56,19 +56,6 @@ func setDefaultUmask() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *DaemonCli) getPlatformContainerdDaemonOpts() ([]supervisor.DaemonOpt, error) {
|
|
||||||
opts := []supervisor.DaemonOpt{
|
|
||||||
// TODO(thaJeztah) change this to use /proc/self/oom_score_adj instead,
|
|
||||||
// which would allow us to set the correct score even if dockerd's score
|
|
||||||
// was set through other means (such as systemd or "manually").
|
|
||||||
supervisor.WithOOMScore(cli.Config.OOMScoreAdjust), //nolint:staticcheck // ignore SA1019 (WithOOMScore is deprecated); will be removed in the next release.
|
|
||||||
}
|
|
||||||
if cli.Config.OOMScoreAdjust != 0 {
|
|
||||||
logrus.Warn(`DEPRECATED: The "oom-score-adjust" config parameter and the dockerd "--oom-score-adjust" option will be removed in the next release.`)
|
|
||||||
}
|
|
||||||
return opts, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// setupConfigReloadTrap configures the SIGHUP signal to reload the configuration.
|
// setupConfigReloadTrap configures the SIGHUP signal to reload the configuration.
|
||||||
func (cli *DaemonCli) setupConfigReloadTrap() {
|
func (cli *DaemonCli) setupConfigReloadTrap() {
|
||||||
c := make(chan os.Signal, 1)
|
c := make(chan os.Signal, 1)
|
||||||
|
|
|
@ -7,7 +7,6 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/daemon/config"
|
"github.com/docker/docker/daemon/config"
|
||||||
"github.com/docker/docker/libcontainerd/supervisor"
|
|
||||||
"github.com/docker/docker/pkg/system"
|
"github.com/docker/docker/pkg/system"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"golang.org/x/sys/windows"
|
"golang.org/x/sys/windows"
|
||||||
|
@ -52,10 +51,6 @@ func notifyShutdown(err error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *DaemonCli) getPlatformContainerdDaemonOpts() ([]supervisor.DaemonOpt, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// setupConfigReloadTrap configures a Win32 event to reload the configuration.
|
// setupConfigReloadTrap configures a Win32 event to reload the configuration.
|
||||||
func (cli *DaemonCli) setupConfigReloadTrap() {
|
func (cli *DaemonCli) setupConfigReloadTrap() {
|
||||||
go func() {
|
go func() {
|
||||||
|
|
|
@ -184,6 +184,9 @@ func verifyDefaultCgroupNsMode(mode string) error {
|
||||||
|
|
||||||
// ValidatePlatformConfig checks if any platform-specific configuration settings are invalid.
|
// ValidatePlatformConfig checks if any platform-specific configuration settings are invalid.
|
||||||
func (conf *Config) ValidatePlatformConfig() error {
|
func (conf *Config) ValidatePlatformConfig() error {
|
||||||
|
if conf.OOMScoreAdjust != 0 {
|
||||||
|
return errors.New(`DEPRECATED: The "oom-score-adjust" config parameter and the dockerd "--oom-score-adjust" options have been removed.`)
|
||||||
|
}
|
||||||
if err := verifyDefaultIpcMode(conf.IpcMode); err != nil {
|
if err := verifyDefaultIpcMode(conf.IpcMode); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -767,8 +767,8 @@ func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.S
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
rootIDs := idMapping.RootPair()
|
rootIDs := idMapping.RootPair()
|
||||||
if err := setupDaemonProcess(config); err != nil {
|
if err := setMayDetachMounts(); err != nil {
|
||||||
return nil, err
|
logrus.WithError(err).Warn("Could not set may_detach_mounts kernel parameter")
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up the tmpDir to use a canonical path
|
// set up the tmpDir to use a canonical path
|
||||||
|
|
|
@ -1415,18 +1415,6 @@ func (daemon *Daemon) setDefaultIsolation() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// setupDaemonProcess sets various settings for the daemon's process
|
|
||||||
func setupDaemonProcess(config *config.Config) error {
|
|
||||||
// setup the daemons oom_score_adj
|
|
||||||
if err := setupOOMScoreAdj(config.OOMScoreAdjust); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if err := setMayDetachMounts(); err != nil {
|
|
||||||
logrus.WithError(err).Warn("Could not set may_detach_mounts kernel parameter")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is used to allow removal of mountpoints that may be mounted in other
|
// This is used to allow removal of mountpoints that may be mounted in other
|
||||||
// namespaces on RHEL based kernels starting from RHEL 7.4.
|
// namespaces on RHEL based kernels starting from RHEL 7.4.
|
||||||
// Without this setting, removals on these RHEL based kernels may fail with
|
// Without this setting, removals on these RHEL based kernels may fail with
|
||||||
|
@ -1456,30 +1444,6 @@ func setMayDetachMounts() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func setupOOMScoreAdj(score int) error {
|
|
||||||
if score == 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
f, err := os.OpenFile("/proc/self/oom_score_adj", os.O_WRONLY, 0)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer f.Close()
|
|
||||||
stringScore := strconv.Itoa(score)
|
|
||||||
_, err = f.WriteString(stringScore)
|
|
||||||
if os.IsPermission(err) {
|
|
||||||
// Setting oom_score_adj does not work in an
|
|
||||||
// unprivileged container. Ignore the error, but log
|
|
||||||
// it if we appear not to be in that situation.
|
|
||||||
if !userns.RunningInUserNS() {
|
|
||||||
logrus.Debugf("Permission denied writing %q to /proc/self/oom_score_adj", stringScore)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (daemon *Daemon) initCPURtController(mnt, path string) error {
|
func (daemon *Daemon) initCPURtController(mnt, path string) error {
|
||||||
if path == "/" || path == "." {
|
if path == "/" || path == "." {
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -548,7 +548,7 @@ func (daemon *Daemon) setDefaultIsolation() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func setupDaemonProcess(config *config.Config) error {
|
func setMayDetachMounts() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -164,9 +164,6 @@ func (daemon *Daemon) fillPlatformInfo(v *types.Info, sysInfo *sysinfo.SysInfo)
|
||||||
if !v.BridgeNfIP6tables {
|
if !v.BridgeNfIP6tables {
|
||||||
v.Warnings = append(v.Warnings, "WARNING: bridge-nf-call-ip6tables is disabled")
|
v.Warnings = append(v.Warnings, "WARNING: bridge-nf-call-ip6tables is disabled")
|
||||||
}
|
}
|
||||||
if daemon.configStore.OOMScoreAdjust != 0 {
|
|
||||||
v.Warnings = append(v.Warnings, `DEPRECATED: The "oom-score-adjust" config parameter and the dockerd "--oom-score-adjust" option will be removed in the next release`)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (daemon *Daemon) fillPlatformVersion(v *types.Version) {
|
func (daemon *Daemon) fillPlatformVersion(v *types.Version) {
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
package supervisor // import "github.com/docker/docker/libcontainerd/supervisor"
|
|
||||||
|
|
||||||
// WithOOMScore defines the oom_score_adj to set for the containerd process.
|
|
||||||
//
|
|
||||||
// Deprecated: setting the oom-score-adjust from the daemon itself is deprecated, and should be handled by the process-manager starting the daemon instead.
|
|
||||||
func WithOOMScore(score int) DaemonOpt {
|
|
||||||
return func(r *remote) error {
|
|
||||||
r.oomScore = score
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
package ioutils
|
|
||||||
|
|
||||||
import "github.com/docker/docker/pkg/longpath"
|
|
||||||
|
|
||||||
// TempDir is the equivalent of [os.MkdirTemp], except that on Windows
|
|
||||||
// the result is in Windows longpath format. On Unix systems it is
|
|
||||||
// equivalent to [os.MkdirTemp].
|
|
||||||
//
|
|
||||||
// Deprecated: use [longpath.MkdirTemp].
|
|
||||||
var TempDir = longpath.MkdirTemp
|
|
|
@ -3,8 +3,6 @@
|
||||||
package platform // import "github.com/docker/docker/pkg/platform"
|
package platform // import "github.com/docker/docker/pkg/platform"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"runtime"
|
|
||||||
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -17,12 +15,6 @@ import (
|
||||||
// when running a "linux/386" compiled binary on "linux/amd64" hardware.
|
// when running a "linux/386" compiled binary on "linux/amd64" hardware.
|
||||||
var Architecture string
|
var Architecture string
|
||||||
|
|
||||||
// OSType holds the runtime operating system type of the process. It is
|
|
||||||
// an alias for [runtime.GOOS].
|
|
||||||
//
|
|
||||||
// Deprecated: use [runtime.GOOS] instead.
|
|
||||||
const OSType = runtime.GOOS
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
var err error
|
var err error
|
||||||
Architecture, err = runtimeArchitecture()
|
Architecture, err = runtimeArchitecture()
|
||||||
|
|
|
@ -43,10 +43,3 @@ func Kill(pid int) error {
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zombie is not supported on Windows.
|
|
||||||
//
|
|
||||||
// TODO(thaJeztah): remove once we remove the stubs from pkg/system.
|
|
||||||
func Zombie(_ int) (bool, error) {
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
package system
|
|
||||||
|
|
||||||
import "github.com/docker/docker/pkg/meminfo"
|
|
||||||
|
|
||||||
// MemInfo contains memory statistics of the host system.
|
|
||||||
//
|
|
||||||
// Deprecated: use [meminfo.Memory].
|
|
||||||
type MemInfo = meminfo.Memory
|
|
||||||
|
|
||||||
// ReadMemInfo retrieves memory statistics of the host system and returns a
|
|
||||||
// MemInfo type.
|
|
||||||
//
|
|
||||||
// Deprecated: use [meminfo.Read].
|
|
||||||
func ReadMemInfo() (*meminfo.Memory, error) {
|
|
||||||
return meminfo.Read()
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
package system
|
|
||||||
|
|
||||||
const defaultUnixPathEnv = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
|
||||||
|
|
||||||
// DefaultPathEnv is unix style list of directories to search for
|
|
||||||
// executables. Each directory is separated from the next by a colon
|
|
||||||
// ':' character .
|
|
||||||
// For Windows containers, an empty string is returned as the default
|
|
||||||
// path will be set by the container, and Docker has no context of what the
|
|
||||||
// default path should be.
|
|
||||||
//
|
|
||||||
// Deprecated: use oci.DefaultPathEnv
|
|
||||||
func DefaultPathEnv(os string) string {
|
|
||||||
if os == "windows" {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return defaultUnixPathEnv
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
//go:build linux || freebsd || darwin || windows
|
|
||||||
// +build linux freebsd darwin windows
|
|
||||||
|
|
||||||
package system
|
|
||||||
|
|
||||||
import "github.com/docker/docker/pkg/process"
|
|
||||||
|
|
||||||
var (
|
|
||||||
// IsProcessAlive returns true if process with a given pid is running.
|
|
||||||
//
|
|
||||||
// Deprecated: use [process.Alive].
|
|
||||||
IsProcessAlive = process.Alive
|
|
||||||
|
|
||||||
// IsProcessZombie return true if process has a state with "Z"
|
|
||||||
//
|
|
||||||
// Deprecated: use [process.Zombie].
|
|
||||||
//
|
|
||||||
// TODO(thaJeztah): remove the Windows implementation in process once we remove this stub.
|
|
||||||
IsProcessZombie = process.Zombie
|
|
||||||
)
|
|
||||||
|
|
||||||
// KillProcess force-stops a process.
|
|
||||||
//
|
|
||||||
// Deprecated: use [process.Kill].
|
|
||||||
func KillProcess(pid int) {
|
|
||||||
_ = process.Kill(pid)
|
|
||||||
}
|
|
Loading…
Reference in a new issue