core: remove support for raft protocol version 2
This PR checks server config for raft_protocol, which must now be set to 3 or unset (0). When unset, version 3 is used as the default.
This commit is contained in:
parent
7b7c72b21d
commit
91e08d5e23
|
@ -0,0 +1,3 @@
|
|||
```release-note:breaking-change
|
||||
core: remove support for raft protocol version 2
|
||||
```
|
|
@ -201,6 +201,9 @@ func convertServerConfig(agentConfig *Config) (*nomad.Config, error) {
|
|||
if agentConfig.Server.RaftProtocol != 0 {
|
||||
conf.RaftConfig.ProtocolVersion = raft.ProtocolVersion(agentConfig.Server.RaftProtocol)
|
||||
}
|
||||
if v := conf.RaftConfig.ProtocolVersion; v != 3 {
|
||||
return nil, fmt.Errorf("raft_protocol must be 3 in Nomad v1.4 and later, got %d", v)
|
||||
}
|
||||
raftMultiplier := int(DefaultRaftMultiplier)
|
||||
if agentConfig.Server.RaftMultiplier != nil && *agentConfig.Server.RaftMultiplier != 0 {
|
||||
raftMultiplier = *agentConfig.Server.RaftMultiplier
|
||||
|
|
|
@ -15,6 +15,7 @@ import (
|
|||
"github.com/hashicorp/nomad/helper/testlog"
|
||||
"github.com/hashicorp/nomad/nomad/structs"
|
||||
"github.com/hashicorp/nomad/nomad/structs/config"
|
||||
"github.com/shoenig/test/must"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
@ -472,6 +473,31 @@ func TestAgent_ServerConfig_RaftMultiplier_Bad(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestAgent_ServerConfig_RaftProtocol_3(t *testing.T) {
|
||||
ci.Parallel(t)
|
||||
|
||||
cases := []int{
|
||||
0, 1, 2, 3, 4,
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
t.Run(fmt.Sprintf("protocol_version %d", tc), func(t *testing.T) {
|
||||
conf := DevConfig(nil)
|
||||
conf.Server.RaftProtocol = tc
|
||||
must.NoError(t, conf.normalizeAddrs())
|
||||
_, err := convertServerConfig(conf)
|
||||
|
||||
switch tc {
|
||||
case 0, 3: // 0 defers to default
|
||||
must.NoError(t, err)
|
||||
default:
|
||||
exp := fmt.Sprintf("raft_protocol must be 3 in Nomad v1.4 and later, got %d", tc)
|
||||
must.EqError(t, err, exp)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestAgent_ClientConfig(t *testing.T) {
|
||||
ci.Parallel(t)
|
||||
conf := DefaultConfig()
|
||||
|
|
|
@ -166,7 +166,8 @@ server {
|
|||
- `raft_protocol` `(int: 3)` - Specifies the Raft protocol version to use when
|
||||
communicating with other Nomad servers. This affects available Autopilot
|
||||
features and is typically not required as the agent internally knows the
|
||||
latest version, but may be useful in some upgrade scenarios.
|
||||
latest version, but may be useful in some upgrade scenarios. Must be `3` in
|
||||
Nomad v1.4 or later.
|
||||
|
||||
- `raft_multiplier` `(int: 1)` - An integer multiplier used by Nomad servers to
|
||||
scale key Raft timing parameters. Omitting this value or setting it to 0 uses
|
||||
|
|
|
@ -22,6 +22,16 @@ upgrade. However, specific versions of Nomad may have more details provided for
|
|||
their upgrades as a result of new features or changed behavior. This page is
|
||||
used to document those details separately from the standard upgrade flow.
|
||||
|
||||
## Nomad 1.4.0
|
||||
|
||||
#### Raft Protocol Version 2 Unsupported
|
||||
|
||||
Raft protocol version 2 was deprecated in Nomad v1.3.0, and is being removed
|
||||
in Nomad v1.4.0. In Nomad 1.3.0, the default raft protocol version was updated
|
||||
to version 3, and in Nomad 1.4.0 Nomad requires the use of raft protocol version
|
||||
3. If [`raft_protocol`] version is explicitly set, it must now be set to `3`.
|
||||
For more information see the [Upgrading to Raft Protocol 3] guide.
|
||||
|
||||
## Nomad 1.3.1, 1.2.8, 1.1.14
|
||||
|
||||
#### Default `artifact` limits
|
||||
|
@ -42,7 +52,7 @@ Raft protocol version 2 will be removed from Nomad in the next major
|
|||
release of Nomad, 1.4.0.
|
||||
|
||||
In Nomad 1.3.0, the default raft protocol version has been updated to
|
||||
3. If the [`raft_protocol_version`] is not explicitly set, upgrading a
|
||||
3. If the [`raft_protocol`] version is not explicitly set, upgrading a
|
||||
server will automatically upgrade that server's raft protocol. See the
|
||||
[Upgrading to Raft Protocol 3] guide.
|
||||
|
||||
|
@ -1407,7 +1417,7 @@ deleted and then Nomad 0.3.0 can be launched.
|
|||
[preemption]: /docs/internals/scheduling/preemption
|
||||
[proxy_concurrency]: /docs/job-specification/sidecar_task#proxy_concurrency
|
||||
[`sidecar_task.config`]: /docs/job-specification/sidecar_task#config
|
||||
[`raft_protocol_version`]: /docs/configuration/server#raft_protocol
|
||||
[`raft_protocol`]: /docs/configuration/server#raft_protocol
|
||||
[`raft protocol`]: /docs/configuration/server#raft_protocol
|
||||
[reserved]: /docs/configuration/client#reserved-parameters
|
||||
[task-config]: /docs/job-specification/task#config
|
||||
|
|
Loading…
Reference in New Issue