mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
f695e98cb7
This reverts commit 98fc09128b
in order to
keep registry v2 schema1 handling and libtrust-key-based engine ID.
Because registry v2 schema1 was not officially deprecated and
registries are still relying on it, this patch puts its logic back.
However, registry v1 relics are not added back since v1 logic has been
removed a while ago.
This also fixes an engine upgrade issue in a swarm cluster. It was relying
on the Engine ID to be the same upon upgrade, but the mentioned commit
modified the logic to use UUID and from a different file.
Since the libtrust key is always needed to support v2 schema1 pushes,
that the old engine ID is based on the libtrust key, and that the engine ID
needs to be conserved across upgrades, adding a UUID-based engine ID logic
seems to add more complexity than it solves the problems.
Hence reverting the engine ID changes as well.
Signed-off-by: Tibor Vass <tibor@docker.com>
100 lines
2.4 KiB
Go
100 lines
2.4 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"net"
|
|
"os"
|
|
"path/filepath"
|
|
"time"
|
|
|
|
"github.com/docker/docker/daemon/config"
|
|
"github.com/docker/docker/libcontainerd/supervisor"
|
|
"github.com/docker/docker/pkg/system"
|
|
"github.com/sirupsen/logrus"
|
|
"golang.org/x/sys/windows"
|
|
)
|
|
|
|
func getDefaultDaemonConfigFile() (string, error) {
|
|
return "", nil
|
|
}
|
|
|
|
// setDefaultUmask doesn't do anything on windows
|
|
func setDefaultUmask() error {
|
|
return nil
|
|
}
|
|
|
|
func getDaemonConfDir(root string) (string, error) {
|
|
return filepath.Join(root, `\config`), nil
|
|
}
|
|
|
|
// preNotifySystem sends a message to the host when the API is active, but before the daemon is
|
|
func preNotifySystem() {
|
|
// start the service now to prevent timeouts waiting for daemon to start
|
|
// but still (eventually) complete all requests that are sent after this
|
|
if service != nil {
|
|
err := service.started()
|
|
if err != nil {
|
|
logrus.Fatal(err)
|
|
}
|
|
}
|
|
}
|
|
|
|
// notifySystem sends a message to the host when the server is ready to be used
|
|
func notifySystem() {
|
|
}
|
|
|
|
// notifyShutdown is called after the daemon shuts down but before the process exits.
|
|
func notifyShutdown(err error) {
|
|
if service != nil {
|
|
if err != nil {
|
|
logrus.Fatal(err)
|
|
}
|
|
service.stopped(err)
|
|
}
|
|
}
|
|
|
|
func (cli *DaemonCli) getPlatformContainerdDaemonOpts() ([]supervisor.DaemonOpt, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
// setupConfigReloadTrap configures a Win32 event to reload the configuration.
|
|
func (cli *DaemonCli) setupConfigReloadTrap() {
|
|
go func() {
|
|
sa := windows.SecurityAttributes{
|
|
Length: 0,
|
|
}
|
|
event := "Global\\docker-daemon-config-" + fmt.Sprint(os.Getpid())
|
|
ev, _ := windows.UTF16PtrFromString(event)
|
|
if h, _ := windows.CreateEvent(&sa, 0, 0, ev); h != 0 {
|
|
logrus.Debugf("Config reload - waiting signal at %s", event)
|
|
for {
|
|
windows.WaitForSingleObject(h, windows.INFINITE)
|
|
cli.reloadConfig()
|
|
}
|
|
}
|
|
}()
|
|
}
|
|
|
|
// getSwarmRunRoot gets the root directory for swarm to store runtime state
|
|
// For example, the control socket
|
|
func (cli *DaemonCli) getSwarmRunRoot() string {
|
|
return ""
|
|
}
|
|
|
|
func allocateDaemonPort(addr string) error {
|
|
return nil
|
|
}
|
|
|
|
func wrapListeners(proto string, ls []net.Listener) []net.Listener {
|
|
return ls
|
|
}
|
|
|
|
func newCgroupParent(config *config.Config) string {
|
|
return ""
|
|
}
|
|
|
|
func (cli *DaemonCli) initContainerD(_ context.Context) (func(time.Duration) error, error) {
|
|
system.InitContainerdRuntime(cli.Config.Experimental, cli.Config.ContainerdAddr)
|
|
return nil, nil
|
|
}
|