mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
KillTimeout can be modified in place
This commit is contained in:
@@ -159,17 +159,12 @@ func annotateTask(diff *structs.TaskDiff, parent *structs.TaskGroupDiff) {
|
||||
}
|
||||
}
|
||||
|
||||
// All changes to primitive fields result in a destructive update.
|
||||
// All changes to primitive fields result in a destructive update except
|
||||
// KillTimeout
|
||||
destructive := false
|
||||
if len(diff.Fields) != 0 {
|
||||
destructive = true
|
||||
}
|
||||
|
||||
// Changes that can be done in-place are log configs, services and
|
||||
// constraints.
|
||||
for _, oDiff := range diff.Objects {
|
||||
switch oDiff.Name {
|
||||
case "LogConfig", "Service", "Constraint":
|
||||
for _, fDiff := range diff.Fields {
|
||||
switch fDiff.Name {
|
||||
case "KillTimeout":
|
||||
continue
|
||||
default:
|
||||
destructive = true
|
||||
@@ -177,6 +172,20 @@ func annotateTask(diff *structs.TaskDiff, parent *structs.TaskGroupDiff) {
|
||||
}
|
||||
}
|
||||
|
||||
// Object changes that can be done in-place are log configs, services,
|
||||
// constraints.
|
||||
if !destructive {
|
||||
for _, oDiff := range diff.Objects {
|
||||
switch oDiff.Name {
|
||||
case "LogConfig", "Service", "Constraint":
|
||||
continue
|
||||
default:
|
||||
destructive = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if destructive {
|
||||
diff.Annotations = append(diff.Annotations, AnnotationForcesDestructiveUpdate)
|
||||
} else {
|
||||
|
||||
@@ -347,6 +347,21 @@ func TestAnnotateTask(t *testing.T) {
|
||||
Parent: &structs.TaskGroupDiff{Type: structs.DiffTypeEdited},
|
||||
Desired: AnnotationForcesInplaceUpdate,
|
||||
},
|
||||
{
|
||||
Diff: &structs.TaskDiff{
|
||||
Type: structs.DiffTypeEdited,
|
||||
Fields: []*structs.FieldDiff{
|
||||
{
|
||||
Type: structs.DiffTypeEdited,
|
||||
Name: "KillTimeout",
|
||||
Old: "200",
|
||||
New: "2000000",
|
||||
},
|
||||
},
|
||||
},
|
||||
Parent: &structs.TaskGroupDiff{Type: structs.DiffTypeEdited},
|
||||
Desired: AnnotationForcesInplaceUpdate,
|
||||
},
|
||||
// Task deleted new parent
|
||||
{
|
||||
Diff: &structs.TaskDiff{
|
||||
|
||||
Reference in New Issue
Block a user