Ensure network config has been applied before containerd

If containerd is started prior to networking providing a default route,
the containerd cri plugin will fail to load with the following message:

msg="failed to load plugin io.containerd.grpc.v1.cri" error="failed to
create CRI service: failed to create stream server: failed to get stream
server address: no default routes found in \"/proc/net/route\" or
\"/proc/net/ipv6_route\""

and the status of the plugin will be in 'error'

TYPE                  ID  PLATFORMS   STATUS
io.containerd.grpc.v1 cri linux/amd64 error

This will prevent any crictl image pulls from working.

This change will ensure the network config is applied prior to
configuring and restarting containerd.

Docker and containerd also have a dependency, so also ensure the
network config is applied prior to configuring and restarting
docker.

Change-Id: I94a3349b438816d21b147cbd62054862d07d8bee
Partial-Bug: #1868728
Signed-off-by: Robert Church <robert.church@windriver.com>
This commit is contained in:
Robert Church 2020-03-27 23:38:24 -04:00
parent 6060fb15cd
commit 296bd3d1f7
2 changed files with 12 additions and 0 deletions

View File

@ -16,6 +16,12 @@ class platform::containerd::config
include ::platform::kubernetes::params
include ::platform::dockerdistribution::registries
# If containerd is started prior to networking providing a default route, the
# containerd cri plugin will fail to load and the status of the cri plugin
# will be in 'error'. This will prevent any crictl image pulls from working as
# containerd is not automatically restarted when plugins fail to load.
Anchor['platform::networking'] -> Class[$name]
# inherit the proxy setting from docker
$http_proxy = $::platform::docker::params::http_proxy
$https_proxy = $::platform::docker::params::https_proxy

View File

@ -20,6 +20,12 @@ class platform::docker::params (
class platform::docker::config
inherits ::platform::docker::params {
# Docker restarts will trigger a containerd restart and containerd needs a
# default route present for it's CRI plugin to load correctly. Since we are
# defering containerd restart until after the network config is applied, do
# the same here to align config/restart times for both containerd and docker.
Anchor['platform::networking'] -> Class[$name]
if $http_proxy or $https_proxy {
file { '/etc/systemd/system/docker.service.d':
ensure => 'directory',