Browse code

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>

Anca Iordache authored on 2020/02/13 02:29:30
Showing 2 changed files
... ...
@@ -68,9 +68,14 @@ func installCommonConfigFlags(conf *config.Config, flags *pflag.FlagSet) error {
68 68
 	flags.Var(opts.NewNamedListOptsRef("labels", &conf.Labels, opts.ValidateLabel), "label", "Set key=value labels to the daemon")
69 69
 	flags.StringVar(&conf.LogConfig.Type, "log-driver", "json-file", "Default driver for container logs")
70 70
 	flags.Var(opts.NewNamedMapOpts("log-opts", conf.LogConfig.Config, nil), "log-opt", "Default log driver options for containers")
71
+
71 72
 	flags.StringVar(&conf.ClusterAdvertise, "cluster-advertise", "", "Address or interface name to advertise")
73
+	_ = flags.MarkDeprecated("cluster-advertise", "Deprecated option.")
72 74
 	flags.StringVar(&conf.ClusterStore, "cluster-store", "", "URL of the distributed storage backend")
75
+	_ = flags.MarkDeprecated("cluster-store", "Deprecated option.")
73 76
 	flags.Var(opts.NewNamedMapOpts("cluster-store-opts", conf.ClusterOpts, nil), "cluster-store-opt", "Set cluster store options")
77
+	_ = flags.MarkDeprecated("cluster-store-opts", "Deprecated option.")
78
+
74 79
 	flags.StringVar(&conf.CorsHeaders, "api-cors-header", "", "Set CORS headers in the Engine API")
75 80
 	flags.IntVar(&maxConcurrentDownloads, "max-concurrent-downloads", config.DefaultMaxConcurrentDownloads, "Set the max concurrent downloads for each pull")
76 81
 	flags.IntVar(&maxConcurrentUploads, "max-concurrent-uploads", config.DefaultMaxConcurrentUploads, "Set the max concurrent uploads for each push")
... ...
@@ -85,6 +85,7 @@ func (cli *DaemonCli) start(opts *daemonOptions) (err error) {
85 85
 	if cli.Config, err = loadDaemonCliConfig(opts); err != nil {
86 86
 		return err
87 87
 	}
88
+	warnOnDeprecatedConfigOptions(cli.Config)
88 89
 
89 90
 	if err := configureDaemonLogs(cli.Config); err != nil {
90 91
 		return err
... ...
@@ -469,6 +470,18 @@ func loadDaemonCliConfig(opts *daemonOptions) (*config.Config, error) {
469 469
 	return conf, nil
470 470
 }
471 471
 
472
+func warnOnDeprecatedConfigOptions(config *config.Config) {
473
+	if config.ClusterAdvertise != "" {
474
+		logrus.Warn(`The "cluster-advertise" option is deprecated. To be removed soon.`)
475
+	}
476
+	if config.ClusterStore != "" {
477
+		logrus.Warn(`The "cluster-store" option is deprecated. To be removed soon.`)
478
+	}
479
+	if len(config.ClusterOpts) > 0 {
480
+		logrus.Warn(`The "cluster-store-opt" option is deprecated. To be removed soon.`)
481
+	}
482
+}
483
+
472 484
 func initRouter(opts routerOptions) {
473 485
 	decoder := runconfig.ContainerDecoder{}
474 486