From a6cfdbb32475d1078bd0d24cc6e2222a7cf94072 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 20 Jun 2023 18:54:27 +0300 Subject: [PATCH 1/3] node, ir: Remove deprecated morph config sections Signed-off-by: Pavel Karpy --- CHANGELOG.md | 3 +++ cmd/neofs-node/config/morph/config.go | 18 +----------------- docs/storage-node-configuration.md | 6 +++--- pkg/innerring/config.go | 7 +------ pkg/innerring/config_test.go | 9 ++++----- pkg/innerring/innerring.go | 12 ------------ 6 files changed, 12 insertions(+), 43 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 016e611c50..624f83a337 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Changelog for NeoFS Node ### Fixed ### Removed +- Deprecated `morph.rpc_endpoint` SN and `morph.endpoint.client` IR config sections (#2400) ### Changed - CLI `--timeout` flag configures whole execution timeout from now (#2124) @@ -23,6 +24,8 @@ on timeout, try increasing the value, for example, twice. Also note that the execution of commands with the `--await` flag and without an explicitly specified time period is now limited to 1 minute. This value can be changed with `--timeout` flag. +Deprecated `morph.rpc_endpoint` SN and `morph.endpoint.client` IR configurations +have been removed. Use `morph.endpoints` for both instead. ## [0.37.0] - 2023-06-15 - Sogado diff --git a/cmd/neofs-node/config/morph/config.go b/cmd/neofs-node/config/morph/config.go index a39b8ba0c7..e50d679168 100644 --- a/cmd/neofs-node/config/morph/config.go +++ b/cmd/neofs-node/config/morph/config.go @@ -2,7 +2,6 @@ package morphconfig import ( "fmt" - "strconv" "time" "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config" @@ -30,24 +29,9 @@ const ( // // Throws panic if list is empty. func Endpoints(c *config.Config) []string { - var endpointsDeprecated []string - - sub := c.Sub(subsection).Sub("rpc_endpoint") - for i := 0; ; i++ { - s := sub.Sub(strconv.FormatInt(int64(i), 10)) - addr := config.StringSafe(s, "address") - if addr == "" { - break - } - - endpointsDeprecated = append(endpointsDeprecated, addr) - } - endpoints := config.StringSliceSafe(c.Sub(subsection), "endpoints") - endpoints = append(endpoints, endpointsDeprecated...) - if len(endpoints) == 0 { - panic(fmt.Errorf("no morph chain RPC endpoints, see `morph.rpc_endpoint` section")) + panic(fmt.Errorf("no morph chain RPC endpoints, see `morph.endpoints` section")) } return endpoints } diff --git a/docs/storage-node-configuration.md b/docs/storage-node-configuration.md index 8e31fe9f0c..ad24e680d5 100644 --- a/docs/storage-node-configuration.md +++ b/docs/storage-node-configuration.md @@ -132,9 +132,9 @@ contracts: morph: dial_timeout: 30s cache_ttl: 15s - rpc_endpoint: - - address: wss://rpc1.morph.fs.neo.org:40341/ws - - address: wss://rpc2.morph.fs.neo.org:40341/ws + endpoints: + - wss://rpc1.morph.fs.neo.org:40341/ws + - wss://rpc2.morph.fs.neo.org:40341/ws ``` | Parameter | Type | Default value | Description | diff --git a/pkg/innerring/config.go b/pkg/innerring/config.go index 0315216ab3..464ba962d5 100644 --- a/pkg/innerring/config.go +++ b/pkg/innerring/config.go @@ -22,12 +22,7 @@ import ( // checks if Inner Ring app is configured to be launched in local consensus // mode. func isLocalConsensusMode(cfg *viper.Viper) bool { - const morphRPCSectionDeprecated = "morph.endpoint.client" - // first expression required for ENVs in which nesting breaks - deprecatedNotSet := !cfg.IsSet(morphRPCSectionDeprecated+".0.address") && !cfg.IsSet(morphRPCSectionDeprecated) - actualNotSet := !cfg.IsSet("morph.endpoints") - - return deprecatedNotSet && actualNotSet + return !cfg.IsSet("morph.endpoints") } func parseBlockchainConfig(v *viper.Viper, _logger *logger.Logger) (c blockchain.Config, err error) { diff --git a/pkg/innerring/config_test.go b/pkg/innerring/config_test.go index 1af5a65413..2945c34a3f 100644 --- a/pkg/innerring/config_test.go +++ b/pkg/innerring/config_test.go @@ -401,7 +401,7 @@ func TestIsLocalConsensusMode(t *testing.T) { v.SetEnvPrefix("neofs_ir") v.SetEnvKeyReplacer(strings.NewReplacer(".", "_")) - const envKey = "NEOFS_IR_MORPH_ENDPOINT_CLIENT_0_ADDRESS" + const envKey = "NEOFS_IR_MORPH_ENDPOINTS" err := os.Unsetenv(envKey) require.NoError(t, err) @@ -419,15 +419,14 @@ func TestIsLocalConsensusMode(t *testing.T) { v.SetConfigType("yaml") err := v.ReadConfig(strings.NewReader(` morph: - endpoint: - client: - - address: ws://morph-chain:30333/ws + endpoints: + - ws://morph-chain:30333/ws `)) require.NoError(t, err) require.False(t, isLocalConsensusMode(v)) - resetConfig(t, v, "morph.endpoint.client") + resetConfig(t, v, "morph.endpoints") require.True(t, isLocalConsensusMode(v)) }) diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 5452f381c4..c86727fde7 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -1019,18 +1019,6 @@ func createListener(ctx context.Context, cli *client.Client, p *chainParams) (ev func createClient(ctx context.Context, p *chainParams, errChan chan<- error) (*client.Client, error) { endpoints := p.cfg.GetStringSlice(p.name + ".endpoints") - - // deprecated endpoints with priorities - section := p.name + ".endpoint.client" - for i := 0; ; i++ { - addr := p.cfg.GetString(fmt.Sprintf("%s.%d.%s", section, i, "address")) - if addr == "" { - break - } - - endpoints = append(endpoints, addr) - } - if len(endpoints) == 0 { return nil, fmt.Errorf("%s chain client endpoints not provided", p.name) } From 809310575a8d439d8c7dac55d65fe2156dc0c965 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 20 Jun 2023 19:06:14 +0300 Subject: [PATCH 2/3] node, ir: Remove deprecated metrics Signed-off-by: Pavel Karpy --- CHANGELOG.md | 4 ++++ pkg/metrics/innerring.go | 21 ++------------------- pkg/metrics/metrics.go | 17 +---------------- 3 files changed, 7 insertions(+), 35 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 624f83a337..11a682281b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Changelog for NeoFS Node ### Removed - Deprecated `morph.rpc_endpoint` SN and `morph.endpoint.client` IR config sections (#2400) +- `neofs_node_object_epoch` metric for IR and SN (#2347) ### Changed - CLI `--timeout` flag configures whole execution timeout from now (#2124) @@ -26,6 +27,9 @@ specified time period is now limited to 1 minute. This value can be changed with `--timeout` flag. Deprecated `morph.rpc_endpoint` SN and `morph.endpoint.client` IR configurations have been removed. Use `morph.endpoints` for both instead. +Deprecated `neofs_node_object_epoch` metric for IR and SN (the same for both) +has been removed. Use `neofs_node_state_epoch` for SN and `neofs_ir_state_epoch` +for IR instead. ## [0.37.0] - 2023-06-15 - Sogado diff --git a/pkg/metrics/innerring.go b/pkg/metrics/innerring.go index 201efac659..9492c29170 100644 --- a/pkg/metrics/innerring.go +++ b/pkg/metrics/innerring.go @@ -1,21 +1,14 @@ package metrics import ( - "fmt" - "github.com/prometheus/client_golang/prometheus" ) const innerRingNameSpace = "neofs_ir" -// FIXME: drop after v0.38.0 release: #2347. -const innerRingNameSpaceDeprecated = storageNodeNameSpace -const innerRingSubsystemDeprecated = objectSubsystem - // InnerRingServiceMetrics contains metrics collected by inner ring. type InnerRingServiceMetrics struct { - epoch prometheus.Gauge - epochDeprecated prometheus.Gauge + epoch prometheus.Gauge } // NewInnerRingMetrics returns new instance of metrics collectors for inner ring. @@ -30,22 +23,12 @@ func NewInnerRingMetrics(version string) InnerRingServiceMetrics { }) prometheus.MustRegister(epoch) - epochDeprecated := prometheus.NewGauge(prometheus.GaugeOpts{ - Namespace: innerRingNameSpaceDeprecated, - Subsystem: innerRingSubsystemDeprecated, - Name: "epoch", - Help: fmt.Sprintf("Current epoch as seen by inner-ring node. DEPRECATED: use [%s_%s_epoch] instead.", innerRingNameSpace, stateSubsystem), - }) - prometheus.MustRegister(epochDeprecated) - return InnerRingServiceMetrics{ - epoch: epoch, - epochDeprecated: epochDeprecated, + epoch: epoch, } } // SetEpoch updates epoch metrics. func (m InnerRingServiceMetrics) SetEpoch(epoch uint64) { m.epoch.Set(float64(epoch)) - m.epochDeprecated.Set(float64(epoch)) } diff --git a/pkg/metrics/metrics.go b/pkg/metrics/metrics.go index debe68eadf..14275d6cdf 100644 --- a/pkg/metrics/metrics.go +++ b/pkg/metrics/metrics.go @@ -1,8 +1,6 @@ package metrics import ( - "fmt" - "github.com/prometheus/client_golang/prometheus" ) @@ -12,8 +10,7 @@ type NodeMetrics struct { objectServiceMetrics engineMetrics stateMetrics - epoch prometheus.Gauge - epochDeprecated prometheus.Gauge + epoch prometheus.Gauge } func NewNodeMetrics(version string) *NodeMetrics { @@ -36,27 +33,15 @@ func NewNodeMetrics(version string) *NodeMetrics { }) prometheus.MustRegister(epoch) - // FIXME: drop after v0.38.0 release: #2347. - const stateSubsystemDeprecated = objectSubsystem - epochDeprecated := prometheus.NewGauge(prometheus.GaugeOpts{ - Namespace: storageNodeNameSpace, - Subsystem: stateSubsystemDeprecated, - Name: "epoch", - Help: fmt.Sprintf("Current epoch as seen by inner-ring node. DEPRECATED: use [%s_%s_epoch] instead.", storageNodeNameSpace, stateSubsystem), - }) - prometheus.MustRegister(epochDeprecated) - return &NodeMetrics{ objectServiceMetrics: objectService, engineMetrics: engine, stateMetrics: state, epoch: epoch, - epochDeprecated: epochDeprecated, } } // SetEpoch updates epoch metric. func (m *NodeMetrics) SetEpoch(epoch uint64) { m.epoch.Set(float64(epoch)) - m.epochDeprecated.Set(float64(epoch)) } From 10eb098e59758471ddf106caf47991552df23074 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 21 Jun 2023 15:43:44 +0300 Subject: [PATCH 3/3] adm: Generate actual RPC config Signed-off-by: Pavel Karpy --- cmd/neofs-adm/internal/modules/storagecfg/config.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/neofs-adm/internal/modules/storagecfg/config.go b/cmd/neofs-adm/internal/modules/storagecfg/config.go index 1efe0751b0..3f19e749e0 100644 --- a/cmd/neofs-adm/internal/modules/storagecfg/config.go +++ b/cmd/neofs-adm/internal/modules/storagecfg/config.go @@ -38,9 +38,9 @@ control: morph: dial_timeout: 20s # timeout for side chain NEO RPC client connection cache_ttl: 15s # use TTL cache for side chain GET operations - rpc_endpoint: # side chain N3 RPC endpoints + endpoints: # side chain N3 RPC endpoints {{- range .MorphRPC }} - - address: wss://{{.}}/ws{{end}} + - wss://{{.}}/ws{{end}} {{if not .Relay }} storage: shard_pool_size: 15 # size of per-shard worker pools used for PUT operations