Browse Source

Simplify docker role, cbr0 for calico isn't required anymore

pull/15/head
Smaine Kahlouch 9 years ago
parent
commit
d3f35e12a2
3 changed files with 1 additions and 25 deletions
  1. 8
      roles/docker/tasks/configure.yml
  2. 14
      roles/docker/templates/create_cbr.j2
  3. 4
      roles/docker/templates/default-docker.j2

8
roles/docker/tasks/configure.yml

@ -1,12 +1,4 @@
--- ---
- name: Write script for calico/docker bridge configuration
template: src=create_cbr.j2 dest=/etc/network/if-up.d/create_cbr mode=u+x backup=yes
when: kube_network_plugin is defined and kube_network_plugin == "calico"
- name: Configure calico/docker bridge
command: /etc/network/if-up.d/create_cbr
when: kube_network_plugin is defined and kube_network_plugin == "calico"
- name: enable docker - name: enable docker
service: service:
name: docker name: docker

14
roles/docker/templates/create_cbr.j2

@ -1,14 +0,0 @@
#!/bin/bash
# Create calico bridge cbr0 if it doesn't exist
ifaces=$(ifconfig -a | sed 's/[ \t].*//;/^\(lo\|\)$/d' |tr '\n' ' ')
if ! [[ "${ifaces}" =~ "cbr0" ]];then
brctl addbr cbr0
ip link set cbr0 up
fi
# Configure calico bridge ip
br_ips=$(ip addr list cbr0 |grep "inet " |cut -d' ' -f6)
if ! [[ "${br_ips}" =~ "{{ br_addr }}/{{ kube_network_node_prefix }}" ]];then
ip a add {{ br_addr }}/{{ kube_network_node_prefix }} dev cbr0
fi

4
roles/docker/templates/default-docker.j2

@ -4,9 +4,7 @@
#DOCKER="/usr/local/bin/docker" #DOCKER="/usr/local/bin/docker"
# Use DOCKER_OPTS to modify the daemon startup options. # Use DOCKER_OPTS to modify the daemon startup options.
{% if kube_network_plugin is defined and kube_network_plugin == "calico" %}
DOCKER_OPTS="--bridge=cbr0 --iptables=false --ip-masq=false"
{% endif %}
#DOCKER_OPTS=""
# If you need Docker to use an HTTP proxy, it can also be specified here. # If you need Docker to use an HTTP proxy, it can also be specified here.
#export http_proxy="http://127.0.0.1:3128/" #export http_proxy="http://127.0.0.1:3128/"

Loading…
Cancel
Save