Skip to content

Commit f8b5137

Browse files
balasankarcSylvester Chin
andcommitted
Merge branch 'sc1-add-shard-to-routing-rule' into 'master'
Allow routing rules to contain shard information See merge request https://gitlab.com/gitlab-org/omnibus-gitlab/-/merge_requests/7512 Merged-by: Balasankar 'Balu' C <[email protected]> Approved-by: Mitchell Nielsen <[email protected]> Approved-by: Balasankar 'Balu' C <[email protected]> Co-authored-by: Sylvester Chin <[email protected]>
2 parents 07d2303 + f185f83 commit f8b5137

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

files/gitlab-cookbooks/gitlab/templates/default/gitlab.yml.erb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,12 @@ production: &base
453453
log_format: <%= @sidekiq['log_format'] %>
454454
<% unless @sidekiq['routing_rules'].empty? %>
455455
routing_rules:
456-
<% @sidekiq['routing_rules'].each do |query, queue| %>
456+
<% @sidekiq['routing_rules'].each do |query, queue, shard_instance| %>
457+
<% if shard_instance.nil? %>
457458
- [<%= quote(query) %>, <%= queue.nil? ? 'null' : quote(queue) %>]
459+
<% else %>
460+
- [<%= quote(query) %>, <%= queue.nil? ? 'null' : quote(queue) %>, <%= quote(shard_instance) %>]
461+
<% end %>
458462
<% end %>
459463
<% end %>
460464

spec/chef/cookbooks/gitlab/recipes/gitlab-rails/gitlab_yml/sidekiq_spec.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,28 @@
7474
)
7575
end
7676
end
77+
78+
context 'with a valid routing rules list containing shard details' do
79+
before do
80+
stub_gitlab_rb(
81+
sidekiq: {
82+
routing_rules: [
83+
["resource_boundary=cpu", "cpu_boundary"],
84+
["*", "default", "default"]
85+
]
86+
}
87+
)
88+
end
89+
90+
it 'renders gitlab.yml with user specified value for sidekiq routing rules' do
91+
expect(gitlab_yml[:production][:sidekiq][:routing_rules]).to eq(
92+
[
93+
["resource_boundary=cpu", "cpu_boundary"],
94+
["*", "default", "default"]
95+
]
96+
)
97+
end
98+
end
7799
end
78100
end
79101
end

0 commit comments

Comments
 (0)