diff --git a/nomad/operator_endpoint.go b/nomad/operator_endpoint.go index 258e008fa..fc9edabdd 100644 --- a/nomad/operator_endpoint.go +++ b/nomad/operator_endpoint.go @@ -236,6 +236,11 @@ func (op *Operator) AutopilotSetConfiguration(args *structs.AutopilotSetConfigRe return structs.ErrPermissionDenied } + // All servers should be at or above 0.8.0 to apply this operatation + if !ServersMeetMinimumVersion(op.srv.Members(), minAutopilotVersion) { + return fmt.Errorf("All servers should be running version %v to update autopilot config", minAutopilotVersion) + } + // Apply the update resp, _, err := op.srv.raftApply(structs.AutopilotRequestType, args) if err != nil { @@ -299,6 +304,10 @@ func (op *Operator) SchedulerSetConfiguration(args *structs.SchedulerSetConfigRe return structs.ErrPermissionDenied } + // All servers should be at or above 0.9.0 to apply this operatation + if !ServersMeetMinimumVersion(op.srv.Members(), minSchedulerConfigVersion) { + return fmt.Errorf("All servers should be running version %v to update scheduler config", minSchedulerConfigVersion) + } // Apply the update resp, index, err := op.srv.raftApply(structs.SchedulerConfigRequestType, args) if err != nil { diff --git a/nomad/operator_endpoint_test.go b/nomad/operator_endpoint_test.go index 4f9d85345..2fa13e4d6 100644 --- a/nomad/operator_endpoint_test.go +++ b/nomad/operator_endpoint_test.go @@ -337,7 +337,9 @@ func TestOperator_RaftRemovePeerByID_ACL(t *testing.T) { func TestOperator_SchedulerGetConfiguration(t *testing.T) { t.Parallel() - s1 := TestServer(t, nil) + s1 := TestServer(t, func(c *Config) { + c.Build = "0.9.0+unittest" + }) defer s1.Shutdown() codec := rpcClient(t, s1) testutil.WaitForLeader(t, s1.RPC) @@ -358,7 +360,9 @@ func TestOperator_SchedulerGetConfiguration(t *testing.T) { func TestOperator_SchedulerSetConfiguration(t *testing.T) { t.Parallel() - s1 := TestServer(t, nil) + s1 := TestServer(t, func(c *Config) { + c.Build = "0.9.0+unittest" + }) defer s1.Shutdown() codec := rpcClient(t, s1) testutil.WaitForLeader(t, s1.RPC) @@ -399,6 +403,7 @@ func TestOperator_SchedulerGetConfiguration_ACL(t *testing.T) { t.Parallel() s1, root := TestACLServer(t, func(c *Config) { c.RaftConfig.ProtocolVersion = 3 + c.Build = "0.9.0+unittest" }) defer s1.Shutdown() codec := rpcClient(t, s1) @@ -444,6 +449,7 @@ func TestOperator_SchedulerSetConfiguration_ACL(t *testing.T) { t.Parallel() s1, root := TestACLServer(t, func(c *Config) { c.RaftConfig.ProtocolVersion = 3 + c.Build = "0.9.0+unittest" }) defer s1.Shutdown() codec := rpcClient(t, s1)