diff --git a/daemon/auth.go b/daemon/auth.go index d32c28b8dd..e97d888371 100644 --- a/daemon/auth.go +++ b/daemon/auth.go @@ -9,5 +9,5 @@ import ( // AuthenticateToRegistry checks the validity of credentials in authConfig func (daemon *Daemon) AuthenticateToRegistry(ctx context.Context, authConfig *types.AuthConfig) (string, string, error) { - return daemon.RegistryService.Auth(ctx, authConfig, dockerversion.DockerUserAgent(ctx)) + return daemon.registryService.Auth(ctx, authConfig, dockerversion.DockerUserAgent(ctx)) } diff --git a/daemon/daemon.go b/daemon/daemon.go index 126b78f55f..f0ca5d8503 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -78,7 +78,7 @@ var ( // Daemon holds information about the Docker daemon. type Daemon struct { - ID string + id string repository string containers container.Store containersReplica container.ViewDB @@ -88,7 +88,7 @@ type Daemon struct { configStore *config.Config statsCollector *stats.Collector defaultLogConfig containertypes.LogConfig - RegistryService registry.Service + registryService registry.Service EventsService *events.Events netController libnetwork.NetworkController volumes *volumesservice.VolumesService @@ -852,7 +852,7 @@ func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.S } } - d.RegistryService = registryService + d.registryService = registryService logger.RegisterPluginGetter(d.PluginStore) metricsSockPath, err := d.listenMetricsSock() @@ -1021,7 +1021,7 @@ func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.S return nil, errors.New("Devices cgroup isn't mounted") } - d.ID = trustKey.PublicKey().KeyID() + d.id = trustKey.PublicKey().KeyID() d.repository = daemonRepo d.containers = container.NewMemoryStore() if d.containersReplica, err = container.NewViewDB(); err != nil { diff --git a/daemon/events.go b/daemon/events.go index 9b76fdbb97..169b7348a1 100644 --- a/daemon/events.go +++ b/daemon/events.go @@ -91,7 +91,7 @@ func (daemon *Daemon) LogDaemonEventWithAttributes(action string, attributes map attributes["name"] = info.Name } actor := events.Actor{ - ID: daemon.ID, + ID: daemon.id, Attributes: attributes, } daemon.EventsService.Log(action, events.DaemonEventType, actor) diff --git a/daemon/info.go b/daemon/info.go index 4be6ec0c80..b294eaab01 100644 --- a/daemon/info.go +++ b/daemon/info.go @@ -32,7 +32,7 @@ func (daemon *Daemon) SystemInfo() *types.Info { sysInfo := daemon.RawSysInfo() v := &types.Info{ - ID: daemon.ID, + ID: daemon.id, Images: daemon.imageService.CountImages(), IPv4Forwarding: !sysInfo.IPv4ForwardingDisabled, BridgeNfIptables: !sysInfo.BridgeNFCallIPTablesDisabled, @@ -50,7 +50,7 @@ func (daemon *Daemon) SystemInfo() *types.Info { IndexServerAddress: registry.IndexServer, OSType: platform.OSType, Architecture: platform.Architecture, - RegistryConfig: daemon.RegistryService.ServiceConfig(), + RegistryConfig: daemon.registryService.ServiceConfig(), NCPU: sysinfo.NumCPU(), MemTotal: memInfo().MemTotal, GenericResources: daemon.genericResources, diff --git a/daemon/reload.go b/daemon/reload.go index cabcf16266..55454bab5b 100644 --- a/daemon/reload.go +++ b/daemon/reload.go @@ -184,7 +184,7 @@ func (daemon *Daemon) reloadAllowNondistributableArtifacts(conf *config.Config, // Update corresponding configuration. if conf.IsValueSet("allow-nondistributable-artifacts") { daemon.configStore.AllowNondistributableArtifacts = conf.AllowNondistributableArtifacts - if err := daemon.RegistryService.LoadAllowNondistributableArtifacts(conf.AllowNondistributableArtifacts); err != nil { + if err := daemon.registryService.LoadAllowNondistributableArtifacts(conf.AllowNondistributableArtifacts); err != nil { return err } } @@ -209,7 +209,7 @@ func (daemon *Daemon) reloadInsecureRegistries(conf *config.Config, attributes m // update corresponding configuration if conf.IsValueSet("insecure-registries") { daemon.configStore.InsecureRegistries = conf.InsecureRegistries - if err := daemon.RegistryService.LoadInsecureRegistries(conf.InsecureRegistries); err != nil { + if err := daemon.registryService.LoadInsecureRegistries(conf.InsecureRegistries); err != nil { return err } } @@ -234,7 +234,7 @@ func (daemon *Daemon) reloadRegistryMirrors(conf *config.Config, attributes map[ // update corresponding configuration if conf.IsValueSet("registry-mirrors") { daemon.configStore.Mirrors = conf.Mirrors - if err := daemon.RegistryService.LoadMirrors(conf.Mirrors); err != nil { + if err := daemon.registryService.LoadMirrors(conf.Mirrors); err != nil { return err } } diff --git a/daemon/reload_test.go b/daemon/reload_test.go index 96124b36fa..0683f53788 100644 --- a/daemon/reload_test.go +++ b/daemon/reload_test.go @@ -58,7 +58,7 @@ func TestDaemonReloadAllowNondistributableArtifacts(t *testing.T) { var err error // Initialize daemon with some registries. - daemon.RegistryService, err = registry.NewService(registry.ServiceOptions{ + daemon.registryService, err = registry.NewService(registry.ServiceOptions{ AllowNondistributableArtifacts: []string{ "127.0.0.0/8", "10.10.1.11:5000", @@ -95,7 +95,7 @@ func TestDaemonReloadAllowNondistributableArtifacts(t *testing.T) { } var actual []string - serviceConfig := daemon.RegistryService.ServiceConfig() + serviceConfig := daemon.registryService.ServiceConfig() for _, value := range serviceConfig.AllowNondistributableArtifactsCIDRs { actual = append(actual, value.String()) } @@ -113,7 +113,7 @@ func TestDaemonReloadMirrors(t *testing.T) { muteLogs() var err error - daemon.RegistryService, err = registry.NewService(registry.ServiceOptions{ + daemon.registryService, err = registry.NewService(registry.ServiceOptions{ InsecureRegistries: []string{}, Mirrors: []string{ "https://mirror.test1.example.com", @@ -180,7 +180,7 @@ func TestDaemonReloadMirrors(t *testing.T) { // mirrors should be valid, should be no error t.Fatal(err) } - registryService := daemon.RegistryService.ServiceConfig() + registryService := daemon.registryService.ServiceConfig() if len(registryService.Mirrors) != len(value.after) { t.Fatalf("Expected %d daemon mirrors %s while get %d with %s", @@ -215,7 +215,7 @@ func TestDaemonReloadInsecureRegistries(t *testing.T) { var err error // initialize daemon with existing insecure registries: "127.0.0.0/8", "10.10.1.11:5000", "10.10.1.22:5000" - daemon.RegistryService, err = registry.NewService(registry.ServiceOptions{ + daemon.registryService, err = registry.NewService(registry.ServiceOptions{ InsecureRegistries: []string{ "127.0.0.0/8", "10.10.1.11:5000", @@ -256,7 +256,7 @@ func TestDaemonReloadInsecureRegistries(t *testing.T) { // After Reload, daemon.RegistryService will be changed which is useful // for registry communication in daemon. - registries := daemon.RegistryService.ServiceConfig() + registries := daemon.registryService.ServiceConfig() // After Reload(), newConfig has come to registries.InsecureRegistryCIDRs and registries.IndexConfigs in daemon. // Then collect registries.InsecureRegistryCIDRs in dataMap.