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

Update to support Praefect #433

Merged
merged 1 commit into from
Apr 10, 2024
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
9 changes: 9 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ The following parameters are available in the `gitlab` class:
* [`pages_external_url`](#-gitlab--pages_external_url)
* [`pages_nginx`](#-gitlab--pages_nginx)
* [`pages_nginx_eq_nginx`](#-gitlab--pages_nginx_eq_nginx)
* [`praefect`](#-gitlab--praefect)
* [`postgresql`](#-gitlab--postgresql)
* [`prometheus`](#-gitlab--prometheus)
* [`prometheus_monitoring_enable`](#-gitlab--prometheus_monitoring_enable)
Expand Down Expand Up @@ -576,6 +577,14 @@ Replicate the Pages Nginx config from the Gitlab Nginx config.

Default value: `false`

##### <a name="-gitlab--praefect"></a>`praefect`

Data type: `Optional[Hash]`

Hash of 'praefect' config parameters.

Default value: `undef`

##### <a name="-gitlab--postgresql"></a>`postgresql`

Data type: `Optional[Hash]`
Expand Down
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
# @param pages_external_url External URL of Gitlab Pages.
# @param pages_nginx Hash of 'pages_nginx' config parameters.
# @param pages_nginx_eq_nginx Replicate the Pages Nginx config from the Gitlab Nginx config.
# @param praefect Hash of 'praefect' config parameters.
# @param postgresql Hash of 'postgresql' config parameters.
# @param prometheus Hash of 'prometheus' config parameters.
# @param prometheus_monitoring_enable Enable/disable prometheus support.
Expand Down Expand Up @@ -163,6 +164,7 @@
Boolean $pages_nginx_eq_nginx = false,
Optional[Hash] $pgbouncer = undef,
Optional[Hash] $postgresql = undef,
Optional[Hash] $praefect = undef,
Optional[Hash] $prometheus = undef,
Optional[Boolean] $prometheus_monitoring_enable = undef,
Optional[Hash] $redis = undef,
Expand Down
1 change: 1 addition & 0 deletions manifests/omnibus_config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
$pages_nginx = $gitlab::pages_nginx
$pages_nginx_eq_nginx = $gitlab::pages_nginx_eq_nginx
$pgbouncer = $gitlab::pgbouncer
$praefect = $gitlab::praefect
$postgresql = $gitlab::postgresql
$prometheus = $gitlab::prometheus
$prometheus_monitoring_enable = $gitlab::prometheus_monitoring_enable
Expand Down
29 changes: 29 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,35 @@
with_content(%r{^\s*pgbouncer\['enable'\] = true$})
}
end
describe 'praefect' do
let(:params) do
{
praefect: {
'enable' => true,
'listen_addr' => '0.0.0.0:2305',
'virtual_storage' => {
'default' => {
'host01' => { 'address' => 'tcp://host01:8075', 'token' => 'xxx-xxx-xxx' },
'host02' => { 'address' => 'tcp://host02:8075', 'token' => 'xxx-xxx-xxx' },
}
}
}
}
end

it {
is_expected.to contain_file('/etc/gitlab/gitlab.rb'). \
with_content(%r{^\s*praefect\['enable'\] = true$})
}
it {
is_expected.to contain_file('/etc/gitlab/gitlab.rb'). \
with_content(%r{^\s*praefect\['listen_addr'\] = "0\.0\.0\.0:2305"$})
}
it {
is_expected.to contain_file('/etc/gitlab/gitlab.rb'). \
with_content(%r{^\s*praefect\['virtual_storage'\] = \{"default"=>\{"host01"=>\{"address"=>"tcp://host01:8075", "token"=>"xxx-xxx-xxx"\}, "host02"=>\{"address"=>"tcp://host02:8075", "token"=>"xxx-xxx-xxx"\}\}\}$})
}
end
describe 'repmgr' do
let(:params) do
{ repmgr: {
Expand Down
10 changes: 10 additions & 0 deletions templates/gitlab.rb.erb
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,16 @@ gitlab_sshd['<%= k -%>'] = <%= decorate(@gitlab_sshd[k]) %>
<%- @postgresql.keys.sort.each do |k| -%>
postgresql['<%= k -%>'] = <%= decorate(@postgresql[k]) %>
<%- end end -%>
<%- if @praefect -%>

################################################################################
# Praefect
################################################################################
# See [Gitlab Praefect documentation](https://docs.gitlab.com/ee/administration/gitaly/praefect.html)

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

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