forked from kubernetes-sigs/kubespray
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request kubernetes-sigs#133 from Smana/weave_network_plugin
weave network plugin
- Loading branch information
Showing
14 changed files
with
230 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
- name: restart docker | ||
command: /bin/true | ||
notify: | ||
- reload systemd | ||
- reload docker | ||
|
||
- name : reload systemd | ||
shell: systemctl daemon-reload | ||
when: init_system == "systemd" | ||
|
||
- name: restart weave | ||
command: /bin/true | ||
notify: | ||
- reload systemd | ||
- reload weave | ||
|
||
- name: restart weaveproxy | ||
command: /bin/true | ||
notify: | ||
- reload systemd | ||
- reload weaveproxy | ||
|
||
- name: restart weaveexpose | ||
command: /bin/true | ||
notify: | ||
- reload systemd | ||
- reload weaveexpose | ||
|
||
- name: reload docker | ||
service: | ||
name: docker | ||
state: restarted | ||
|
||
- name: reload weave | ||
service: | ||
name: weave | ||
state: restarted | ||
|
||
- name: reload weaveproxy | ||
service: | ||
name: weaveproxy | ||
state: restarted | ||
|
||
- name: reload weaveexpose | ||
service: | ||
name: weaveexpose | ||
state: restarted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
--- | ||
- name: Set docker daemon options | ||
template: | ||
src: docker | ||
dest: "/etc/default/docker" | ||
owner: root | ||
group: root | ||
mode: 0644 | ||
notify: | ||
- restart docker | ||
|
||
- name: Write docker.service systemd file | ||
template: | ||
src: systemd-docker.service | ||
dest: /lib/systemd/system/docker.service | ||
notify: restart docker | ||
when: init_system == "systemd" | ||
|
||
- meta: flush_handlers | ||
|
||
- name: Weave | Install weave | ||
command: rsync -piu "{{ local_release_dir }}/weave/bin/weave" "{{ bin_dir }}/weave" | ||
changed_when: false | ||
|
||
- name: Weave | pull weave images | ||
shell: "{{ bin_dir }}/weave setup" | ||
changed_when: false | ||
|
||
- name: Weave | set perms | ||
file: path="{{ bin_dir }}/weave" mode=0755 state=file | ||
|
||
- name: Weave | Set options | ||
template: | ||
src: weave.j2 | ||
dest: "/etc/weave.env" | ||
owner: root | ||
group: root | ||
mode: 0644 | ||
notify: | ||
- restart systemd-weave | ||
|
||
- name: Weave | Write weave systemd init file | ||
template: src=weave.service.j2 dest=/etc/systemd/system/weave.service | ||
when: init_system == "systemd" | ||
notify: restart systemd-weave | ||
|
||
- name: Weave | Write weaveproxy systemd init file | ||
template: src=weaveproxy.service.j2 dest=/etc/systemd/system/weaveproxy.service | ||
when: init_system == "systemd" | ||
notify: restart systemd-weaveproxy | ||
|
||
- name: Weave | Write weaveexpose systemd init file | ||
template: src=weaveexpose.service.j2 dest=/etc/systemd/system/weaveexpose.service | ||
when: init_system == "systemd" | ||
notify: restart systemd-weaveexpose | ||
|
||
- name: Weave | Enable weave | ||
service: name=weave enabled=yes state=started | ||
|
||
- name: Weave | Enable weaveproxy | ||
service: name=weaveproxy enabled=yes state=started | ||
|
||
- name: Weave | Enable weaveexpose | ||
service: name=weaveexpose enabled=yes state=started |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Deployed by Ansible | ||
DOCKER_OPTS="" |
28 changes: 28 additions & 0 deletions
28
roles/network_plugin/weave/templates/systemd-docker.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[Unit] | ||
Description=Docker Application Container Engine | ||
Documentation=http://docs.docker.com | ||
{% if ansible_os_family == "RedHat" %} | ||
After=network.target | ||
Wants=docker-storage-setup.service | ||
{% elif ansible_os_family == "Debian" %} | ||
After=network.target docker.socket | ||
Requires=docker.socket | ||
{% endif %} | ||
|
||
[Service] | ||
Type=notify | ||
EnvironmentFile=-/etc/default/docker | ||
Environment=GOTRACEBACK=crash | ||
ExecStart=/usr/bin/docker daemon \ | ||
$OPTIONS \ | ||
$DOCKER_STORAGE_OPTIONS \ | ||
$DOCKER_NETWORK_OPTIONS \ | ||
$INSECURE_REGISTRY | ||
LimitNOFILE=1048576 | ||
LimitNPROC=1048576 | ||
LimitCORE=infinity | ||
MountFlags=slave | ||
TimeoutStartSec=1min | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
WEAVE_PEERS="{% for host in groups['k8s-cluster'] %}{{ hostvars[host]['access_ip'] | default(hostvars[host]['ip'] | default(hostvars[host]['ansible_default_ipv4']['address'])) }}{% if not loop.last %} {% endif %}{% endfor %}" | ||
WEAVEPROXY_ARGS="--rewrite-inspect --without-dns" | ||
WEAVE_SUBNET="--ipalloc-range {{ kube_pods_subnet }}" | ||
{% if weave_password is defined %} | ||
WEAVE_PASSWORD="{{ weave_password }}" | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[Unit] | ||
Description=Weave Network | ||
Documentation=http://docs.weave.works/weave/latest_release/ | ||
Requires=docker.service | ||
After=docker.service | ||
|
||
[Service] | ||
EnvironmentFile=-/etc/weave.env | ||
ExecStartPre={{ bin_dir }}/weave launch-router \ | ||
$WEAVE_SUBNET \ | ||
$WEAVE_PEERS | ||
ExecStart=/usr/bin/docker attach weave | ||
ExecStop={{ bin_dir }}/weave stop-router | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
18 changes: 18 additions & 0 deletions
18
roles/network_plugin/weave/templates/weaveexpose.service.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[Unit] | ||
Documentation=http://docs.weave.works/ | ||
Requires=docker.service | ||
Requires=weave.service | ||
After=weave.service | ||
After=docker.service | ||
|
||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=yes | ||
TimeoutStartSec=0 | ||
EnvironmentFile=-/etc/weave.%H.env | ||
EnvironmentFile=-/etc/weave.env | ||
ExecStart={{ bin_dir }}/weave expose | ||
ExecStop={{ bin_dir }}/weave hide | ||
|
||
[Install] | ||
WantedBy=weave-network.target |
16 changes: 16 additions & 0 deletions
16
roles/network_plugin/weave/templates/weaveproxy.service.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[Unit] | ||
Description=Weave proxy for Docker API | ||
Documentation=http://docs.weave.works/ | ||
Requires=docker.service | ||
After=docker.service | ||
|
||
[Service] | ||
EnvironmentFile=-/etc/weave.%H.env | ||
EnvironmentFile=-/etc/weave.env | ||
ExecStartPre={{ bin_dir }}/weave launch-proxy $WEAVEPROXY_ARGS | ||
ExecStart=/usr/bin/docker attach weaveproxy | ||
Restart=on-failure | ||
ExecStop=/opt/bin/weave stop-proxy | ||
|
||
[Install] | ||
WantedBy=weave-network.target |