Преглед изворни кода

daemon/config: rename CommonTLSOptions to TLSOptions

This type was added in 677a6b3506107468ed8c00331991afd9176fa0b9, and named
"common", because at the time, the "docker" and "dockerd" (daemon) code
were still in the same repository, and shared this type. Renaming it, now
that's no longer the case.

As there are no external consumers of this type, I'm not adding an alias.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn пре 2 година
родитељ
комит
32b299f63e
3 измењених фајлова са 11 додато и 11 уклоњено
  1. 5 5
      cmd/dockerd/daemon.go
  2. 2 2
      cmd/dockerd/daemon_test.go
  3. 4 4
      daemon/config/config.go

+ 5 - 5
cmd/dockerd/daemon.go

@@ -405,13 +405,13 @@ func loadDaemonCliConfig(opts *daemonOptions) (*config.Config, error) {
 	}
 	}
 
 
 	if opts.TLSOptions != nil {
 	if opts.TLSOptions != nil {
-		conf.CommonTLSOptions = config.CommonTLSOptions{
+		conf.TLSOptions = config.TLSOptions{
 			CAFile:   opts.TLSOptions.CAFile,
 			CAFile:   opts.TLSOptions.CAFile,
 			CertFile: opts.TLSOptions.CertFile,
 			CertFile: opts.TLSOptions.CertFile,
 			KeyFile:  opts.TLSOptions.KeyFile,
 			KeyFile:  opts.TLSOptions.KeyFile,
 		}
 		}
 	} else {
 	} else {
-		conf.CommonTLSOptions = config.CommonTLSOptions{}
+		conf.TLSOptions = config.TLSOptions{}
 	}
 	}
 
 
 	if opts.configFile != "" {
 	if opts.configFile != "" {
@@ -609,9 +609,9 @@ func newAPIServerConfig(config *config.Config) (*apiserver.Config, error) {
 			clientAuth = tls.RequireAndVerifyClientCert
 			clientAuth = tls.RequireAndVerifyClientCert
 		}
 		}
 		tlsConfig, err = tlsconfig.Server(tlsconfig.Options{
 		tlsConfig, err = tlsconfig.Server(tlsconfig.Options{
-			CAFile:             config.CommonTLSOptions.CAFile,
-			CertFile:           config.CommonTLSOptions.CertFile,
-			KeyFile:            config.CommonTLSOptions.KeyFile,
+			CAFile:             config.TLSOptions.CAFile,
+			CertFile:           config.TLSOptions.CertFile,
+			KeyFile:            config.TLSOptions.KeyFile,
 			ExclusiveRootPools: true,
 			ExclusiveRootPools: true,
 			ClientAuth:         clientAuth,
 			ClientAuth:         clientAuth,
 		})
 		})

+ 2 - 2
cmd/dockerd/daemon_test.go

@@ -48,7 +48,7 @@ func TestLoadDaemonCliConfigWithTLS(t *testing.T) {
 	loadedConfig, err := loadDaemonCliConfig(opts)
 	loadedConfig, err := loadDaemonCliConfig(opts)
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 	assert.Assert(t, loadedConfig != nil)
 	assert.Assert(t, loadedConfig != nil)
-	assert.Check(t, is.Equal("/tmp/ca.pem", loadedConfig.CommonTLSOptions.CAFile))
+	assert.Check(t, is.Equal("/tmp/ca.pem", loadedConfig.TLSOptions.CAFile))
 }
 }
 
 
 func TestLoadDaemonCliConfigWithConflicts(t *testing.T) {
 func TestLoadDaemonCliConfigWithConflicts(t *testing.T) {
@@ -164,7 +164,7 @@ func TestLoadDaemonConfigWithEmbeddedOptions(t *testing.T) {
 	loadedConfig, err := loadDaemonCliConfig(opts)
 	loadedConfig, err := loadDaemonCliConfig(opts)
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 	assert.Assert(t, loadedConfig != nil)
 	assert.Assert(t, loadedConfig != nil)
-	assert.Check(t, is.Equal("/etc/certs/ca.pem", loadedConfig.CommonTLSOptions.CAFile))
+	assert.Check(t, is.Equal("/etc/certs/ca.pem", loadedConfig.TLSOptions.CAFile))
 	assert.Check(t, is.Equal("syslog", loadedConfig.LogConfig.Type))
 	assert.Check(t, is.Equal("syslog", loadedConfig.LogConfig.Type))
 }
 }
 
 

+ 4 - 4
daemon/config/config.go

@@ -71,7 +71,7 @@ var builtinRuntimes = map[string]bool{
 // flatOptions contains configuration keys
 // flatOptions contains configuration keys
 // that MUST NOT be parsed as deep structures.
 // that MUST NOT be parsed as deep structures.
 // Use this to differentiate these options
 // Use this to differentiate these options
-// with others like the ones in CommonTLSOptions.
+// with others like the ones in TLSOptions.
 var flatOptions = map[string]bool{
 var flatOptions = map[string]bool{
 	"cluster-store-opts": true,
 	"cluster-store-opts": true,
 	"log-opts":           true,
 	"log-opts":           true,
@@ -124,10 +124,10 @@ type NetworkConfig struct {
 	NetworkControlPlaneMTU int `json:"network-control-plane-mtu,omitempty"`
 	NetworkControlPlaneMTU int `json:"network-control-plane-mtu,omitempty"`
 }
 }
 
 
-// CommonTLSOptions defines TLS configuration for the daemon server.
+// TLSOptions defines TLS configuration for the daemon server.
 // It includes json tags to deserialize configuration from a file
 // It includes json tags to deserialize configuration from a file
 // using the same names that the flags in the command line use.
 // using the same names that the flags in the command line use.
-type CommonTLSOptions struct {
+type TLSOptions struct {
 	CAFile   string `json:"tlscacert,omitempty"`
 	CAFile   string `json:"tlscacert,omitempty"`
 	CertFile string `json:"tlscert,omitempty"`
 	CertFile string `json:"tlscert,omitempty"`
 	KeyFile  string `json:"tlskey,omitempty"`
 	KeyFile  string `json:"tlskey,omitempty"`
@@ -196,7 +196,7 @@ type CommonConfig struct {
 
 
 	// Embedded structs that allow config
 	// Embedded structs that allow config
 	// deserialization without the full struct.
 	// deserialization without the full struct.
-	CommonTLSOptions
+	TLSOptions
 
 
 	// SwarmDefaultAdvertiseAddr is the default host/IP or network interface
 	// SwarmDefaultAdvertiseAddr is the default host/IP or network interface
 	// to use if a wildcard address is specified in the ListenAddr value
 	// to use if a wildcard address is specified in the ListenAddr value