disconnected: removes deprecated disconnect fields (#25284)

The group level fields stop_after_client_disconnect,
max_client_disconnect, and prevent_reschedule_on_lost were deprecated in
Nomad 1.8 and replaced by field in the disconnect block. This change
removes any logic related to those deprecated fields.

---------

Co-authored-by: Tim Gross <tgross@hashicorp.com>
This commit is contained in:
Michael Smithhisler
2025-03-05 14:46:02 -05:00
committed by GitHub
parent 916fe2c7fa
commit f2b761f17c
31 changed files with 97 additions and 1343 deletions

View File

@@ -1249,24 +1249,10 @@ func ApiTgToStructsTG(job *structs.Job, taskGroup *api.TaskGroup, tg *structs.Ta
RenderTemplates: *taskGroup.RestartPolicy.RenderTemplates,
}
if taskGroup.PreventRescheduleOnLost == nil {
tg.PreventRescheduleOnLost = false
} else {
tg.PreventRescheduleOnLost = *taskGroup.PreventRescheduleOnLost
}
if taskGroup.ShutdownDelay != nil {
tg.ShutdownDelay = taskGroup.ShutdownDelay
}
if taskGroup.StopAfterClientDisconnect != nil {
tg.StopAfterClientDisconnect = taskGroup.StopAfterClientDisconnect
}
if taskGroup.MaxClientDisconnect != nil {
tg.MaxClientDisconnect = taskGroup.MaxClientDisconnect
}
if taskGroup.ReschedulePolicy != nil {
tg.ReschedulePolicy = &structs.ReschedulePolicy{
Attempts: *taskGroup.ReschedulePolicy.Attempts,

View File

@@ -2800,7 +2800,6 @@ func TestJobs_ApiJobToStructsJob(t *testing.T) {
Disconnect: &api.DisconnectStrategy{
LostAfter: pointer.Of(30 * time.Second),
},
MaxClientDisconnect: pointer.Of(30 * time.Second),
Tasks: []*api.Task{
{
Name: "task1",
@@ -3113,7 +3112,6 @@ func TestJobs_ApiJobToStructsJob(t *testing.T) {
Operand: "z",
},
},
PreventRescheduleOnLost: false,
Affinities: []*structs.Affinity{
{
LTarget: "x",
@@ -3248,7 +3246,6 @@ func TestJobs_ApiJobToStructsJob(t *testing.T) {
Replace: pointer.Of(true),
Reconcile: structs.ReconcileOptionBestScore,
},
MaxClientDisconnect: pointer.Of(30 * time.Second),
Tasks: []*structs.Task{
{
Name: "task1",
@@ -3625,9 +3622,8 @@ func TestJobs_ApiJobToStructsJob(t *testing.T) {
},
TaskGroups: []*structs.TaskGroup{
{
Name: "group1",
Count: 5,
PreventRescheduleOnLost: false,
Name: "group1",
Count: 5,
Constraints: []*structs.Constraint{
{
LTarget: "x",