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

Applications created via PUT do not receive a default portDefinitions value

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: High
    • Resolution: Done
    • Affects Version/s: Marathon 1.5.2, Marathon 1.6.352
    • Fix Version/s: DC/OS 1.12.0
    • Component/s: API
    • Sprint:
      Marathon 2018-27
    • Story Points:
      1
    • Build artifact:
      Marathon-v1.7.174

      Description

      new application, with network mode HOST, created via PUT fails to define the PORT environment variable and set portMappings.

      When you create a new application via PUT, the default portDefinitions are not populated. However, they are for POST. In marathon 1.4.X, this worked for both PUT and POST.

      Interesting notes:

      • Applications created with POST and HOST networking work correctly
      • Working HOST networking applications that are updated (not created from scratch) with PUT continue to work correctly
      • Regardless of POST/PUT methods, BRIDGE mode works correctly
      • The issue exists whether or not the new 1.5.+ JSON format is used (container.docker.network or networks)

      Sample JSON for quick testing (tomcat.json):

      {
        "id":"tomcat",
        "mem":512,
        "cpus":1.0,
        "instances":1,
        "container": {
          "type":"DOCKER",
          "docker": {
            "image":"tomcat:8.0",
            "network":"HOST"
          }
        }
      }

       

      The following is a demonstration of the problem:

      With Marathon 1.4.9, we see:

       
      $ http DELETE :8080/v2/groups
      $ cat tomcat.json | http POST :8080/v2/apps
      $ http :8080/v2/apps/tomcat | jq '.app | {container: .container, ports: .ports, requirePorts: .requirePorts, portMappings: .portMappings, portDefinitions: .portDefinitions }'
      {
        "container": {
          "type": "DOCKER",
          "volumes": [],
          "docker": {
            "image": "tomcat:8.0",
            "network": "HOST",
            "portMappings": [],
            "privileged": false,
            "parameters": [],
            "forcePullImage": false
          }
        },
        "ports": [
          10000
        ],
        "requirePorts": false,
        "portMappings": null,
        "portDefinitions": [
          {
            "port": 10000,
            "protocol": "tcp",
            "name": "default",
            "labels": {}
          }
        ]
      }
      
      $ http DELETE :8080/v2/groups
      $ cat tomcat.json | http PUT :8080/v2/apps/tomcat
      $ http :8080/v2/apps/tomcat | jq '.app | {container: .container, ports: .ports, requirePorts: .requirePorts, portMappings: .portMappings, portDefinitions: .portDefinitions }'in{
        "container": {
          "type": "DOCKER",
          "volumes": [],
          "docker": {
            "image": "tomcat:8.0",
            "network": "HOST",
            "portMappings": [],
            "privileged": false,
            "parameters": [],
            "forcePullImage": false
          }
        },
        "ports": [
          10000
        ],
        "requirePorts": false,
        "portMappings": null,
        "portDefinitions": [
          {
            "port": 10000,
            "protocol": "tcp",
            "name": "default",
            "labels": {}
          }
        ]
      }
      

      With Marathon 1.5.5, we see:

      
      $ http DELETE :8080/v2/groups
      $ cat tomcat.json | http POST :8080/v2/apps
      $ http :8080/v2/apps/tomcat | jq '.app | {container: .container, requirePorts: .requirePorts, portMappings: .portMappings, portDefinitions: .portDefinitions }'
      {
        "container": {
          "type": "DOCKER",
          "docker": {
            "forcePullImage": false,
            "image": "tomcat:8.0",
            "parameters": [],
            "privileged": false
          },
          "volumes": []
        },
        "requirePorts": false,
        "portMappings": null,
        "portDefinitions": [
          {
            "port": 10000,
            "name": "default",
            "protocol": "tcp"
          }
        ]
      }
      
      $ http DELETE :8080/v2/groups
      $ cat tomcat.json | http PUT :8080/v2/apps/tomcat
      $ http :8080/v2/apps/tomcat | jq '.app | {container: .container, requirePorts: .requirePorts, portMappings: .portMappings, portDefinitions: .portDefinitions }'
      {
        "container": {
          "type": "DOCKER",
          "docker": {
            "forcePullImage": false,
            "image": "tomcat:8.0",
            "parameters": [],
            "privileged": false
          },
          "volumes": []
        },
        "requirePorts": false,
        "portMappings": null,
        "portDefinitions": []
      }
      
      

      You'll notice that in 1.5.5, we don't have any portDefinitions.

      Acceptance criteria:

      • When we create an app with HOST networking mode via the PUT endpoint, the default portDefinitions must be populated.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                nikitamelkozerov Nikita Melkozerov (Inactive)
                Reporter:
                sdouglasnelson sdouglasnelson
                Team:
                Orchestration Team
                Watchers:
                Alena Varkockova, Matthias Eichstedt, Nikita Melkozerov (Inactive), sdouglasnelson, Tim Harper
              • Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: