HomeMesosphereNo notifications. 4 unresolved issues.

PUT on /v2/apps has a PATCH semantic. (#5157)
ClosedAll Users

Authored by unterstein on Feb 24 2017, 3:17 PM.

Details

Summary

1.) PUT on /v2/apps has a PATCH semantic. (#5157)
See 8df2a5d8b43e8a1c8609f88bc056245bbeef7523

  • document that, by default, PUT on /v2/apps has a PATCH semantic: only the fields specified in the app update are applied to the existing app definition.
  • add a query parameter, partialUpdate, that allows for proper PUT semantics for an app. false means "completely replace the existing app with the new one that I'm fully specifying here"

2.) Add support for PATCH updates to apps in 1.4 (#5183)
See 1ba8ea7352045119b9d4803010f03b88ee79e861

  • added support to PATCH apps

also-by: unterstein

3.) Fixes #5211 by defining the jersey annotated methods explicitly. (#5217)
See e1b79523741bf1c266b953eba1bcf8783f819c3a

  • With the newly introduced PATCH semantic, we introduced a misleading method declaration which is not resolvable for jersey. Therefore this logic was restructured and methods are defined explicitly.
Test Plan

sbt test
sbt integration:test

Diff Detail

Repository
rMARATHON marathon
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
unterstein created this revision.Feb 24 2017, 3:17 PM
jenkins requested changes to this revision.Feb 24 2017, 3:18 PM
This revision now requires changes to proceed.Feb 24 2017, 3:18 PM
unterstein added a comment.EditedFeb 24 2017, 3:31 PM

Only cherry-picks of:
#5217
#5183
#5157

Had some minor merge conflicts therefore create this revision.

Currently doing manual tests on this revision, like we did for 1.4.1.

jenkins accepted this revision.Feb 24 2017, 3:36 PM

Ship it!

This revision is now accepted and ready to land.Feb 24 2017, 3:36 PM
jdef accepted this revision.Feb 26 2017, 12:02 AM
jdef added a subscriber: jdef.
jdef added inline comments.
src/test/scala/mesosphere/marathon/api/v2/AppsResourceTest.scala
183

there's limits to what this is actually testing. because the groupManager is fake for the default fixture (AFAIR) there's a fair amount of (callback) update logic that's never actually invoked here. the other new test case (added below this one) is a bit more narrowly focused - the downside being that it's not invoking the REST endpoint directly. the callback-oriented design of groupManager makes testing this a bit more complicated that it should be

manual retest delivers same results as expected

meichstedt requested changes to this revision.Feb 27 2017, 12:15 PM

Minor comments

docs/docs/rest-api/public/api/v2/apps.raml
146

I figure this is actually not really correct. If we apply a patch {instances: 2} to a seq of apps that currently have {instances: 1}, Marathon will not replace any instances but only start additional ones. In general, the needsRestart logic will be applied. This is probably not well documented anywhere and has know edges like when instances are restarted although only the upgradeStrategy was changed.

Maybe change this to something that doesn't lie like
_Instances will be started or restarted with according to the usual logic._?

373

Again, in case needsRestart evaluates to false, no instances will be restarted.

src/main/scala/mesosphere/marathon/state/AppDefinition.scala
371

I hadn't seen this in the original changeset. Wrong place imo: AppUpdate already has a dependency on AppDefinition (e.g. def apply(app AppDefinition): AppDefinition)). To not have both classes depend on each other, I'd suggest to move this to an AppUpdate.fromApp(...)

This revision now requires changes to proceed.Feb 27 2017, 12:15 PM
jdef added a comment.Feb 27 2017, 1:55 PM

AppUpdate is a misguided half-breed of a model and API class. It's
completely eliminated in D201. Please don't move anything else there

In D552#18035, @jdef wrote:

AppUpdate is a misguided half-breed of a model and API class. It's
completely eliminated in D201. Please don't move anything else there

Ok, fine with that.

Hi @jdef @meichstedt,

i filed https://github.com/mesosphere/marathon/issues/5291 to cover your documentation feedback. I would love to only forward port the changes and cover mentioned feedback in #5291. Are you ok with this?

meichstedt accepted this revision.Mar 2 2017, 4:53 PM

Totally – thanks!

This revision is now accepted and ready to land.Mar 2 2017, 4:53 PM
unterstein edited the summary of this revision. (Show Details)Mar 15 2017, 1:51 PM
unterstein edited the summary of this revision. (Show Details)Mar 15 2017, 1:55 PM
This revision was automatically updated to reflect the committed changes.