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

Marathon VIP support #1905

Open
wants to merge 3 commits into
base: version-3.x
Choose a base branch
from
Open

Conversation

deric
Copy link
Contributor

@deric deric commented Jul 12, 2018

  • Mesos based heath check
  • Add VIP support
diff --git a/repo/packages/M/marathon/200/config.json b/repo/packages/M/marathon/201/config.json
index 3721fe3a..ff8f10d1 100644
--- a/repo/packages/M/marathon/200/config.json
+++ b/repo/packages/M/marathon/201/config.json
@@ -43,6 +43,21 @@
             "type" : "string"
           },
           "type" : "array"
+        },
+        "virtual_network_enabled": {
+          "description": "Enable virtual networking",
+          "type": "boolean",
+          "default": false
+        },
+        "virtual_network_name": {
+          "description": "The name of the virtual network to join",
+          "type": "string",
+          "default": "dcos"
+        },
+        "virtual_network_plugin_labels": {
+          "description": "Labels to pass to the virtual network plugin. Comma-separated key:value pairs. For example: k_0:v_0,k_1:v_1,...,k_n:v_n",
+          "type": "string",
+          "default": ""
         }
       },
       "required" : [ "cpus", "mem", "instances" ],
@@ -433,4 +448,4 @@
   },
   "required" : [ "service", "jvm", "marathon" ],
   "type" : "object"
-}
\ No newline at end of file
+}
diff --git a/repo/packages/M/marathon/200/marathon.json.mustache b/repo/packages/M/marathon/201/marathon.json.mustache
index b5261e1f..5f14f69b 100644
--- a/repo/packages/M/marathon/200/marathon.json.mustache
+++ b/repo/packages/M/marathon/201/marathon.json.mustache
@@ -5,15 +5,6 @@
   "mem": {{service.mem}},
   "instances": {{service.instances}},
   "constraints": [["hostname", "UNIQUE"]],
-  "ports": [
-    {{#marathon.http-port}}{{marathon.http-port}}{{/marathon.http-port}}{{^marathon.http-port}}0{{/marathon.http-port}}
-    , 0
-    {{#marathon.ssl-keystore-path}}
-    {{#marathon.ssl-keystore-password}}
-    , {{#marathon.https-port}}{{marathon.https-port}}{{/marathon.https-port}}{{^marathon.https-port}}0{{/marathon.https-port}}
-    {{/marathon.ssl-keystore-password}}
-    {{/marathon.ssl-keystore-path}}
-  ],
   "uris": {{service.uris}},
   "healthChecks": [
     {
@@ -22,7 +13,7 @@
       "maxConsecutiveFailures": 3,
       "path": "/ping",
       "portIndex": 0,
-      "protocol": "HTTP",
+      "protocol": "MESOS_HTTP",
       "timeoutSeconds": 5
     }
   ],
@@ -33,7 +24,35 @@
       "network": "HOST"
     }
   },
+  "portDefinitions": [
+    {
+      "port": {{#marathon.http-port}}{{marathon.http-port}}{{/marathon.http-port}}{{^marathon.http-port}}0{{/marathon.http-port}},
+      "protocol": "tcp",
+      "name": "{{service.name}}",
+      "labels": { "VIP_0": "/{{service.name}}:80" }
+    },
+    {
+      "port": 0,
+      "protocol": "tcp",
+      "name": "libprocess"
+    }
+    {{#marathon.ssl-keystore-path}}
+    {{#marathon.ssl-keystore-password}}
+    ,{
+      "port": {{#marathon.https-port}}{{marathon.https-port}}{{/marathon.https-port}}{{^marathon.https-port}}0{{/marathon.https-port}},
+      "protocol": "tcp",
+      "name": "{{service.name}}-https",
+      "labels": { "VIP_1": "/{{service.name}}:443" }
+    }
+    {{/marathon.ssl-keystore-password}}
+    {{/marathon.ssl-keystore-path}}
+  ],
   "env": {
+    {{#service.virtual_network_enabled}}
+    "ENABLE_VIRTUAL_NETWORK": "yes",
+    "VIRTUAL_NETWORK_NAME": "{{service.virtual_network_name}}",
+    "VIRTUAL_NETWORK_PLUGIN_LABELS": "{{service.virtual_network_plugin_labels}}",
+    {{/service.virtual_network_enabled}}
     "JVM_OPTS": "-Xms{{jvm.heap-min}}m -Xmx{{jvm.heap-max}}m {{#jvm.opts}}{{jvm.opts}}{{/jvm.opts}}"
   },

cc @ryadav88, @meln1k

@ryadav88 ryadav88 requested a review from kensipe August 9, 2018 01:38
@kensipe kensipe removed their request for review January 17, 2020 10:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant