Skip to content

Commit 15f1224

Browse files
committed
Merge pull request #4103 from krancour/overlay-minimal
feat(platform): add overlay network
2 parents d332f73 + 79aa29d commit 15f1224

2 files changed

Lines changed: 49 additions & 4 deletions

File tree

Vagrantfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,13 @@ Vagrant.configure("2") do |config|
9090
end
9191

9292
config.trigger.before :up do
93-
if !File.exists?(CLOUD_CONFIG_PATH) || File.readlines(CLOUD_CONFIG_PATH).grep(/\s*discovery #DISCOVERY_URL/).any?
93+
if File.exists?(CLOUD_CONFIG_PATH) && !File.readlines(CLOUD_CONFIG_PATH).grep(/\s*discovery #DISCOVERY_URL/).any?
94+
# Vagrant binds the VMs IP in VirtualBox's bridge network to the eth1 interface instead of eth0.
95+
# This necessitates the substitution below, which is not required anywhere except in Vagrant.
96+
user_data = File.read(CLOUD_CONFIG_PATH)
97+
new_userdata = user_data.gsub("--iface=eth0", "--iface=eth1")
98+
File.open(CLOUD_CONFIG_PATH, "w") {|file| file.puts new_userdata }
99+
else
94100
raise Vagrant::Errors::VagrantError.new, "Run 'make discovery-url' first to create user-data."
95101
end
96102
end

contrib/coreos/user-data.example

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,41 @@ coreos:
6363
Service=docker.service
6464
[Install]
6565
WantedBy=sockets.target
66+
- name: flanneld.service
67+
command: start
68+
content: |
69+
[Unit]
70+
Description=Network fabric for containers
71+
Documentation=https://github.com/coreos/flannel
72+
Requires=early-docker.service etcd.service
73+
After=etcd.service early-docker.service
74+
Before=early-docker.target
75+
76+
[Service]
77+
Type=notify
78+
Restart=always
79+
RestartSec=5
80+
Environment="TMPDIR=/var/tmp/"
81+
Environment="DOCKER_HOST=unix:///var/run/early-docker.sock"
82+
Environment="FLANNEL_VER=0.5.1"
83+
LimitNOFILE=40000
84+
LimitNPROC=1048576
85+
ExecStartPre=/sbin/modprobe ip_tables
86+
ExecStartPre=/usr/bin/mkdir -p /run/flannel
87+
ExecStartPre=/usr/bin/touch /run/flannel/options.env
88+
ExecStartPre=-/usr/bin/etcdctl mk /coreos.com/network/config '{"Network":"10.244.0.0/16", "SubnetLen": 24, "SubnetMin":"10.244.0.0", "Backend": {"Type": "vxlan"}}'
89+
ExecStart=/usr/libexec/sdnotify-proxy /run/flannel/sd.sock \
90+
/usr/bin/docker run --net=host --privileged=true --rm \
91+
--volume=/run/flannel:/run/flannel \
92+
--env=NOTIFY_SOCKET=/run/flannel/sd.sock \
93+
--env-file=/run/flannel/options.env \
94+
--volume=/usr/share/ca-certificates:/etc/ssl/certs:ro \
95+
quay.io/coreos/flannel:${FLANNEL_VER} /opt/bin/flanneld --iface=eth0 --ip-masq=true
96+
97+
# Update docker options
98+
ExecStartPost=/usr/bin/docker run --net=host --rm -v /run:/run \
99+
quay.io/coreos/flannel:${FLANNEL_VER} \
100+
/opt/bin/mk-docker-opts.sh -d /run/flannel_docker_opts.env -i
66101
- name: stop-update-engine.service
67102
command: start
68103
content: |
@@ -143,9 +178,13 @@ write_files:
143178
}
144179
- path: /etc/systemd/system/docker.service.d/50-insecure-registry.conf
145180
content: |
146-
[Service]
147-
EnvironmentFile=/etc/environment_proxy
148-
Environment="DOCKER_OPTS=--insecure-registry 10.0.0.0/8 --insecure-registry 172.16.0.0/12 --insecure-registry 192.168.0.0/16 --insecure-registry 100.64.0.0/10"
181+
[Unit]
182+
Requires=flanneld.service
183+
After=flanneld.service
184+
185+
[Service]
186+
EnvironmentFile=/etc/environment_proxy
187+
Environment="DOCKER_OPTS=--insecure-registry 10.0.0.0/8 --insecure-registry 172.16.0.0/12 --insecure-registry 192.168.0.0/16 --insecure-registry 100.64.0.0/10"
149188
- path: /run/deis/bin/get_image
150189
permissions: '0755'
151190
content: |

0 commit comments

Comments
 (0)