Skip to content

Commit

Permalink
Update to support Praefect
Browse files Browse the repository at this point in the history
Stolen from #372
  • Loading branch information
danielg committed Nov 10, 2023
1 parent eb48749 commit 76a2a2f
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 0 deletions.
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 @@ -584,6 +585,14 @@ Hash of 'postgresql' config parameters.

Default value: `undef`

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

Data type: `Optional[Hash]`

Hash of 'praefect' config parameters.

Default value: `undef`

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

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
28 changes: 28 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,34 @@
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

0 comments on commit 76a2a2f

Please sign in to comment.