mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-02-23 14:06:03 -03:30
Systemd units, limits, and bin path fixes
* Add restart for weave service unit * Reuse docker_bin_dir everythere * Limit systemd managed docker containers by CPU/RAM. Do not configure native systemd limits due to the lack of consensus in the kernel community requires out-of-tree kernel patches. Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
This commit is contained in:
committed by
Bogdan Dobrelya
parent
6139ee3add
commit
a56d9de502
4
roles/network_plugin/weave/defaults/main.yml
Normal file
4
roles/network_plugin/weave/defaults/main.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
# Limits
|
||||
weave_memory_limit: 500M
|
||||
weave_cpu_limit: 300m
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: Weave | Copy cni plugins from hyperkube
|
||||
command: "/usr/bin/docker run --rm -v /opt/cni/bin:/cnibindir {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} /bin/cp -r /opt/cni/bin/. /cnibindir/"
|
||||
command: "{{ docker_bin_dir }}/docker run --rm -v /opt/cni/bin:/cnibindir {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} /bin/cp -r /opt/cni/bin/. /cnibindir/"
|
||||
register: cni_task_result
|
||||
until: cni_task_result.rc == 0
|
||||
retries: 4
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
WEAVE_DOCKER_ARGS="--memory={{ weave_memory_limit|regex_replace('Mi', 'M') }} --cpu-shares={{ weave_cpu_limit|regex_replace('m', '') }}"
|
||||
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 }}"
|
||||
|
||||
@@ -6,12 +6,13 @@ After=docker.service docker.socket
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=-/etc/weave.env
|
||||
ExecStartPre=-/usr/bin/docker rm -f weave
|
||||
ExecStartPre=-{{ docker_bin_dir }}/docker rm -f weave
|
||||
ExecStartPre={{ bin_dir }}/weave launch-router \
|
||||
$WEAVE_SUBNET \
|
||||
$WEAVE_PEERS
|
||||
ExecStart=/usr/bin/docker attach weave
|
||||
ExecStart={{ docker_bin_dir }}/docker attach weave
|
||||
ExecStop={{ bin_dir }}/weave stop
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
@@ -7,11 +7,11 @@ After=docker.service docker.socket
|
||||
[Service]
|
||||
EnvironmentFile=-/etc/weave.%H.env
|
||||
EnvironmentFile=-/etc/weave.env
|
||||
ExecStartPre=-/usr/bin/docker rm -f weaveproxy
|
||||
ExecStartPre=-{{ docker_bin_dir }}/docker rm -f weaveproxy
|
||||
ExecStartPre={{ bin_dir }}/weave launch-proxy $WEAVEPROXY_ARGS
|
||||
ExecStart=/usr/bin/docker attach weaveproxy
|
||||
ExecStart={{ docker_bin_dir }}/docker attach weaveproxy
|
||||
Restart=on-failure
|
||||
ExecStop=/opt/bin/weave stop-proxy
|
||||
ExecStop={{ bin_dir }}/weave stop-proxy
|
||||
|
||||
[Install]
|
||||
WantedBy=weave-network.target
|
||||
|
||||
Reference in New Issue
Block a user