Uploaded image for project: 'Marathon'
  1. Marathon
  2. MARATHON-4745

Support app/group config replacement instead of only updates (PUT semantics)

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Low
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: API
    • Labels:
      None

      Description

      Currently, PUT requests on apps or groups update current app definitions instead of replacing them. If the app already exists, only the fields mentioned in the request are updated. If a field is not mentioned, it will not be removed but it remains unchanged.

      If you want to delete a field, it is not possible. Even setting it explicitly to null in the JSON does not work. You have to delete the app definition first and thus cannot perform a rolling update.

      It would be very nice if you could specify a complete definition which completely replaces an old one. This way the app definition could be a build artefact. The developer adjusting the build artefact doesn't have to think in terms of all possible upgrade paths but only has to specify what he wants in the future.

      We cannot just change the semantics of our PUT requests without breaking API compatibility but I propose to

      [update] add a boolean parameter replace. The value false would correspond to the current semantics and remain the default. If you want to replace an app definition completely, you would use PUT /v2/apps/service1?replace=true instead of PUT /v2/apps/service1.

      [initial version] add a Parameter op which can be either update or replace. update would correspond to the current semantics and remain the default. If you want to replace an app definition completely, you would use PUT /v2/apps/service1?op=replace instead of PUT /v2/apps/service1.

      Example: Updating an App to a Dockerized Version

      Start a simple non-docker app:

       http
      PUT /v2/apps/service1 HTTP/1.1
      <some headers>
      
      {
          "cmd": "python -m SimpleHTTPServer $PORT0", 
          "cpus": 0.0001, 
          "id": "service1", 
          "instances": 1, 
          "mem": 32, 
          "ports": [
              0
          ]
      }
      
      HTTP/1.1 201 Created
      <some headers>
      
      {
          "deploymentId": "552a0b26-9674-4c5d-a39d-528c0db25cf0", 
          "version": "2015-04-22T10:11:16.105Z"
      }
      

      Now try to upgrade it to a dockerized version:

       http
      PUT /v2/apps/service1 HTTP/1.1
      <some headers>
      
      {
          "args": [
              "python", 
              "-m", 
              "SimpleHTTPServer", 
              "8080"
          ], 
          "cmd": null, 
          "container": {
              "docker": {
                  "image": "python:2.7", 
                  "network": "BRIDGE", 
                  "portMappings": [
                      {
                          "containerPort": 8080, 
                          "hostPort": 0, 
                          "protocol": "tcp", 
                          "servicePort": 0
                      }
                  ]
              }, 
              "type": "DOCKER"
          }, 
          "cpus": 0.0001, 
          "id": "service1", 
          "instances": 1, 
          "mem": 32
      }
      
      HTTP/1.1 422 
      <some headers>
      
      {
          "errors": [
              {
                  "attribute": "", 
                  "error": "AppDefinition must either contain one of 'cmd' or 'args', and/or a 'container'."
              }
          ]
      }
      

      If you DELETE the app first and repeat the second request, it works.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                GitHub_kolloch Peter Kolloch (Inactive)
                Team:
                Orchestration Team
                Watchers:
                Chmielewski, Jason Gilanfarr (Inactive), Matthias Eichstedt
              • Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: