Commit a12ef6d8 authored by DJ Mountney's avatar DJ Mountney
Browse files

Merge branch 'pokstad1-gitaly-maintenance_config' into 'master'

Gitaly daily maintenance config

See merge request gitlab-org/omnibus-gitlab!4572
parents d5b3a012 585e0b99
---
title: Gitaly daily maintenance config
merge_request: 4572
author:
type: added
......@@ -1936,6 +1936,11 @@ gitlab_rails['object_store']['objects']['terraform_state']['bucket'] = nil
# 'max_per_repo' => 5
# }
# ]
#
# gitaly['daily_maintenance_start_hour'] = 22
# gitaly['daily_maintenance_start_minute'] = 30
# gitaly['daily_maintenance_duration'] = '30m'
# gitaly['daily_maintenance_storages'] = ["default"]
 
################################################################################
## Praefect
......
......@@ -30,3 +30,7 @@ default['gitaly']['ruby_restart_delay'] = nil
default['gitaly']['ruby_num_workers'] = nil
default['gitaly']['ruby_rugged_git_config_search_path'] = "/opt/gitlab/embedded/etc"
default['gitaly']['concurrency'] = nil
default['gitaly']['daily_maintenance_start_hour'] = nil
default['gitaly']['daily_maintenance_start_minute'] = nil
default['gitaly']['daily_maintenance_duration'] = nil
default['gitaly']['daily_maintenance_storages'] = nil
......@@ -140,3 +140,11 @@ rpc = "<%= endpoint['rpc'] %>"
max_per_repo = <%= endpoint['max_per_repo'] %>
<% end %>
<% end %>
<% if @daily_maintenance_duration %>
[daily_maintenance]
<%= "start_hour = #{@daily_maintenance_start_hour}" if @daily_maintenance_start_hour %>
<%= "start_minute = #{@daily_maintenance_start_minute}" if @daily_maintenance_start_minute %>
<%= "duration = '#{@daily_maintenance_duration}'" if @daily_maintenance_duration %>
<%= "storages = #{@daily_maintenance_storages}" if @daily_maintenance_storages %>
<% end %>
......@@ -50,6 +50,10 @@ RSpec.describe 'gitaly' do
let(:ca_path) { '/path/to/ca_path' }
let(:self_signed_cert) { true }
let(:read_timeout) { 123 }
let(:daily_maintenance_start_hour) { 21 }
let(:daily_maintenance_start_minute) { 9 }
let(:daily_maintenance_duration) { '45m' }
let(:daily_maintenance_storages) { ["default"] }
before do
allow(Gitlab).to receive(:[]).and_call_original
end
......@@ -113,6 +117,8 @@ RSpec.describe 'gitaly' do
.with_content(%r{\[logging\]\s+level})
expect(chef_run).not_to render_file(config_path)
.with_content(%r{catfile_cache_size})
expect(chef_run).not_to render_file(config_path)
.with_content(%r{\[daily_maintenance\]})
end
 
it 'populates gitaly config.toml with default storages' do
......@@ -167,7 +173,11 @@ RSpec.describe 'gitaly' do
ruby_num_workers: ruby_num_workers,
git_catfile_cache_size: git_catfile_cache_size,
open_files_ulimit: open_files_ulimit,
ruby_rugged_git_config_search_path: ruby_rugged_git_config_search_path
ruby_rugged_git_config_search_path: ruby_rugged_git_config_search_path,
daily_maintenance_start_hour: daily_maintenance_start_hour,
daily_maintenance_start_minute: daily_maintenance_start_minute,
daily_maintenance_duration: daily_maintenance_duration,
daily_maintenance_storages: daily_maintenance_storages
},
gitlab_rails: {
internal_api_url: gitlab_url
......@@ -248,6 +258,14 @@ RSpec.describe 'gitaly' do
%r{custom_hooks_dir = '#{Regexp.escape(custom_hooks_dir)}'},
].map(&:to_s).join('\s+'))
 
maintenance_section = Regexp.new([
%r{\[daily_maintenance\]},
%r{start_hour = #{daily_maintenance_start_hour}},
%r{start_minute = #{daily_maintenance_start_minute}},
%r{duration = '#{daily_maintenance_duration}'},
%r{storages = #{Regexp.escape(daily_maintenance_storages.to_s)}},
].map(&:to_s).join('\s+'))
expect(chef_run).to render_file(config_path).with_content { |content|
expect(content).to include("tls_listen_addr = 'localhost:8888'")
expect(content).to include("certificate_path = '/path/to/cert.pem'")
......@@ -262,6 +280,7 @@ RSpec.describe 'gitaly' do
expect(content).to match(gitlab_shell_section)
expect(content).to match(gitlab_section)
expect(content).to match(hooks_section)
expect(content).to match(maintenance_section)
}
end
 
......@@ -275,6 +294,16 @@ RSpec.describe 'gitaly' do
.with_content(/exec svlogd -tt \/var\/log\/gitlab\/gitaly/)
end
 
context 'when using multiple maintenance storage entries' do
let(:daily_maintenance_storages) { %w(storage0 storage1 storage2) }
it 'renders daily_maintenance with multiple storage entries' do
expect(chef_run).to render_file(config_path).with_content { |content|
expect(content).to include("storages = #{daily_maintenance_storages}")
}
end
end
context 'when using gitaly storage configuration' do
before do
stub_gitlab_rb(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment