Puppet Class: k8s::install::container_runtime
- Defined in:
- manifests/install/container_runtime.pp
Summary
manages the installation of criOverview
Class: k8s::install::container_runtime
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'manifests/install/container_runtime.pp', line 12
class k8s::install::container_runtime (
Boolean $manage_repo = $k8s::manage_repo,
K8s::Container_runtimes $container_manager = $k8s::container_manager,
Optional[String[1]] $crio_package = $k8s::crio_package,
Optional[String[1]] $containerd_package = $k8s::containerd_package,
String[1] $k8s_version = $k8s::version,
String[1] $runc_version = $k8s::runc_version,
) {
case $container_manager {
'crio': {
if fact('os.family') == 'Debian' {
$_crio_version = $k8s_version.split('\.')[0, 2].join('.')
if versioncmp($_crio_version, '1.17') < 0 {
$pkg = pick($crio_package, "cri-o-${_crio_version}")
} else {
$pkg = pick($crio_package, 'cri-o')
}
# This is needed by cri-o, but it is not a dependency of the package
package { 'runc':
ensure => $runc_version,
}
# Avoid a potential issue with some CRI-o versions
file { ['/usr/lib/cri-o-runc/sbin', '/usr/lib/cri-o-runc']:
ensure => directory,
}
file { '/usr/lib/cri-o-runc/sbin/runc':
ensure => link,
target => '/usr/sbin/runc',
replace => false,
}
} else {
$pkg = pick($crio_package, 'cri-o')
}
file { '/usr/libexec/crio/conmon':
ensure => link,
target => '/usr/bin/conmon',
replace => false,
require => Package['k8s container manager'],
}
file { '/etc/cni/net.d/100-crio-bridge.conf':
ensure => absent,
require => Package['k8s container manager'],
}
file_line { 'K8s crio cgroup manager':
path => '/etc/crio/crio.conf',
line => 'cgroup_manager = "systemd"',
match => '^cgroup_manager',
require => Package['k8s container manager'],
}
}
'containerd': {
file { '/etc/containerd':
ensure => directory,
}
-> file { '/etc/containerd/config.toml':
ensure => file,
source => 'puppet:///modules/k8s/containerd/config.toml',
notify => Service['containerd'],
}
-> service { 'containerd':
ensure => running,
require => Package['k8s container manager'],
}
$pkg = pick($containerd_package, 'containerd')
}
default: {}
}
package { 'k8s container manager':
name => $pkg,
}
if $manage_repo {
Class['k8s::repo'] -> Package['k8s container manager']
}
}
|