Sfoglia il codice sorgente

Merge pull request #9012 from gyuho/gyuho/help-flag

etcdmain: display default --enable-v2, --strict-reconfig-check value ("true")
Gyuho Lee 8 anni fa
parent
commit
014c375099
3 ha cambiato i file con 13 aggiunte e 5 eliminazioni
  1. 10 2
      embed/config.go
  2. 1 1
      etcdmain/config.go
  3. 2 2
      etcdmain/help.go

+ 10 - 2
embed/config.go

@@ -57,6 +57,14 @@ const (
 
 	DefaultLogOutput = "default"
 
+	// DefaultStrictReconfigCheck is the default value for "--strict-reconfig-check" flag.
+	// It's enabled by default.
+	DefaultStrictReconfigCheck = true
+	// DefaultEnableV2 is the default value for "--enable-v2" flag.
+	// v2 is enabled by default.
+	// TODO: disable v2 when deprecated.
+	DefaultEnableV2 = true
+
 	// maxElectionMs specifies the maximum value of election timeout.
 	// More details are listed in ../Documentation/tuning.md#time-parameters.
 	maxElectionMs = 50000
@@ -227,10 +235,10 @@ func NewConfig() *Config {
 		ACUrls:                []url.URL{*acurl},
 		ClusterState:          ClusterStateFlagNew,
 		InitialClusterToken:   "etcd-cluster",
-		StrictReconfigCheck:   true,
+		StrictReconfigCheck:   DefaultStrictReconfigCheck,
 		LogOutput:             DefaultLogOutput,
 		Metrics:               "basic",
-		EnableV2:              true,
+		EnableV2:              DefaultEnableV2,
 		AuthToken:             "simple",
 	}
 	cfg.InitialCluster = cfg.InitialClusterFromName(cfg.Name)

+ 1 - 1
etcdmain/config.go

@@ -160,7 +160,7 @@ func newConfig() *config {
 	fs.Var(cfg.cf.clusterState, "initial-cluster-state", "Initial cluster state ('new' or 'existing').")
 
 	fs.BoolVar(&cfg.ec.StrictReconfigCheck, "strict-reconfig-check", cfg.ec.StrictReconfigCheck, "Reject reconfiguration requests that would cause quorum loss.")
-	fs.BoolVar(&cfg.ec.EnableV2, "enable-v2", true, "Accept etcd V2 client requests.")
+	fs.BoolVar(&cfg.ec.EnableV2, "enable-v2", cfg.ec.EnableV2, "Accept etcd V2 client requests.")
 	fs.StringVar(&cfg.ec.ExperimentalEnableV2V3, "experimental-enable-v2v3", cfg.ec.ExperimentalEnableV2V3, "v3 prefix for serving emulated v2 state.")
 
 	// proxy

+ 2 - 2
etcdmain/help.go

@@ -100,13 +100,13 @@ clustering flags:
 		HTTP proxy to use for traffic to discovery service.
 	--discovery-srv ''
 		dns srv domain used to bootstrap the cluster.
-	--strict-reconfig-check
+	--strict-reconfig-check '` + strconv.FormatBool(embed.DefaultStrictReconfigCheck) + `'
 		reject reconfiguration requests that would cause quorum loss.
 	--auto-compaction-retention '0'
 		auto compaction retention length. 0 means disable auto compaction.
 	--auto-compaction-mode 'periodic'
 		interpret 'auto-compaction-retention' one of: periodic|revision. 'periodic' for duration based retention, defaulting to hours if no time unit is provided (e.g. '5m'). 'revision' for revision number based retention.
-	--enable-v2
+	--enable-v2 '` + strconv.FormatBool(embed.DefaultEnableV2) + `'
 		Accept etcd V2 client requests.
 
 proxy flags: