From 8051f7bb89c4a106ea1cb7abea6e29f10655b272 Mon Sep 17 00:00:00 2001 From: ShuNing Date: Mon, 10 Jun 2019 17:42:38 +0800 Subject: [PATCH] config: disable label check by default (#1568) Signed-off-by: nolouch --- server/api/store_test.go | 10 ++++++++-- server/config.go | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/server/api/store_test.go b/server/api/store_test.go index 30bdab57b50..dccd56bdd17 100644 --- a/server/api/store_test.go +++ b/server/api/store_test.go @@ -147,6 +147,12 @@ func (s *testStoreSuite) TestStoreLabel(c *C) { c.Assert(err, IsNil) c.Assert(info.Store.Labels, HasLen, 0) + // Test merge. + // enable label match check. + labelCheck := map[string]string{"strictly-match-label": "true"} + lc, _ := json.Marshal(labelCheck) + err = postJSON(s.urlPrefix+"/config", lc) + c.Assert(err, IsNil) // Test set. labels := map[string]string{"zone": "cn", "host": "local"} b, err := json.Marshal(labels) @@ -169,8 +175,8 @@ func (s *testStoreSuite) TestStoreLabel(c *C) { // Test merge. // disable label match check. - labelCheck := map[string]string{"strictly-match-label": "false"} - lc, _ := json.Marshal(labelCheck) + labelCheck = map[string]string{"strictly-match-label": "false"} + lc, _ = json.Marshal(labelCheck) err = postJSON(s.urlPrefix+"/config", lc) c.Assert(err, IsNil) diff --git a/server/config.go b/server/config.go index ce2a3ae700c..36cda4aebcc 100644 --- a/server/config.go +++ b/server/config.go @@ -198,7 +198,7 @@ const ( defaultLeaderPriorityCheckInterval = time.Minute defaultUseRegionStorage = true - defaultStrictlyMatchLabel = true + defaultStrictlyMatchLabel = false ) func adjustString(v *string, defValue string) {