From 336a23492726581417eac2efccb7f96fb83d7664 Mon Sep 17 00:00:00 2001 From: FFMMM Date: Thu, 9 Dec 2021 15:36:11 -0800 Subject: [PATCH] [sync ent] increase segment max limit to 4*64, make configurable (#1424) (#11795) * commit b6eb27563e747a78b7647d2b5da405e46364cc46 Author: FFMMM Date: Thu Dec 9 13:53:44 2021 -0800 increase segment max limit to 4*64, make configurable (#1424) Signed-off-by: FFMMM * fix: rename ent changelog file Signed-off-by: FFMMM --- .changelog/_1424.txt | 3 +++ agent/config/builder.go | 2 +- agent/config/default.go | 7 ++++--- agent/config/runtime_test.go | 3 ++- agent/config/testdata/full-config.hcl | 1 + agent/config/testdata/full-config.json | 1 + 6 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 .changelog/_1424.txt diff --git a/.changelog/_1424.txt b/.changelog/_1424.txt new file mode 100644 index 000000000..e082d68b8 --- /dev/null +++ b/.changelog/_1424.txt @@ -0,0 +1,3 @@ +```release-note:feature +networking: **(Enterprise Only)** Make `segment_limit` configurable, cap at 256. +``` \ No newline at end of file diff --git a/agent/config/builder.go b/agent/config/builder.go index a022f8846..7f3ab5e4e 100644 --- a/agent/config/builder.go +++ b/agent/config/builder.go @@ -817,7 +817,6 @@ func (b *builder) build() (rt RuntimeConfig, err error) { CheckDeregisterIntervalMin: b.durationVal("check_deregister_interval_min", c.CheckDeregisterIntervalMin), CheckReapInterval: b.durationVal("check_reap_interval", c.CheckReapInterval), Revision: stringVal(c.Revision), - SegmentLimit: intVal(c.SegmentLimit), SegmentNameLimit: intVal(c.SegmentNameLimit), SyncCoordinateIntervalMin: b.durationVal("sync_coordinate_interval_min", c.SyncCoordinateIntervalMin), SyncCoordinateRateTarget: float64Val(c.SyncCoordinateRateTarget), @@ -1058,6 +1057,7 @@ func (b *builder) build() (rt RuntimeConfig, err error) { RetryJoinWAN: b.expandAllOptionalAddrs("retry_join_wan", c.RetryJoinWAN), SegmentName: stringVal(c.SegmentName), Segments: segments, + SegmentLimit: intVal(c.SegmentLimit), SerfAdvertiseAddrLAN: serfAdvertiseAddrLAN, SerfAdvertiseAddrWAN: serfAdvertiseAddrWAN, SerfAllowedCIDRsLAN: serfAllowedCIDRSLAN, diff --git a/agent/config/default.go b/agent/config/default.go index bb8ad905c..691e7f081 100644 --- a/agent/config/default.go +++ b/agent/config/default.go @@ -49,6 +49,10 @@ func DefaultSource() Source { protocol = ` + strconv.Itoa(consul.DefaultRPCProtocol) + ` retry_interval = "30s" retry_interval_wan = "30s" + + # segment_limit is the maximum number of network segments that may be declared. Default 64 is highly encouraged + segment_limit = 64 + server = false syslog_facility = "LOCAL0" tls_min_version = "tls12" @@ -185,9 +189,6 @@ func NonUserSource() Source { sync_coordinate_rate_target = 64 sync_coordinate_interval_min = "15s" - # segment_limit is the maximum number of network segments that may be declared. - segment_limit = 64 - # SegmentNameLimit is the maximum segment name length. segment_name_limit = 64 diff --git a/agent/config/runtime_test.go b/agent/config/runtime_test.go index 63b216268..6f3236d33 100644 --- a/agent/config/runtime_test.go +++ b/agent/config/runtime_test.go @@ -4416,6 +4416,7 @@ func TestLoad_IntegrationWithFlags(t *testing.T) { rt.HTTPSHandshakeTimeout = 5 * time.Second rt.HTTPMaxConnsPerClient = 200 rt.RPCMaxConnsPerClient = 100 + rt.SegmentLimit = 64 }, }) @@ -5308,7 +5309,6 @@ func TestLoad_FullConfig(t *testing.T) { AEInterval: time.Minute, CheckDeregisterIntervalMin: time.Minute, CheckReapInterval: 30 * time.Second, - SegmentLimit: 64, SegmentNameLimit: 64, SyncCoordinateIntervalMin: 15 * time.Second, SyncCoordinateRateTarget: 64, @@ -5631,6 +5631,7 @@ func TestLoad_FullConfig(t *testing.T) { RetryJoinMaxAttemptsWAN: 23160, RetryJoinWAN: []string{"PFsR02Ye", "rJdQIhER"}, RPCConfig: consul.RPCConfig{EnableStreaming: true}, + SegmentLimit: 123, SerfPortLAN: 8301, SerfPortWAN: 8302, ServerMode: true, diff --git a/agent/config/testdata/full-config.hcl b/agent/config/testdata/full-config.hcl index 869f67252..f88612d9e 100644 --- a/agent/config/testdata/full-config.hcl +++ b/agent/config/testdata/full-config.hcl @@ -345,6 +345,7 @@ retry_max_wan = 23160 rpc { enable_streaming = true } +segment_limit = 123 serf_lan = "99.43.63.15" serf_wan = "67.88.33.19" server = true diff --git a/agent/config/testdata/full-config.json b/agent/config/testdata/full-config.json index 017651d88..0d2497835 100644 --- a/agent/config/testdata/full-config.json +++ b/agent/config/testdata/full-config.json @@ -341,6 +341,7 @@ "retry_max": 913, "retry_max_wan": 23160, "rpc": {"enable_streaming": true}, + "segment_limit": 123, "serf_lan": "99.43.63.15", "serf_wan": "67.88.33.19", "server": true,