Move docker systemd unit creation to docker role

Creating the unit using default settings early on
and then changing it during network_plugin section
leads to too many docker restarts and duplicated code.

Reversed Wants= dependence on docker.service so it does not
restart docker when reloading systemd

Consolidated all docker restart handlers.
This commit is contained in:
Matthew Mosesohn
2016-08-02 13:42:27 +03:00
parent 2af71f31b4
commit e8a1c7a53f
18 changed files with 38 additions and 128 deletions

View File

@@ -3,10 +3,10 @@ Description=Kubernetes Kubelet Server
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
{% if kube_network_plugin is defined and kube_network_plugin == "calico" %}
After=docker.service docker.socket calico-node.service
Wants=docker.service docker.socket calico-node.service
Wants=docker.socket calico-node.service
{% else %}
After=docker.service docker.socket
Wants=docker.service docker.socket
After=docker.service
Wants=docker.socket
{% endif %}
[Service]
@@ -24,7 +24,7 @@ ExecStart={{ bin_dir }}/kubelet \
$KUBELET_REGISTER_NODE \
$KUBELET_NETWORK_PLUGIN \
$KUBELET_CLOUDPROVIDER
ExecStopPost=-/usr/bin/docker rm -f kubelet
ExecStartPre=-/usr/bin/docker rm -f kubelet
ExecReload=/usr/bin/docker restart kubelet
Restart=always
RestartSec=10s