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.

Subscribers: marathon-team

Differential Revision: https://phabricator.mesosphere.com/D488
  • Loading branch information
Tim Harper committed Feb 10, 2017
1 parent 94efcee commit 8f21926
Show file tree
Hide file tree
Showing 39 changed files with 344 additions and 234 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.

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

message UnreachableStrategy {
required uint64 inactiveAfterSeconds = 1 [default = 900 ]; // 15 minutes
required uint64 expungeAfterSeconds = 2 [default = 604800 ]; // 7 days
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
17 changes: 14 additions & 3 deletions src/main/scala/mesosphere/marathon/api/v2/json/Formats.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +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.raml.{ Pod, Raml, Resources, KillSelection }
import mesosphere.marathon.state
import mesosphere.marathon.state._
import mesosphere.marathon.upgrade.DeploymentManager.DeploymentStepInfo
Expand Down Expand Up @@ -1096,7 +1096,7 @@ trait AppAndGroupFormats {
readinessChecks = extra.readinessChecks,
secrets = extra.secrets,
taskKillGracePeriod = extra.maybeTaskKillGracePeriod,
unreachableStrategy = extra.unreachableStrategy.fold(defaultUnreachableStrategy)(Raml.fromRaml(_)),
unreachableStrategy = extra.unreachableStrategy.getOrElse(defaultUnreachableStrategy),
killSelection = extra.killSelection.fold(state.KillSelection.DefaultKillSelection)(Raml.fromRaml(_))
)
}
Expand Down Expand Up @@ -1163,6 +1163,17 @@ trait AppAndGroupFormats {
}
}

implicit val UnreachableStrategyFormat: Format[UnreachableStrategy] = new Format[UnreachableStrategy] {
// override def
override def reads(json: JsValue): JsResult[UnreachableStrategy] = {
json.validate[raml.UnreachableStrategy].map(Raml.fromRaml(_))
}

override def writes(unreachableStrategy: UnreachableStrategy): JsValue = {
Json.toJson(Raml.toRaml(unreachableStrategy))
}
}

implicit lazy val ResidencyFormat: Format[Residency] = (
(__ \ "relaunchEscalationTimeoutSeconds").formatNullable[Long]
.withDefault(Residency.defaultRelaunchEscalationTimeoutSeconds) ~
Expand Down Expand Up @@ -1379,7 +1390,7 @@ trait AppAndGroupFormats {
storeUrls = storeUrls, requirePorts = requirePorts,
backoff = backoffSeconds, backoffFactor = backoffFactor, maxLaunchDelay = maxLaunchDelaySeconds,
container = container, healthChecks = healthChecks, dependencies = dependencies,
unreachableStrategy = unreachableStrategy.map(Raml.fromRaml(_)),
unreachableStrategy = unreachableStrategy,
killSelection = killSelection.map(Raml.fromRaml(_))
)
).flatMap { update =>
Expand Down
Loading

0 comments on commit 8f21926

Please sign in to comment.