diff --git a/REFERENCE.md b/REFERENCE.md index 6b8d0a0..fb45bd5 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -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) @@ -584,6 +585,14 @@ Hash of 'postgresql' config parameters. Default value: `undef` +##### `praefect` + +Data type: `Optional[Hash]` + +Hash of 'praefect' config parameters. + +Default value: `undef` + ##### `prometheus` Data type: `Optional[Hash]` diff --git a/manifests/init.pp b/manifests/init.pp index 3e0b1d4..6cac04a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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. @@ -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, diff --git a/manifests/omnibus_config.pp b/manifests/omnibus_config.pp index 0b877cd..bcef084 100644 --- a/manifests/omnibus_config.pp +++ b/manifests/omnibus_config.pp @@ -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 diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 3033f22..511c643 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -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: { diff --git a/templates/gitlab.rb.erb b/templates/gitlab.rb.erb index 953148c..6b6bd31 100644 --- a/templates/gitlab.rb.erb +++ b/templates/gitlab.rb.erb @@ -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 -%> ################