@@ -145,15 +145,21 @@ type TLSConfig struct {
145145
146146// Registry is registry settings configured
147147type Registry struct {
148+ // ConfigPath is a path to the root directory containing registry-specific
149+ // configurations.
150+ // If ConfigPath is set, the rest of the registry specific options are ignored.
151+ ConfigPath string `toml:"config_path" json:"configPath"`
148152 // Mirrors are namespace to mirror mapping for all namespaces.
153+ // This option will not be used when ConfigPath is provided.
154+ // DEPRECATED: Use ConfigPath instead. Remove in containerd 1.7.
149155 Mirrors map [string ]Mirror `toml:"mirrors" json:"mirrors"`
150156 // Configs are configs for each registry.
151157 // The key is the domain name or IP of the registry.
158+ // This option will be fully deprecated for ConfigPath in the future.
152159 Configs map [string ]RegistryConfig `toml:"configs" json:"configs"`
153-
154160 // Auths are registry endpoint to auth config mapping. The registry endpoint must
155161 // be a valid url with host specified.
156- // DEPRECATED: Use Configs instead. Remove in containerd 1.4 .
162+ // DEPRECATED: Use ConfigPath instead. Remove in containerd 1.6 .
157163 Auths map [string ]AuthConfig `toml:"auths" json:"auths"`
158164 // Headers adds additional HTTP headers that get sent to all registries
159165 Headers map [string ][]string `toml:"headers" json:"headers"`
@@ -165,6 +171,8 @@ type RegistryConfig struct {
165171 Auth * AuthConfig `toml:"auth" json:"auth"`
166172 // TLS is a pair of CA/Cert/Key which then are used when creating the transport
167173 // that communicates with the registry.
174+ // This field will not be used when ConfigPath is provided.
175+ // DEPRECATED: Use ConfigPath instead. Remove in containerd 1.7.
168176 TLS * TLSConfig `toml:"tls" json:"tls"`
169177}
170178
@@ -351,6 +359,27 @@ func ValidatePluginConfig(ctx context.Context, c *PluginConfig) error {
351359 }
352360 }
353361
362+ useConfigPath := c .Registry .ConfigPath != ""
363+ if len (c .Registry .Mirrors ) > 0 {
364+ if useConfigPath {
365+ return errors .Errorf ("`mirrors` cannot be set when `config_path` is provided" )
366+ }
367+ log .G (ctx ).Warning ("`mirrors` is deprecated, please use `config_path` instead" )
368+ }
369+ var hasDeprecatedTLS bool
370+ for _ , r := range c .Registry .Configs {
371+ if r .TLS != nil {
372+ hasDeprecatedTLS = true
373+ break
374+ }
375+ }
376+ if hasDeprecatedTLS {
377+ if useConfigPath {
378+ return errors .Errorf ("`configs.tls` cannot be set when `config_path` is provided" )
379+ }
380+ log .G (ctx ).Warning ("`configs.tls` is deprecated, please use `config_path` instead" )
381+ }
382+
354383 // Validation for deprecated auths options and mapping it to configs.
355384 if len (c .Registry .Auths ) != 0 {
356385 if c .Registry .Configs == nil {
@@ -370,7 +399,7 @@ func ValidatePluginConfig(ctx context.Context, c *PluginConfig) error {
370399 config .Auth = & auth
371400 c .Registry .Configs [endpoint ] = config
372401 }
373- log .G (ctx ).Warning ("`auths` is deprecated, please use registry `configs` instead" )
402+ log .G (ctx ).Warning ("`auths` is deprecated, please use `configs` instead" )
374403 }
375404
376405 // Validation for stream_idle_timeout
0 commit comments