mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
api: actually set MemoryOversubscriptionEnabled (#10493)
This commit is contained in:
@@ -126,6 +126,9 @@ type SchedulerConfiguration struct {
|
||||
// priority jobs to place higher priority jobs.
|
||||
PreemptionConfig PreemptionConfig
|
||||
|
||||
// MemoryOversubscriptionEnabled specifies whether memory oversubscription is enabled
|
||||
MemoryOversubscriptionEnabled bool
|
||||
|
||||
// CreateIndex/ModifyIndex store the create/modify indexes of this configuration.
|
||||
CreateIndex uint64
|
||||
ModifyIndex uint64
|
||||
|
||||
@@ -259,7 +259,8 @@ func (s *HTTPServer) schedulerUpdateConfig(resp http.ResponseWriter, req *http.R
|
||||
}
|
||||
|
||||
args.Config = structs.SchedulerConfiguration{
|
||||
SchedulerAlgorithm: structs.SchedulerAlgorithm(conf.SchedulerAlgorithm),
|
||||
SchedulerAlgorithm: structs.SchedulerAlgorithm(conf.SchedulerAlgorithm),
|
||||
MemoryOversubscriptionEnabled: conf.MemoryOversubscriptionEnabled,
|
||||
PreemptionConfig: structs.PreemptionConfig{
|
||||
SystemSchedulerEnabled: conf.PreemptionConfig.SystemSchedulerEnabled,
|
||||
BatchSchedulerEnabled: conf.PreemptionConfig.BatchSchedulerEnabled,
|
||||
|
||||
@@ -284,6 +284,7 @@ func TestOperator_SchedulerGetConfiguration(t *testing.T) {
|
||||
require.True(out.SchedulerConfig.PreemptionConfig.SystemSchedulerEnabled)
|
||||
require.False(out.SchedulerConfig.PreemptionConfig.BatchSchedulerEnabled)
|
||||
require.False(out.SchedulerConfig.PreemptionConfig.ServiceSchedulerEnabled)
|
||||
require.False(out.SchedulerConfig.MemoryOversubscriptionEnabled)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -291,10 +292,14 @@ func TestOperator_SchedulerSetConfiguration(t *testing.T) {
|
||||
t.Parallel()
|
||||
httpTest(t, nil, func(s *TestAgent) {
|
||||
require := require.New(t)
|
||||
body := bytes.NewBuffer([]byte(`{"PreemptionConfig": {
|
||||
"SystemSchedulerEnabled": true,
|
||||
"ServiceSchedulerEnabled": true
|
||||
}}`))
|
||||
body := bytes.NewBuffer([]byte(`
|
||||
{
|
||||
"MemoryOversubscriptionEnabled": true,
|
||||
"PreemptionConfig": {
|
||||
"SystemSchedulerEnabled": true,
|
||||
"ServiceSchedulerEnabled": true
|
||||
}
|
||||
}`))
|
||||
req, _ := http.NewRequest("PUT", "/v1/operator/scheduler/configuration", body)
|
||||
resp := httptest.NewRecorder()
|
||||
setResp, err := s.Server.OperatorSchedulerConfiguration(resp, req)
|
||||
@@ -315,6 +320,7 @@ func TestOperator_SchedulerSetConfiguration(t *testing.T) {
|
||||
require.Nil(err)
|
||||
require.True(reply.SchedulerConfig.PreemptionConfig.SystemSchedulerEnabled)
|
||||
require.True(reply.SchedulerConfig.PreemptionConfig.ServiceSchedulerEnabled)
|
||||
require.True(reply.SchedulerConfig.MemoryOversubscriptionEnabled)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
3
vendor/github.com/hashicorp/nomad/api/operator.go
generated
vendored
3
vendor/github.com/hashicorp/nomad/api/operator.go
generated
vendored
@@ -126,6 +126,9 @@ type SchedulerConfiguration struct {
|
||||
// priority jobs to place higher priority jobs.
|
||||
PreemptionConfig PreemptionConfig
|
||||
|
||||
// MemoryOversubscriptionEnabled specifies whether memory oversubscription is enabled
|
||||
MemoryOversubscriptionEnabled bool
|
||||
|
||||
// CreateIndex/ModifyIndex store the create/modify indexes of this configuration.
|
||||
CreateIndex uint64
|
||||
ModifyIndex uint64
|
||||
|
||||
Reference in New Issue
Block a user