Skip to content
Snippets Groups Projects
Commit 19a08f60 authored by DJ Mountney's avatar DJ Mountney
Browse files

Merge branch 'brodock/remove-consul-from-postgres-role' into 'master'

Don't enable consul with `postgres_role` and add a warning when Patroni is enabled but consul is not

See merge request gitlab-org/omnibus-gitlab!5370
parents 5a6f24f9 d0c2a6fd
No related branches found
No related tags found
2 merge requests!51Validate shift of Heptapod 0.25 to oldstable series,!44GitLab 14.0
......@@ -8,6 +8,7 @@
Gitlab['patroni']['connect_address'] ||= private_ipv4 || Gitlab['node']['ipaddress']
Gitlab['patroni']['connect_port'] ||= Gitlab['patroni']['port'] || Gitlab['node']['patroni']['port']
check_consul_is_enabled
parse_postgresql_overrides
auto_detect_wal_log_hint
end
......@@ -31,6 +32,12 @@
checkpoint_timeout
).freeze
def check_consul_is_enabled
return if Services.enabled?('consul')
LoggingHelper.warning('Patroni is enabled but Consul seems to be disabled. Patroni requires Consul to be enabled.')
end
def postgresql_setting(key)
Gitlab['postgresql'][key] || Gitlab['node']['patroni']['postgresql']&.[](key) || Gitlab['node']['postgresql'][key]
end
......
......@@ -54,6 +54,6 @@
service 'pgbouncer_exporter', groups: %w(pgbouncer_role monitoring)
service 'repmgrd', groups: %w(postgres)
service 'patroni', groups: %w(postgres patroni_role)
service 'consul', groups: %w(consul_role ha pgbouncer_role postgres_role patroni_role)
service 'consul', groups: %w(consul_role ha pgbouncer_role patroni_role)
end
end
......@@ -570,4 +570,24 @@
end
end
end
context 'when patroni is enabled but consul is not' do
let(:chef_run) do
converge_config('gitlab-ee::default', is_ee: true)
end
before do
stub_gitlab_rb(
patroni: {
enable: true
}
)
end
it 'expects a warning to be printed' do
chef_run
expect_logged_warning(/Patroni is enabled but Consul seems to be disabled/)
end
end
end
......@@ -20,6 +20,7 @@
config.run_all_when_everything_filtered = true
config.include(GitlabSpec::Macros)
config.include(GitlabSpec::Expectations)
config.disable_monkey_patching!
end
# frozen_string_literal: true
module GitlabSpec
module Expectations
# Expect a note to be logged with the specified message
#
# @param [String] message
# @see LoggingHelper.warning
def expect_logged_note(message)
expect(LoggingHelper.messages).to include(kind: :note, message: message)
end
# Expect a deprecation to be logged with the specified message
#
# @param [String] message
# @see LoggingHelper.warning
def expect_logged_deprecation(message)
expect(LoggingHelper.messages).to include(kind: :deprecation, message: message)
end
# Expect a removal to be logged with the specified message
#
# @param [String] message
# @see LoggingHelper.warning
def expect_logged_removal(message)
expect(LoggingHelper.messages).to include(kind: :removal, message: message)
end
# Expect a warning to be logged with the specified message
#
# @param [String] message
# @see LoggingHelper.warning
def expect_logged_warning(message)
expect(LoggingHelper.messages).to include(kind: :warning, message: message)
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment