1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Deprecate '--cluster-xx' options and add warning

Co-authored-by: Yves Brissaud <yves.brissaud@gmail.com>

Signed-off-by: Anca Iordache <anca.iordache@docker.com>
This commit is contained in:
Anca Iordache 2020-02-12 18:29:30 +01:00
parent 58c2615208
commit 1470697b67
2 changed files with 18 additions and 0 deletions

View file

@ -68,9 +68,14 @@ func installCommonConfigFlags(conf *config.Config, flags *pflag.FlagSet) error {
flags.Var(opts.NewNamedListOptsRef("labels", &conf.Labels, opts.ValidateLabel), "label", "Set key=value labels to the daemon") flags.Var(opts.NewNamedListOptsRef("labels", &conf.Labels, opts.ValidateLabel), "label", "Set key=value labels to the daemon")
flags.StringVar(&conf.LogConfig.Type, "log-driver", "json-file", "Default driver for container logs") flags.StringVar(&conf.LogConfig.Type, "log-driver", "json-file", "Default driver for container logs")
flags.Var(opts.NewNamedMapOpts("log-opts", conf.LogConfig.Config, nil), "log-opt", "Default log driver options for containers") flags.Var(opts.NewNamedMapOpts("log-opts", conf.LogConfig.Config, nil), "log-opt", "Default log driver options for containers")
flags.StringVar(&conf.ClusterAdvertise, "cluster-advertise", "", "Address or interface name to advertise") flags.StringVar(&conf.ClusterAdvertise, "cluster-advertise", "", "Address or interface name to advertise")
_ = flags.MarkDeprecated("cluster-advertise", "Deprecated option.")
flags.StringVar(&conf.ClusterStore, "cluster-store", "", "URL of the distributed storage backend") flags.StringVar(&conf.ClusterStore, "cluster-store", "", "URL of the distributed storage backend")
_ = flags.MarkDeprecated("cluster-store", "Deprecated option.")
flags.Var(opts.NewNamedMapOpts("cluster-store-opts", conf.ClusterOpts, nil), "cluster-store-opt", "Set cluster store options") flags.Var(opts.NewNamedMapOpts("cluster-store-opts", conf.ClusterOpts, nil), "cluster-store-opt", "Set cluster store options")
_ = flags.MarkDeprecated("cluster-store-opts", "Deprecated option.")
flags.StringVar(&conf.CorsHeaders, "api-cors-header", "", "Set CORS headers in the Engine API") flags.StringVar(&conf.CorsHeaders, "api-cors-header", "", "Set CORS headers in the Engine API")
flags.IntVar(&maxConcurrentDownloads, "max-concurrent-downloads", config.DefaultMaxConcurrentDownloads, "Set the max concurrent downloads for each pull") flags.IntVar(&maxConcurrentDownloads, "max-concurrent-downloads", config.DefaultMaxConcurrentDownloads, "Set the max concurrent downloads for each pull")
flags.IntVar(&maxConcurrentUploads, "max-concurrent-uploads", config.DefaultMaxConcurrentUploads, "Set the max concurrent uploads for each push") flags.IntVar(&maxConcurrentUploads, "max-concurrent-uploads", config.DefaultMaxConcurrentUploads, "Set the max concurrent uploads for each push")

View file

@ -85,6 +85,7 @@ func (cli *DaemonCli) start(opts *daemonOptions) (err error) {
if cli.Config, err = loadDaemonCliConfig(opts); err != nil { if cli.Config, err = loadDaemonCliConfig(opts); err != nil {
return err return err
} }
warnOnDeprecatedConfigOptions(cli.Config)
if err := configureDaemonLogs(cli.Config); err != nil { if err := configureDaemonLogs(cli.Config); err != nil {
return err return err
@ -469,6 +470,18 @@ func loadDaemonCliConfig(opts *daemonOptions) (*config.Config, error) {
return conf, nil return conf, nil
} }
func warnOnDeprecatedConfigOptions(config *config.Config) {
if config.ClusterAdvertise != "" {
logrus.Warn(`The "cluster-advertise" option is deprecated. To be removed soon.`)
}
if config.ClusterStore != "" {
logrus.Warn(`The "cluster-store" option is deprecated. To be removed soon.`)
}
if len(config.ClusterOpts) > 0 {
logrus.Warn(`The "cluster-store-opt" option is deprecated. To be removed soon.`)
}
}
func initRouter(opts routerOptions) { func initRouter(opts routerOptions) {
decoder := runconfig.ContainerDecoder{} decoder := runconfig.ContainerDecoder{}