daemon/config: rename CommonTLSOptions to TLSOptions

This type was added in 677a6b3506, 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>
This commit is contained in:
Sebastiaan van Stijn 2022-12-15 10:26:50 +01:00
parent 07387913a8
commit 32b299f63e
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
3 changed files with 11 additions and 11 deletions

View file

@ -405,13 +405,13 @@ func loadDaemonCliConfig(opts *daemonOptions) (*config.Config, error) {
}
if opts.TLSOptions != nil {
conf.CommonTLSOptions = config.CommonTLSOptions{
conf.TLSOptions = config.TLSOptions{
CAFile: opts.TLSOptions.CAFile,
CertFile: opts.TLSOptions.CertFile,
KeyFile: opts.TLSOptions.KeyFile,
}
} else {
conf.CommonTLSOptions = config.CommonTLSOptions{}
conf.TLSOptions = config.TLSOptions{}
}
if opts.configFile != "" {
@ -609,9 +609,9 @@ func newAPIServerConfig(config *config.Config) (*apiserver.Config, error) {
clientAuth = tls.RequireAndVerifyClientCert
}
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,
ClientAuth: clientAuth,
})

View file

@ -48,7 +48,7 @@ func TestLoadDaemonCliConfigWithTLS(t *testing.T) {
loadedConfig, err := loadDaemonCliConfig(opts)
assert.NilError(t, err)
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) {
@ -164,7 +164,7 @@ func TestLoadDaemonConfigWithEmbeddedOptions(t *testing.T) {
loadedConfig, err := loadDaemonCliConfig(opts)
assert.NilError(t, err)
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))
}

View file

@ -71,7 +71,7 @@ var builtinRuntimes = map[string]bool{
// flatOptions contains configuration keys
// that MUST NOT be parsed as deep structures.
// 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{
"cluster-store-opts": true,
"log-opts": true,
@ -124,10 +124,10 @@ type NetworkConfig struct {
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
// using the same names that the flags in the command line use.
type CommonTLSOptions struct {
type TLSOptions struct {
CAFile string `json:"tlscacert,omitempty"`
CertFile string `json:"tlscert,omitempty"`
KeyFile string `json:"tlskey,omitempty"`
@ -196,7 +196,7 @@ type CommonConfig struct {
// Embedded structs that allow config
// deserialization without the full struct.
CommonTLSOptions
TLSOptions
// SwarmDefaultAdvertiseAddr is the default host/IP or network interface
// to use if a wildcard address is specified in the ListenAddr value