Skip to content

Commit 6f7faf6

Browse files
committed
Ensure that changes to etcd systemd reload and restart etcd
1 parent 70ce369 commit 6f7faf6

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

manifests/service.pp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Boolean $controller = $kubernetes::controller,
77
Boolean $manage_docker = $kubernetes::manage_docker,
88
Boolean $manage_etcd = $kubernetes::manage_etcd,
9+
String $etcd_install_method = $kubernetes::etcd_install_method,
910
String $kubernetes_version = $kubernetes::kubernetes_version,
1011
Optional[String] $cloud_provider = $kubernetes::cloud_provider,
1112
Optional[String] $cloud_config = $kubernetes::cloud_config,
@@ -72,7 +73,21 @@
7273
ensure => running,
7374
enable => true,
7475
}
75-
File <| path == '/etc/systemd/system/kubelet.service.d' or path == '/etc/default/etcd' |> ~> Service['etcd']
76+
File <|
77+
path == '/etc/systemd/system/kubelet.service.d' or
78+
path == '/etc/default/etcd' or
79+
path == '/etc/systemd/system/etcd.service'
80+
|> ~> Service['etcd']
81+
82+
if $etcd_install_method == 'wget' {
83+
exec { 'systemctl-daemon-reload-etcd':
84+
path => '/usr/bin:/bin:/usr/sbin:/sbin',
85+
command => 'systemctl daemon-reload',
86+
refreshonly => true,
87+
subscribe => File['/etc/systemd/system/etcd.service'],
88+
notify => Service['etcd'],
89+
}
90+
}
7691
}
7792

7893
# RedHat needs to have CPU and Memory accounting enabled to avoid systemd proc errors

spec/classes/service_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,13 @@
7171
'cloud_config' => '',
7272
'manage_docker' => false,
7373
'manage_etcd' => true,
74+
'etcd_install_method' => 'wget',
7475
}
7576
end
7677
it { should_not contain_service('docker')}
7778
it { should contain_service('etcd')}
7879
it { should contain_service('kubelet')}
80+
it { should contain_exec('systemctl-daemon-reload-etcd') }
7981
end
8082

8183
context 'with os.family => RedHat' do

0 commit comments

Comments
 (0)