{"action":"created","comment":{"url":"https://api.github.com/repos/docker/swarm/pulls/comments/31090687","id":31090687,"diff_hunk":"@@ -0,0 +1,453 @@\n+package mesos\n+\n+import (\n+\t\"crypto/tls\"\n+\t\"errors\"\n+\t\"fmt\"\n+\t\"io\"\n+\t\"sort\"\n+\t\"sync\"\n+\t\"time\"\n+\n+\tlog \"github.com/Sirupsen/logrus\"\n+\t\"github.com/docker/swarm/cluster\"\n+\t\"github.com/docker/swarm/cluster/mesos/queue\"\n+\t\"github.com/docker/swarm/scheduler\"\n+\t\"github.com/docker/swarm/scheduler/node\"\n+\t\"github.com/docker/swarm/scheduler/strategy\"\n+\t\"github.com/docker/swarm/state\"\n+\t\"github.com/gogo/protobuf/proto\"\n+\t\"github.com/mesos/mesos-go/mesosproto\"\n+\tmesosscheduler \"github.com/mesos/mesos-go/scheduler\"\n+\t\"github.com/samalba/dockerclient\"\n+)\n+\n+// Cluster struct for mesos\n+type Cluster struct {\n+\tsync.RWMutex\n+\n+\tdriver           *mesosscheduler.MesosSchedulerDriver\n+\tdockerEnginePort string\n+\teventHandler     cluster.EventHandler\n+\tmaster           string\n+\tslaves           map[string]*slave\n+\tscheduler        *scheduler.Scheduler\n+\tstore            *state.Store\n+\tTLSConfig        *tls.Config\n+\toptions          *cluster.DriverOpts\n+\tofferTimeout     time.Duration\n+\tpendingTasks     *queue.Queue\n+}\n+\n+const (\n+\tframeworkName              = \"swarm\"\n+\tdefaultDockerEnginePort    = \"2375\"\n+\tdefaultDockerEngineTLSPort = \"2376\"\n+\tdefaultOfferTimeout        = 10 * time.Minute\n+\ttaskCreationTimeout        = 5 * time.Second\n+)\n+\n+var (\n+\terrNotSupported = errors.New(\"not supported with mesos\")\n+)\n+\n+// NewCluster for mesos Cluster creation\n+func NewCluster(scheduler *scheduler.Scheduler, store *state.Store, TLSConfig *tls.Config, master string, options cluster.DriverOpts) (cluster.Cluster, error) {\n+\tlog.WithFields(log.Fields{\"name\": \"mesos\"}).Debug(\"Initializing cluster\")\n+\n+\tcluster := &Cluster{\n+\t\tdockerEnginePort: defaultDockerEnginePort,\n+\t\tmaster:           master,\n+\t\tslaves:           make(map[string]*slave),\n+\t\tscheduler:        scheduler,\n+\t\tstore:            store,\n+\t\tTLSConfig:        TLSConfig,\n+\t\toptions:          &options,\n+\t\tofferTimeout:     defaultOfferTimeout,\n+\t}\n+\n+\tcluster.pendingTasks = queue.NewQueue()\n+\n+\t// Empty string is accepted by the scheduler.\n+\tuser, _ := options.String(\"mesos.user\", \"SWARM_MESOS_USER\")\n+\n+\tdriverConfig := mesosscheduler.DriverConfig{\n+\t\tScheduler: cluster,\n+\t\tFramework: &mesosproto.FrameworkInfo{Name: proto.String(frameworkName), User: &user},\n+\t\tMaster:    cluster.master,\n+\t}\n+\n+\t// Changing port for https\n+\tif cluster.TLSConfig != nil {\n+\t\tcluster.dockerEnginePort = defaultDockerEngineTLSPort\n+\t}\n+\n+\tif bindingPort, ok := options.Uint(\"mesos.port\", \"SWARM_MESOS_PORT\"); ok {","path":"cluster/mesos/cluster.go","position":85,"original_position":85,"commit_id":"77cb3f65681fdd57ed58149e70fd9a687dba29c6","original_commit_id":"77cb3f65681fdd57ed58149e70fd9a687dba29c6","user":{"login":"jimenez","id":1709242,"avatar_url":"https://avatars.githubusercontent.com/u/1709242?v=3","gravatar_id":"","url":"https://api.github.com/users/jimenez","html_url":"https://github.com/jimenez","followers_url":"https://api.github.com/users/jimenez/followers","following_url":"https://api.github.com/users/jimenez/following{/other_user}","gists_url":"https://api.github.com/users/jimenez/gists{/gist_id}","starred_url":"https://api.github.com/users/jimenez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimenez/subscriptions","organizations_url":"https://api.github.com/users/jimenez/orgs","repos_url":"https://api.github.com/users/jimenez/repos","events_url":"https://api.github.com/users/jimenez/events{/privacy}","received_events_url":"https://api.github.com/users/jimenez/received_events","type":"User","site_admin":false},"body":"It's auto-generated by mesos-go","created_at":"2015-05-26T23:36:00Z","updated_at":"2015-05-26T23:36:00Z","html_url":"https://github.com/docker/swarm/pull/845#discussion_r31090687","pull_request_url":"https://api.github.com/repos/docker/swarm/pulls/845","_links":{"self":{"href":"https://api.github.com/repos/docker/swarm/pulls/comments/31090687"},"html":{"href":"https://github.com/docker/swarm/pull/845#discussion_r31090687"},"pull_request":{"href":"https://api.github.com/repos/docker/swarm/pulls/845"}}},"pull_request":{"url":"https://api.github.com/repos/docker/swarm/pulls/845","id":36170744,"html_url":"https://github.com/docker/swarm/pull/845","diff_url":"https://github.com/docker/swarm/pull/845.diff","patch_url":"https://github.com/docker/swarm/pull/845.patch","issue_url":"https://api.github.com/repos/docker/swarm/issues/845","number":845,"state":"open","locked":false,"title":"[EXPERIMENTAL] Adding Mesos support","user":{"login":"jimenez","id":1709242,"avatar_url":"https://avatars.githubusercontent.com/u/1709242?v=3","gravatar_id":"","url":"https://api.github.com/users/jimenez","html_url":"https://github.com/jimenez","followers_url":"https://api.github.com/users/jimenez/followers","following_url":"https://api.github.com/users/jimenez/following{/other_user}","gists_url":"https://api.github.com/users/jimenez/gists{/gist_id}","starred_url":"https://api.github.com/users/jimenez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimenez/subscriptions","organizations_url":"https://api.github.com/users/jimenez/orgs","repos_url":"https://api.github.com/users/jimenez/repos","events_url":"https://api.github.com/users/jimenez/events{/privacy}","received_events_url":"https://api.github.com/users/jimenez/received_events","type":"User","site_admin":false},"body":"This PR adds all the code for supporting Mesos, although all the flags are commented as it requires changes in Mesos for the support to work. \r\nThe main code base is barely touched, most of the added code is on `cluster/mesos/ `, the only exception being in `engine.go` for `RefreshContainers` that needed to be exported for this first version.\r\nping @aluzzardi  @abronan @tnachen @vieux ","created_at":"2015-05-26T05:34:37Z","updated_at":"2015-05-26T23:36:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f0818120b259523635e25465b76cea858acdbe69","assignee":{"login":"jimenez","id":1709242,"avatar_url":"https://avatars.githubusercontent.com/u/1709242?v=3","gravatar_id":"","url":"https://api.github.com/users/jimenez","html_url":"https://github.com/jimenez","followers_url":"https://api.github.com/users/jimenez/followers","following_url":"https://api.github.com/users/jimenez/following{/other_user}","gists_url":"https://api.github.com/users/jimenez/gists{/gist_id}","starred_url":"https://api.github.com/users/jimenez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimenez/subscriptions","organizations_url":"https://api.github.com/users/jimenez/orgs","repos_url":"https://api.github.com/users/jimenez/repos","events_url":"https://api.github.com/users/jimenez/events{/privacy}","received_events_url":"https://api.github.com/users/jimenez/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/docker/swarm/milestones/3","html_url":"https://github.com/docker/swarm/milestones/0.3.0","labels_url":"https://api.github.com/repos/docker/swarm/milestones/3/labels","id":1026388,"number":3,"title":"0.3.0","description":"","creator":{"login":"vieux","id":1032519,"avatar_url":"https://avatars.githubusercontent.com/u/1032519?v=3","gravatar_id":"","url":"https://api.github.com/users/vieux","html_url":"https://github.com/vieux","followers_url":"https://api.github.com/users/vieux/followers","following_url":"https://api.github.com/users/vieux/following{/other_user}","gists_url":"https://api.github.com/users/vieux/gists{/gist_id}","starred_url":"https://api.github.com/users/vieux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vieux/subscriptions","organizations_url":"https://api.github.com/users/vieux/orgs","repos_url":"https://api.github.com/users/vieux/repos","events_url":"https://api.github.com/users/vieux/events{/privacy}","received_events_url":"https://api.github.com/users/vieux/received_events","type":"User","site_admin":false},"open_issues":30,"closed_issues":44,"state":"open","created_at":"2015-03-17T23:46:40Z","updated_at":"2015-05-26T22:57:20Z","due_on":"2015-06-02T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/docker/swarm/pulls/845/commits","review_comments_url":"https://api.github.com/repos/docker/swarm/pulls/845/comments","review_comment_url":"https://api.github.com/repos/docker/swarm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/swarm/issues/845/comments","statuses_url":"https://api.github.com/repos/docker/swarm/statuses/77cb3f65681fdd57ed58149e70fd9a687dba29c6","head":{"label":"docker:mesos","ref":"mesos","sha":"77cb3f65681fdd57ed58149e70fd9a687dba29c6","user":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"repo":{"id":19360616,"name":"swarm","full_name":"docker/swarm","owner":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/docker/swarm","description":"Swarm: a Docker-native clustering system","fork":false,"url":"https://api.github.com/repos/docker/swarm","forks_url":"https://api.github.com/repos/docker/swarm/forks","keys_url":"https://api.github.com/repos/docker/swarm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/swarm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/swarm/teams","hooks_url":"https://api.github.com/repos/docker/swarm/hooks","issue_events_url":"https://api.github.com/repos/docker/swarm/issues/events{/number}","events_url":"https://api.github.com/repos/docker/swarm/events","assignees_url":"https://api.github.com/repos/docker/swarm/assignees{/user}","branches_url":"https://api.github.com/repos/docker/swarm/branches{/branch}","tags_url":"https://api.github.com/repos/docker/swarm/tags","blobs_url":"https://api.github.com/repos/docker/swarm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/swarm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/swarm/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/swarm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/swarm/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/swarm/languages","stargazers_url":"https://api.github.com/repos/docker/swarm/stargazers","contributors_url":"https://api.github.com/repos/docker/swarm/contributors","subscribers_url":"https://api.github.com/repos/docker/swarm/subscribers","subscription_url":"https://api.github.com/repos/docker/swarm/subscription","commits_url":"https://api.github.com/repos/docker/swarm/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/swarm/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/swarm/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/swarm/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/swarm/contents/{+path}","compare_url":"https://api.github.com/repos/docker/swarm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/swarm/merges","archive_url":"https://api.github.com/repos/docker/swarm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/swarm/downloads","issues_url":"https://api.github.com/repos/docker/swarm/issues{/number}","pulls_url":"https://api.github.com/repos/docker/swarm/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/swarm/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/swarm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/swarm/labels{/name}","releases_url":"https://api.github.com/repos/docker/swarm/releases{/id}","created_at":"2014-05-01T23:15:17Z","updated_at":"2015-05-26T14:09:20Z","pushed_at":"2015-05-26T22:57:20Z","git_url":"git://github.com/docker/swarm.git","ssh_url":"git@github.com:docker/swarm.git","clone_url":"https://github.com/docker/swarm.git","svn_url":"https://github.com/docker/swarm","homepage":"","size":14025,"stargazers_count":2699,"watchers_count":2699,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":321,"mirror_url":null,"open_issues_count":92,"forks":321,"open_issues":92,"watchers":2699,"default_branch":"master"}},"base":{"label":"docker:master","ref":"master","sha":"d4672005bfae2dacc83ee8764c7d422013c9e60e","user":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"repo":{"id":19360616,"name":"swarm","full_name":"docker/swarm","owner":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/docker/swarm","description":"Swarm: a Docker-native clustering system","fork":false,"url":"https://api.github.com/repos/docker/swarm","forks_url":"https://api.github.com/repos/docker/swarm/forks","keys_url":"https://api.github.com/repos/docker/swarm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/swarm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/swarm/teams","hooks_url":"https://api.github.com/repos/docker/swarm/hooks","issue_events_url":"https://api.github.com/repos/docker/swarm/issues/events{/number}","events_url":"https://api.github.com/repos/docker/swarm/events","assignees_url":"https://api.github.com/repos/docker/swarm/assignees{/user}","branches_url":"https://api.github.com/repos/docker/swarm/branches{/branch}","tags_url":"https://api.github.com/repos/docker/swarm/tags","blobs_url":"https://api.github.com/repos/docker/swarm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/swarm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/swarm/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/swarm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/swarm/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/swarm/languages","stargazers_url":"https://api.github.com/repos/docker/swarm/stargazers","contributors_url":"https://api.github.com/repos/docker/swarm/contributors","subscribers_url":"https://api.github.com/repos/docker/swarm/subscribers","subscription_url":"https://api.github.com/repos/docker/swarm/subscription","commits_url":"https://api.github.com/repos/docker/swarm/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/swarm/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/swarm/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/swarm/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/swarm/contents/{+path}","compare_url":"https://api.github.com/repos/docker/swarm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/swarm/merges","archive_url":"https://api.github.com/repos/docker/swarm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/swarm/downloads","issues_url":"https://api.github.com/repos/docker/swarm/issues{/number}","pulls_url":"https://api.github.com/repos/docker/swarm/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/swarm/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/swarm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/swarm/labels{/name}","releases_url":"https://api.github.com/repos/docker/swarm/releases{/id}","created_at":"2014-05-01T23:15:17Z","updated_at":"2015-05-26T14:09:20Z","pushed_at":"2015-05-26T22:57:20Z","git_url":"git://github.com/docker/swarm.git","ssh_url":"git@github.com:docker/swarm.git","clone_url":"https://github.com/docker/swarm.git","svn_url":"https://github.com/docker/swarm","homepage":"","size":14025,"stargazers_count":2699,"watchers_count":2699,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":321,"mirror_url":null,"open_issues_count":92,"forks":321,"open_issues":92,"watchers":2699,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/swarm/pulls/845"},"html":{"href":"https://github.com/docker/swarm/pull/845"},"issue":{"href":"https://api.github.com/repos/docker/swarm/issues/845"},"comments":{"href":"https://api.github.com/repos/docker/swarm/issues/845/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/swarm/pulls/845/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/swarm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/swarm/pulls/845/commits"},"statuses":{"href":"https://api.github.com/repos/docker/swarm/statuses/77cb3f65681fdd57ed58149e70fd9a687dba29c6"}}}}