Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

kandra: Gracefully reload Teleport when its config changes.

Alex Vandiver32ea23e5615a
diff --git a/puppet/kandra/manifests/profile/teleport.pp b/puppet/kandra/manifests/profile/teleport.pp
index f4fb16bcac1..fe2b4a00c49 100644
--- a/puppet/kandra/manifests/profile/teleport.pp
+++ b/puppet/kandra/manifests/profile/teleport.pp
@@ -6,7 +6,8 @@ class kandra::profile::teleport inherits kandra::profile::base {
group => 'root',
mode => '0644',
source => 'puppet:///modules/kandra/teleport_server.yaml',
- notify => Service['teleport_server'],
+ before => Kandra::Teleport::Part['server'],
+ notify => Exec['reload teleport_server'],
}
file { '/var/lib/teleport-server':
ensure => directory,
diff --git a/puppet/kandra/manifests/teleport/db.pp b/puppet/kandra/manifests/teleport/db.pp
index 426483f60a1..c3934771d27 100644
--- a/puppet/kandra/manifests/teleport/db.pp
+++ b/puppet/kandra/manifests/teleport/db.pp
@@ -15,7 +15,8 @@ class kandra::teleport::db {
group => 'root',
mode => '0644',
content => template('kandra/teleport_db.yaml.template.erb'),
- notify => Service['teleport_db'],
+ before => Kandra::Teleport::Part['db'],
+ notify => Exec['reload teleport_db'],
}
kandra::teleport::part { 'db': }
diff --git a/puppet/kandra/manifests/teleport/node.pp b/puppet/kandra/manifests/teleport/node.pp
index 06721dbc81e..c9aa10e5082 100644
--- a/puppet/kandra/manifests/teleport/node.pp
+++ b/puppet/kandra/manifests/teleport/node.pp
@@ -13,7 +13,8 @@ class kandra::teleport::node {
owner => 'root',
group => 'root',
mode => '0644',
- notify => Service['teleport_node'],
+ before => Kandra::Teleport::Part['node'],
+ notify => Exec['reload teleport_node'],
}
concat::fragment { 'teleport_node_base':
target => '/etc/teleport_node.yaml',
diff --git a/puppet/kandra/manifests/teleport/part.pp b/puppet/kandra/manifests/teleport/part.pp
index 6806daba119..5629f150251 100644
--- a/puppet/kandra/manifests/teleport/part.pp
+++ b/puppet/kandra/manifests/teleport/part.pp
@@ -20,4 +20,13 @@ define kandra::teleport::part() {
enable => true,
require => [Service['supervisor'], Service['teleport'], Exec['reload systemd']],
}
+
+ # Notify this from YAML config changes (rather than the service)
+ # to get a SIGHUP-based graceful restart -- Teleport forks a new
+ # daemon and drains the old -- instead of a hard stop+start.
+ exec { "reload teleport_${part}":
+ command => "/bin/systemctl reload teleport_${part}",
+ refreshonly => true,
+ require => Service["teleport_${part}"],
+ }
}
diff --git a/puppet/kandra/manifests/teleport/tbot.pp b/puppet/kandra/manifests/teleport/tbot.pp
index 4c3f00ebebb..266a1522bb9 100644
--- a/puppet/kandra/manifests/teleport/tbot.pp
+++ b/puppet/kandra/manifests/teleport/tbot.pp
@@ -9,7 +9,8 @@ class kandra::teleport::tbot {
group => 'root',
mode => '0644',
source => 'puppet:///modules/kandra/tbot.yaml',
- notify => Service['tbot'],
+ before => Service['tbot'],
+ notify => Exec['reload tbot'],
}
file { '/etc/systemd/system/tbot.service':
@@ -37,4 +38,11 @@ class kandra::teleport::tbot {
enable => true,
require => [Service['teleport'], Exec['reload systemd']],
}
+
+ # See the equivalent in kandra::teleport::part.
+ exec { 'reload tbot':
+ command => '/bin/systemctl reload tbot',
+ refreshonly => true,
+ require => Service['tbot'],
+ }
}