universe icon indicating copy to clipboard operation
universe copied to clipboard

Marathon VIP support

Open deric opened this issue 6 years ago • 0 comments

  • 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

deric avatar Jul 12 '18 13:07 deric