Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow configuration of the alertmanager via puppet. #267

Merged
merged 2 commits into from
Aug 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
# Default: /etc/gitlab/gitlab.rb
# Path of the Gitlab Omnibus config file.
#
# [*alertmanager*]
# Default: undef
# Hash of 'alertmanager' config parameters.
#
# [*ci_redis*]
# Default: undef
# Hash of 'ci_redis' config parameters.
Expand Down Expand Up @@ -364,6 +368,7 @@
String $service_group = 'root',
# gitlab specific
String $rake_exec = '/usr/bin/gitlab-rake',
Optional[Hash] $alertmanager = undef,
LongLiveCHIEF marked this conversation as resolved.
Show resolved Hide resolved
Optional[Hash] $ci_redis = undef,
Optional[Hash] $ci_unicorn = undef,
Boolean $config_manage = true,
Expand Down
1 change: 1 addition & 0 deletions manifests/omnibus_config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
){

# get variables from the toplevel manifest for usage in the template
$alertmanager = $gitlab::alertmanager
$ci_redis = $gitlab::ci_redis
$ci_unicorn = $gitlab::ci_unicorn
$external_url = $gitlab::external_url
Expand Down
14 changes: 14 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,20 @@
with_content(%r{^\s*nginx\['listen_port'\] = ('|)80('|)$})
}
end
describe 'alertmanager' do
let(:params) do
{ alertmanager: {
'enable' => true,
'flags' => { 'cluster.advertise-address' => '127.0.0.1:9093' }
} }
end

it {
is_expected.to contain_file('/etc/gitlab/gitlab.rb'). \
with_content(%r{^\s*alertmanager\['enable'\] = true$}).
with_content(%r{^\s*alertmanager\['flags'\] = {\"cluster.advertise-address\"=>\"127.0.0.1:9093\"}$})
}
end
describe 'letsencrypt' do
let(:params) do
{ letsencrypt: {
Expand Down
9 changes: 9 additions & 0 deletions templates/gitlab.rb.erb
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,15 @@ redis_exporter['<%= k -%>'] = <%= decorate(@redis_exporter[k]) %>
<%- @postgres_exporter.keys.sort.each do |k| -%>
postgres_exporter['<%= k -%>'] = <%= decorate(@postgres_exporter[k]) %>
<%- end end -%>
<%- if @alertmanager -%>

################################################################################
## Alertmanager
##! Docs: https://prometheus.io/docs/alerting/alertmanager/

<%- @alertmanager.keys.sort.each do |k| -%>
alertmanager['<%= k -%>'] = <%= decorate(@alertmanager[k]) %>
<%- end end -%>
<%- if @gitlab_monitor -%>

################################################################################
Expand Down