Skip to content
This repository has been archived by the owner on Oct 1, 2019. It is now read-only.

Commit

Permalink
Merge pull request #9 from cristifalcas/test
Browse files Browse the repository at this point in the history
add support to use forward-journald. This should fix SIGPIPE's sent to the daemon
  • Loading branch information
cristifalcas authored Jun 13, 2016
2 parents 4f8f589 + c54cb41 commit 85a2a0e
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 3 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Because of the way etcd is working, you can't change any of the initial cluster
initial_cluster_state
initial_cluster_token

This is annoyng if you first bootstraped the cluster in http mode and you want to add ssl after that to initial_cluster parameter.
This is annoying if you first bootstraped the cluster in http mode and you want to add ssl after that to initial_cluster parameter.

Solution:
* Don't care. Even if the protocol is http, the communication will be over ssl
Expand Down Expand Up @@ -149,3 +149,11 @@ checking if $::fqdn or $::ipaddress appears in initial_cluster parameter.
peer_trusted_ca_file => '/etc/pki/puppet_certs/etcd/ca_cert.pem',
debug => true,
}

## Journald forward:

The class support a parameter called journald_forward_enable.

This was added because of the PIPE signal that is sent to go programs when systemd-journald dies.

For more information read here: https://github.com/projectatomic/forward-journald
20 changes: 20 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,24 @@
ensure => 'file',
content => template("${module_name}/etc/etcd/etcd.conf.erb"),
}

if $::etcd::manage_package and $::etcd::journald_forward_enable and $::operatingsystemmajrelease == 7 {
file { '/etc/systemd/system/etcd.service.d':
ensure => 'directory',
owner => 'root',
group => 'root',
mode => '0755',
}
file { '/etc/systemd/system/etcd.service.d/journald.conf':
ensure => file,
owner => 'root',
group => 'root',
mode => '0644',
content => template("${module_name}/journald.conf.erb"),
} ~>
exec { 'systemctl-daemon-reload etcd_service':
refreshonly => true,
command => '/usr/bin/systemctl/systemctl daemon-reload',
}
}
}
6 changes: 5 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@
# Set individual etcd subpackages to specific log levels. An example being etcdserver=WARNING,security=DEBUG
# default: none (INFO for all packages)
#
# [*journald_forward_enable*]
# Enable log forwarding via journald_forward_enable
#
class etcd (
$ensure = $etcd::params::ensure,
$manage_package = $etcd::params::manage_package,
Expand Down Expand Up @@ -247,6 +250,7 @@
# logging
$debug = $etcd::params::debug,
$log_package_levels = $etcd::params::log_package_levels,
$journald_forward_enable = $etcd::params::journald_forward_enable
) inherits etcd::params {
validate_integer([
$snapshot_counter,
Expand All @@ -260,7 +264,7 @@
$proxy_write_timeout,
$proxy_read_timeout,
])
validate_bool($strict_reconfig_check, $client_cert_auth, $peer_client_cert_auth, $debug)
validate_bool($strict_reconfig_check, $client_cert_auth, $peer_client_cert_auth, $debug, $journald_forward_enable)
validate_re($initial_cluster_state, '^(new|existing)$')
validate_re($discovery_fallback, '^(proxy|exit)$')
validate_absolute_path($data_dir)
Expand Down
2 changes: 2 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,6 @@
# logging
$debug = false
$log_package_levels = undef

$journald_forward_enable = false
}
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cristifalcas-etcd",
"version": "1.3.0",
"version": "1.5.0",
"author": "Cristian Falcas",
"summary": "Installs and configures etcd",
"license": "Apache-2.0",
Expand Down
7 changes: 7 additions & 0 deletions templates/journald.conf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Service]
NotifyAccess=all
Type=notify
ExecStart=
ExecStart=-/bin/bash -c "GOMAXPROCS=$(nproc) /usr/bin/etcd --name=\"${ETCD_NAME}\" --data-dir=\"${ETCD_DATA_DIR}\" --listen-client-urls=\"${ETCD_LISTEN_CLIENT_URLS}\" 2>&1 | /usr/bin/forward-journald -tag etcd"
StandardOutput=null
StandardError=null

0 comments on commit 85a2a0e

Please sign in to comment.