Showing with 47 additions and 16 deletions.
  1. +6 −0 CHANGELOG.md
  2. +23 −11 manifests/cluster_roles.pp
  3. +12 −2 manifests/packages.pp
  4. +1 −1 metadata.json
  5. +5 −2 spec/classes/cluster_roles_spec.rb
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Version 2.0.2

Fixes issue with cgroup mismatch on docker PR #109

ignores docker warning ine prelifght checks when using containerd PR #109

# Version 2.0.1

Changes default runtime to docker
Expand Down
34 changes: 23 additions & 11 deletions manifests/cluster_roles.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,41 @@
String $cni_pod_cidr = $kubernetes::cni_pod_cidr,
String $token = $kubernetes::token,
String $discovery_token_hash = $kubernetes::discovery_token_hash,
String $container_runtime = $kubernetes::container_runtime,

){
$path = ['/usr/bin','/bin','/sbin','/usr/local/bin']
$env = ['HOME=/root', 'KUBECONFIG=/etc/kubernetes/admin.conf']

if $container_runtime == 'cri_containerd' {
$preflight_errors = ['Service-Docker']
$cri_socket = '/run/containerd/containerd.sock'
} else {
$preflight_errors = undef
$cri_socket = undef
}


if $controller {
kubernetes::kubeadm_init { $node_label:
config => '/etc/kubernetes/config.yaml',
path => $path,
env => $env,
node_label => $node_label,
config => '/etc/kubernetes/config.yaml',
path => $path,
env => $env,
node_label => $node_label,
ignore_preflight_errors => $preflight_errors,
}
}

if $worker {
kubernetes::kubeadm_join { $node_label:
path => $path,
env => $env,
controller_address => $controller_address,
token => $token,
ca_cert_hash => $discovery_token_hash,
cri_socket => '/run/containerd/containerd.sock',
node_label => $node_label,
path => $path,
env => $env,
controller_address => $controller_address,
token => $token,
ca_cert_hash => $discovery_token_hash,
cri_socket => $cri_socket,
node_label => $node_label,
ignore_preflight_errors => $preflight_errors,
}
}
}
14 changes: 12 additions & 2 deletions manifests/packages.pp
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,22 @@

if $container_runtime == 'docker' {
case $::osfamily {
'Debian','RedHat' : {
'Debian': {
package { 'docker-engine':
ensure => $docker_version,
}
}

'RedHat': {
package { 'docker-engine':
ensure => $docker_version,
}
file_line { 'set systemd cgroup docker':
path => '/usr/lib/systemd/system/docker.service',
line => 'ExecStart=/usr/bin/dockerd --exec-opt native.cgroupdriver=systemd',
match => 'ExecStart',
require => Package['docker-engine'],
}
}
default: { notify {"The OS family ${::osfamily} is not supported by this module":} }
}
}
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppetlabs-kubernetes",
"version": "2.0.1",
"version": "2.0.2",
"author": "Puppet",
"summary": "The module installs and configures a Kubernetes cluster",
"license": "Apache-2.0",
Expand Down
7 changes: 5 additions & 2 deletions spec/classes/cluster_roles_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
'token' => 'foo',
'etcd_initial_cluster' => 'foo',
'controller_address' => '172.17.10.101',
'node_label' => 'foo',
'node_label' => 'foo',
'container_runtime' => 'docker',
}
end

Expand All @@ -58,7 +59,9 @@
'token' => 'foo',
'etcd_initial_cluster' => 'foo',
'controller_address' => '172.17.10.101',
'node_label' => 'foo',
'node_label' => 'foo',
'container_runtime' => 'docker',

}
end

Expand Down