Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
Disable UnreachableStrategy for resident tasks
Browse files Browse the repository at this point in the history
Summary:
Require disabled for resident tasks. Fixes #5163. Partially addresses

Test Plan:
create resident task. Make it get lost. Ensure that it
doesn't come go inactive.

Reviewers: aquamatthias, jdef, meichstedt, jenkins

Reviewed By: aquamatthias, jdef, meichstedt, jenkins

Subscribers: jdef, marathon-team

Differential Revision: https://phabricator.mesosphere.com/D488
  • Loading branch information
Tim Harper committed Feb 22, 2017
1 parent b263bc4 commit 537d44f
Show file tree
Hide file tree
Showing 38 changed files with 347 additions and 260 deletions.
15 changes: 7 additions & 8 deletions docs/docs/rest-api/public/api/v2/types/unreachableStrategy.raml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#%RAML 1.0 Library
types:
UnreachableStrategy:
UnreachableStrategy: (UnreachableDisabled | UnreachableEnabled)
UnreachableDisabled:
type: string
enum: [ disabled ]
UnreachableEnabled:
type: object
properties:
inactiveAfterSeconds?:
Expand All @@ -13,8 +17,7 @@ types:
as inactive. This will trigger a new instance launch. The original task is not
expunged yet. Must be less than expungeAfterSeconds.
The default value is set to 5 minutes for ephemeral tasks (300 seconds).
The default value is set to 1 hour for resident tasks (3600 seconds).
The default value is set to 5 minutes (300 seconds).
expungeAfterSeconds?:
type: integer
Expand All @@ -26,8 +29,4 @@ types:
it will be killed if it ever comes back. Instances are usually marked as unreachable before they are expunged
but they don't have to. This value is required to be greater than inactiveAfterSeconds.
The default value is set to 10 minutes for ephemeral tasks (600 seconds).
The default value is set to 7 days for resident tasks (604800 seconds).
If the instance has any persistent volumes associated with it, then they will be destroyed and associated data
will be deleted.
The default value is set to 10 minutes (600 seconds).
76 changes: 24 additions & 52 deletions src/main/java/mesosphere/marathon/Protos.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions src/main/proto/marathon.proto
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ message ServiceDefinition {
}

message UnreachableStrategy {
required uint64 inactiveAfterSeconds = 1 [default = 900 ]; // 15 minutes
required uint64 expungeAfterSeconds = 2 [default = 604800 ]; // 7 days
// UnreachableDisabled is represented by both of these fields missing
optional uint64 inactiveAfterSeconds = 1 [default = 900 ]; // 15 minutes
optional uint64 expungeAfterSeconds = 2 [default = 604800 ]; // 7 days
}

// we serialize PodDefinition and Instances as json, only required for legacy content
Expand Down
11 changes: 5 additions & 6 deletions src/main/scala/mesosphere/marathon/api/v2/json/Formats.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import mesosphere.marathon.core.pod.PodDefinition
import mesosphere.marathon.core.readiness.ReadinessCheck
import mesosphere.marathon.core.task.Task
import mesosphere.marathon.core.task.state.NetworkInfo
import mesosphere.marathon.raml.{ Pod, Raml, Resources, UnreachableStrategy, KillSelection }
import mesosphere.marathon.state
import mesosphere.marathon.raml.{ Pod, Raml, Resources, KillSelection }
import mesosphere.marathon.state._
import mesosphere.marathon.upgrade.DeploymentManager.DeploymentStepInfo
import mesosphere.marathon.upgrade._
Expand Down Expand Up @@ -1010,7 +1009,7 @@ trait AppAndGroupFormats {
dependencies: Set[PathId],
maybePorts: Option[Seq[Int]],
upgradeStrategy: Option[UpgradeStrategy],
unreachableStrategy: Option[UnreachableStrategy],
unreachableStrategy: Option[raml.UnreachableStrategy],
killSelection: Option[KillSelection],
labels: Map[String, String],
acceptedResourceRoles: Set[String],
Expand Down Expand Up @@ -1039,7 +1038,7 @@ trait AppAndGroupFormats {
(__ \ "dependencies").readNullable[Set[PathId]].withDefault(AppDefinition.DefaultDependencies) ~
(__ \ "ports").readNullable[Seq[Int]](uniquePorts) ~
(__ \ "upgradeStrategy").readNullable[UpgradeStrategy] ~
(__ \ "unreachableStrategy").readNullable[UnreachableStrategy] ~
(__ \ "unreachableStrategy").readNullable[raml.UnreachableStrategy] ~
(__ \ "killSelection").readNullable[KillSelection] ~
(__ \ "labels").readNullable[Map[String, String]].withDefault(AppDefinition.Labels.Default) ~
(__ \ "acceptedResourceRoles").readNullable[Set[String]](nonEmpty).withDefault(Set.empty[String]) ~
Expand Down Expand Up @@ -1081,7 +1080,7 @@ trait AppAndGroupFormats {
}
}

def defaultUnreachableStrategy = state.UnreachableStrategy.default(app.persistentVolumes.nonEmpty)
def defaultUnreachableStrategy = UnreachableStrategy.default(app.persistentVolumes.nonEmpty)

app.copy(
fetch = fetch,
Expand Down Expand Up @@ -1368,7 +1367,7 @@ trait AppAndGroupFormats {
(__ \ "container").readNullable[Container] ~
(__ \ "healthChecks").readNullable[Set[HealthCheck]] ~
(__ \ "dependencies").readNullable[Set[PathId]] ~
(__ \ "unreachableStrategy").readNullable[UnreachableStrategy] ~
(__ \ "unreachableStrategy").readNullable[raml.UnreachableStrategy] ~
(__ \ "killSelection").readNullable[KillSelection]
) ((id, cmd, args, user, env, instances, cpus, mem, disk, gpus, executor, constraints, storeUrls, requirePorts,
backoffSeconds, backoffFactor, maxLaunchDelaySeconds, container, healthChecks, dependencies, unreachableStrategy,
Expand Down
Loading

0 comments on commit 537d44f

Please sign in to comment.