瀏覽代碼

Merge pull request #17 from eyakubovich/master

explicitly add a route for rudder interface
Eugene Yakubovich 10 年之前
父節點
當前提交
25b201c2a8
共有 3 個文件被更改,包括 34 次插入2 次删除
  1. 23 0
      README.md
  2. 10 1
      udp/run.go
  3. 1 1
      version.go

+ 23 - 0
README.md

@@ -16,6 +16,12 @@ providers. Rudder uses the Universal TUN/TAP device and creates an overlay netwo
 using UDP to encapsulate IP packets. The subnet allocation is done with the help
 of etcd which maintains the overlay to actual IP mappings.
 
+## Building Rudder
+
+* Step 1: Make sure you have Linux headers installed on your machine. On Ubuntu, run ```sudo apt-get install linux-libc-dev```. On Fedora/Redhat, run ```sudo yum install kernel-headers```.
+* Step 2: Git clone the Rudder repo: ```git clone git@github.com:coreos-inc/rudder.git```
+* Step 3: Run the build script: ```cd rudder; ./build```
+
 ## Configuration
 
 Rudder reads its configuration from etcd. By default, it will read the configuration
@@ -69,3 +75,20 @@ docker -d --bip=${RUDDER_SUBNET} --mtu=${RUDDER_MTU}
 ```
 
 Systemd users can use ```EnvironmentFile``` directive in the .service file to pull in ```/run/rudder/subnet.env```
+
+## CoreOS integration
+
+On CoreOS it is useful to add Rudder configuration into .service file in the cloud-config as the following snippet demonstrates:
+
+```
+  - name: rudder.service
+    command: start
+    content: |
+      [Unit]
+      Requires=etcd.service
+      After=etcd.service
+
+      [Service]
+      ExecStartPre=-/usr/bin/etcdctl mk /coreos.com/network/config '{"Network":"10.0.0.0/16"}'
+      ExecStart=/opt/bin/rudder
+```

+ 10 - 1
udp/run.go

@@ -3,6 +3,7 @@ package udp
 import (
 	"encoding/json"
 	"net"
+	"syscall"
 	"time"
 
 	"github.com/coreos-inc/rudder/Godeps/_workspace/src/github.com/docker/libcontainer/netlink"
@@ -39,7 +40,15 @@ func configureIface(ifname string, ipn pkg.IP4Net, mtu int) error {
 
 	err = netlink.NetworkLinkUp(iface)
 	if err != nil {
-		log.Errorf("Failed set interface %s to UP state: %s", ifname, err)
+		log.Errorf("Failed to set interface %s to UP state: %s", ifname, err)
+		return err
+	}
+
+	// explicitly add a route since there might be a route for a subnet already
+	// installed by Docker and then it won't get auto added
+	err = netlink.AddRoute(ipn.Network().String(), "", "", ifname)
+	if err != nil && err != syscall.EEXIST {
+		log.Errorf("Failed to add route (%s -> %s): ", ipn.Network().String(), ifname, err)
 		return err
 	}
 

+ 1 - 1
version.go

@@ -1,3 +1,3 @@
 package main
 
-const Version = "0.1"
+const Version = "0.1+git"