{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/origin/pulls/comments/46722611","id":46722611,"diff_hunk":"@@ -179,6 +185,156 @@ os::provision::get-network-plugin() {\n   echo \"${plugin}\"\n }\n \n+os::provision::install-networking() {\n+  local plugin=$1\n+  local master_ip=$2\n+  local origin_root=$3\n+  local config_root=$4\n+  local is_master=${5:-false}\n+\n+  echo \"Configuring networking\"\n+\n+  if [[ \"${plugin}\" =~ redhat/ ]]; then\n+    os::provision::install-sdn \"${origin_root}\"\n+  elif [[ \"${plugin}\" = \"flannel\" ]]; then\n+    os::provision::install-flannel \"${master_ip}\" \"${origin_root}\" \\\n+        \"${config_root}\" \"${is_master}\"\n+  else\n+    >&2 echo \"Unable to deploy network plugin ${plugin}\"\n+    exit 1\n+  fi\n+}\n+\n+os::provision::install-flannel() {\n+  local master_ip=$1\n+  local origin_root=$2\n+  local config_root=$3\n+  local is_master=$4\n+\n+  if os::provision::in-container; then\n+    local if_name=eth0\n+  else\n+    yum install -y flannel\n+\n+    local conf_path=/etc/sysconfig/network-scripts/\n+    local if_to_edit=$(find ${conf_path}ifcfg-* | xargs grep -l VAGRANT-BEGIN)\n+    local if_name=`echo ${if_to_edit} | awk -F- '{ print $3 }'`\n+  fi\n+\n+  if [ \"${is_master}\" = \"true\" ]; then\n+    os::provision::flannel-configure-master \"${master_ip}\" \"${origin_root}\" \\\n+       \"${config_root}\" \"${if_name}\"\n+  else\n+    local daemon_opts=\"-iface=${if_name} -ip-masq=false -v=5 \\\n+-remote=${master_ip}:8080\"\n+    cat <<EOF > /etc/sysconfig/flanneld\n+FLANNEL_OPTIONS=\"${daemon_opts}\"\n+EOF\n+\n+    # Rewrite flanneld unit ExecStart to remove etcd arguments\n+    sed -i.bak -e 's+\\(ExecStart=/usr/bin/flanneld\\)+\\1 $FLANNEL_OPTIONS+' \\\n+        /lib/systemd/system/flanneld.service\n+  fi\n+\n+  # Running flanneld with '-listen' or '-remote' requires changing the\n+  # unit type to 'simple'.  The default is type 'notify', which would\n+  # result in waiting forever for a notification that wouldn't come.\n+  sed -i.bak -e 's+\\(Type=\\)notify+\\1simple+' \\\n+      /lib/systemd/system/flanneld.service\n+\n+  # Changing the flanneld unit type prevents ExecStartPost from\n+  # triggering at the correct time.  The post start task\n+  # (mk-docker-opts.sh) must instead be run manually once flannel has\n+  # written its configuration.\n+  sed -i.bak -e 's+\\(ExecStartPost=.*\\)+#\\1+' \\\n+      /lib/systemd/system/flanneld.service\n+\n+  systemctl enable flanneld\n+  systemctl start flanneld\n+\n+  # Ensure that docker on the nodes is configured for flannel.\n+  if [ \"${is_master}\" != \"true\" ]; then\n+    os::provision::flannel-configure-docker\n+  fi\n+}\n+\n+os::provision::flannel-configure-master() {\n+  local master_ip=$1\n+  local origin_root=$2\n+  local config_root=$3\n+  local if_name=$4\n+\n+  local cert_path=\"${config_root}/openshift.local.config/master\"\n+  local ca_file=\"${cert_path}/ca.crt\"\n+  local cert_file=\"${cert_path}/master.etcd-client.crt\"\n+  local key_file=\"${cert_path}/master.etcd-client.key\"\n+  local etcd_url=\"https://${master_ip}:4001\"\n+  local etcd_key=\"/atomic.io/network\"\n+\n+  local daemon_opts=\"-iface=${if_name} -ip-masq=false -v=5 \\\n+-etcd-cafile=${ca_file} -etcd-certfile=${cert_file} -etcd-keyfile=${key_file} \\\n+-listen=${master_ip}:8080\"\n+\n+  cat <<EOF > /etc/sysconfig/flanneld\n+FLANNEL_ETCD=\"${etcd_url}\"\n+FLANNEL_ETCD_KEY=\"${etcd_key}\"\n+FLANNEL_OPTIONS=\"${daemon_opts}\"\n+EOF\n+\n+  local etcdctl_cmd=\"${origin_root}/_tools/etcd/bin/etcdctl \\\n+-C ${etcd_url} --ca-file ${ca_file} --cert-file ${cert_file} --key-file \\\n+${key_file}\"\n+\n+  local msg=\"etcd daemon to become available\"\n+  local condition=\"os::provision::check-etcd ${etcdctl_cmd}\"\n+  os::provision::wait-for-condition \"${msg}\" \"${condition}\"\n+\n+  cat <<EOF > /etc/flannel-config.json\n+{\n+\"Network\": \"10.1.0.0/16\",\n+\"SubnetLen\": 24,\n+\"Backend\": {\n+    \"Type\": \"udp\",\n+    \"Port\": 8285\n+ }\n+}\n+EOF\n+\n+  # Import default configuration into etcd\n+  ${etcdctl_cmd} set \"${etcd_key}/config\" < /etc/flannel-config.json \\\n+      > /dev/null\n+}\n+\n+os::provision::check-etcd() {\n+  $@ ls &> /dev/null\n+}\n+\n+os::provision::flannel-configure-docker() {\n+  local msg=\"flannel configuration to become available\"\n+  local condition=\"test -f /run/flannel/subnet.env\"\n+\n+  # The master flannel instance may take a while to become available.\n+  os::provision::wait-for-condition \"${msg}\" \"${condition}\" \\\n+      \"${OS_WAIT_FOREVER}\"\n+\n+  # Generate the docker configuration from the flannel configuration\n+  /usr/libexec/flannel/mk-docker-opts.sh -d /run/flannel/docker\n+\n+  # Update the docker unit file to use the flannel configuration.\n+  local docker_unit=\"/lib/systemd/system/docker.service\"\n+  sed -i.bak -e 's+\\(Type=notify\\)+\\1\\nEnvironmentFile=/run/flannel/docker+'\\\n+      \"${docker_unit}\"\n+  sed -i.bak -e 's+\\($DOCKER_NETWORK_OPTIONS\\)+\\1 $DOCKER_OPTS+' \\\n+      \"${docker_unit}\"","path":"contrib/vagrant/provision-util.sh","position":173,"original_position":173,"commit_id":"f493a013129b875b1926c36134d762e5fa897f28","original_commit_id":"f493a013129b875b1926c36134d762e5fa897f28","user":{"login":"eparis","id":8093535,"avatar_url":"https://avatars.githubusercontent.com/u/8093535?v=3","gravatar_id":"","url":"https://api.github.com/users/eparis","html_url":"https://github.com/eparis","followers_url":"https://api.github.com/users/eparis/followers","following_url":"https://api.github.com/users/eparis/following{/other_user}","gists_url":"https://api.github.com/users/eparis/gists{/gist_id}","starred_url":"https://api.github.com/users/eparis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eparis/subscriptions","organizations_url":"https://api.github.com/users/eparis/orgs","repos_url":"https://api.github.com/users/eparis/repos","events_url":"https://api.github.com/users/eparis/events{/privacy}","received_events_url":"https://api.github.com/users/eparis/received_events","type":"User","site_admin":false},"body":"Changes to docker unit files should not be needed at all...   Are you sure this was needed?","created_at":"2015-12-04T19:36:41Z","updated_at":"2015-12-04T19:36:41Z","html_url":"https://github.com/openshift/origin/pull/6128#discussion_r46722611","pull_request_url":"https://api.github.com/repos/openshift/origin/pulls/6128","_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments/46722611"},"html":{"href":"https://github.com/openshift/origin/pull/6128#discussion_r46722611"},"pull_request":{"href":"https://api.github.com/repos/openshift/origin/pulls/6128"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/origin/pulls/6128","id":52161379,"html_url":"https://github.com/openshift/origin/pull/6128","diff_url":"https://github.com/openshift/origin/pull/6128.diff","patch_url":"https://github.com/openshift/origin/pull/6128.patch","issue_url":"https://api.github.com/repos/openshift/origin/issues/6128","number":6128,"state":"open","locked":false,"title":"Support provisioning a dev cluster with flannel","user":{"login":"marun","id":451477,"avatar_url":"https://avatars.githubusercontent.com/u/451477?v=3","gravatar_id":"","url":"https://api.github.com/users/marun","html_url":"https://github.com/marun","followers_url":"https://api.github.com/users/marun/followers","following_url":"https://api.github.com/users/marun/following{/other_user}","gists_url":"https://api.github.com/users/marun/gists{/gist_id}","starred_url":"https://api.github.com/users/marun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marun/subscriptions","organizations_url":"https://api.github.com/users/marun/orgs","repos_url":"https://api.github.com/users/marun/repos","events_url":"https://api.github.com/users/marun/events{/privacy}","received_events_url":"https://api.github.com/users/marun/received_events","type":"User","site_admin":false},"body":"Setting OPENSHIFT_NETWORK_PLUGIN=flannel will deploy a dev or dind\r\ncluster with flannel using udp encapsulation.","created_at":"2015-11-30T18:33:08Z","updated_at":"2015-12-04T19:36:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6676df7ce8de6b56b01fd6bf825664b51bd0e7fc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openshift/origin/pulls/6128/commits","review_comments_url":"https://api.github.com/repos/openshift/origin/pulls/6128/comments","review_comment_url":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/origin/issues/6128/comments","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/f493a013129b875b1926c36134d762e5fa897f28","head":{"label":"marun:provision-flannel","ref":"provision-flannel","sha":"f493a013129b875b1926c36134d762e5fa897f28","user":{"login":"marun","id":451477,"avatar_url":"https://avatars.githubusercontent.com/u/451477?v=3","gravatar_id":"","url":"https://api.github.com/users/marun","html_url":"https://github.com/marun","followers_url":"https://api.github.com/users/marun/followers","following_url":"https://api.github.com/users/marun/following{/other_user}","gists_url":"https://api.github.com/users/marun/gists{/gist_id}","starred_url":"https://api.github.com/users/marun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marun/subscriptions","organizations_url":"https://api.github.com/users/marun/orgs","repos_url":"https://api.github.com/users/marun/repos","events_url":"https://api.github.com/users/marun/events{/privacy}","received_events_url":"https://api.github.com/users/marun/received_events","type":"User","site_admin":false},"repo":{"id":36902865,"name":"origin","full_name":"marun/origin","owner":{"login":"marun","id":451477,"avatar_url":"https://avatars.githubusercontent.com/u/451477?v=3","gravatar_id":"","url":"https://api.github.com/users/marun","html_url":"https://github.com/marun","followers_url":"https://api.github.com/users/marun/followers","following_url":"https://api.github.com/users/marun/following{/other_user}","gists_url":"https://api.github.com/users/marun/gists{/gist_id}","starred_url":"https://api.github.com/users/marun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marun/subscriptions","organizations_url":"https://api.github.com/users/marun/orgs","repos_url":"https://api.github.com/users/marun/repos","events_url":"https://api.github.com/users/marun/events{/privacy}","received_events_url":"https://api.github.com/users/marun/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/marun/origin","description":"OpenShift 3 - build, deploy, and manage your applications with Docker and Kubernetes","fork":true,"url":"https://api.github.com/repos/marun/origin","forks_url":"https://api.github.com/repos/marun/origin/forks","keys_url":"https://api.github.com/repos/marun/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/marun/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/marun/origin/teams","hooks_url":"https://api.github.com/repos/marun/origin/hooks","issue_events_url":"https://api.github.com/repos/marun/origin/issues/events{/number}","events_url":"https://api.github.com/repos/marun/origin/events","assignees_url":"https://api.github.com/repos/marun/origin/assignees{/user}","branches_url":"https://api.github.com/repos/marun/origin/branches{/branch}","tags_url":"https://api.github.com/repos/marun/origin/tags","blobs_url":"https://api.github.com/repos/marun/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/marun/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/marun/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/marun/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/marun/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/marun/origin/languages","stargazers_url":"https://api.github.com/repos/marun/origin/stargazers","contributors_url":"https://api.github.com/repos/marun/origin/contributors","subscribers_url":"https://api.github.com/repos/marun/origin/subscribers","subscription_url":"https://api.github.com/repos/marun/origin/subscription","commits_url":"https://api.github.com/repos/marun/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/marun/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/marun/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/marun/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/marun/origin/contents/{+path}","compare_url":"https://api.github.com/repos/marun/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/marun/origin/merges","archive_url":"https://api.github.com/repos/marun/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/marun/origin/downloads","issues_url":"https://api.github.com/repos/marun/origin/issues{/number}","pulls_url":"https://api.github.com/repos/marun/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/marun/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/marun/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/marun/origin/labels{/name}","releases_url":"https://api.github.com/repos/marun/origin/releases{/id}","created_at":"2015-06-05T00:21:35Z","updated_at":"2015-06-05T00:21:38Z","pushed_at":"2015-12-01T23:25:03Z","git_url":"git://github.com/marun/origin.git","ssh_url":"git@github.com:marun/origin.git","clone_url":"https://github.com/marun/origin.git","svn_url":"https://github.com/marun/origin","homepage":"http://www.openshift.org","size":178300,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openshift:master","ref":"master","sha":"44a37a2284fab5eb31e402c9134ef96f9a3a7614","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"repo":{"id":22442668,"name":"origin","full_name":"openshift/origin","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openshift/origin","description":"OpenShift 3 - build, deploy, and manage your applications with Docker and Kubernetes","fork":false,"url":"https://api.github.com/repos/openshift/origin","forks_url":"https://api.github.com/repos/openshift/origin/forks","keys_url":"https://api.github.com/repos/openshift/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/origin/teams","hooks_url":"https://api.github.com/repos/openshift/origin/hooks","issue_events_url":"https://api.github.com/repos/openshift/origin/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/origin/events","assignees_url":"https://api.github.com/repos/openshift/origin/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/origin/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/origin/tags","blobs_url":"https://api.github.com/repos/openshift/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/origin/languages","stargazers_url":"https://api.github.com/repos/openshift/origin/stargazers","contributors_url":"https://api.github.com/repos/openshift/origin/contributors","subscribers_url":"https://api.github.com/repos/openshift/origin/subscribers","subscription_url":"https://api.github.com/repos/openshift/origin/subscription","commits_url":"https://api.github.com/repos/openshift/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/origin/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/origin/merges","archive_url":"https://api.github.com/repos/openshift/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/origin/downloads","issues_url":"https://api.github.com/repos/openshift/origin/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/origin/labels{/name}","releases_url":"https://api.github.com/repos/openshift/origin/releases{/id}","created_at":"2014-07-30T20:04:05Z","updated_at":"2015-12-04T15:11:45Z","pushed_at":"2015-12-04T19:29:28Z","git_url":"git://github.com/openshift/origin.git","ssh_url":"git@github.com:openshift/origin.git","clone_url":"https://github.com/openshift/origin.git","svn_url":"https://github.com/openshift/origin","homepage":"http://www.openshift.org","size":232774,"stargazers_count":852,"watchers_count":852,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":534,"mirror_url":null,"open_issues_count":709,"forks":534,"open_issues":709,"watchers":852,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/6128"},"html":{"href":"https://github.com/openshift/origin/pull/6128"},"issue":{"href":"https://api.github.com/repos/openshift/origin/issues/6128"},"comments":{"href":"https://api.github.com/repos/openshift/origin/issues/6128/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/origin/pulls/6128/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/origin/pulls/6128/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/origin/statuses/f493a013129b875b1926c36134d762e5fa897f28"}}}}