Commit b6effa88 authored by Valery Sizov's avatar Valery Sizov Committed by Douglas Barbosa Alexandre

Geo - Configure capacity for Docker sync service

Control the maximum concurrency of container repository
sync for a Geo node.
parent 8d500cba
...@@ -27,6 +27,7 @@ Example response: ...@@ -27,6 +27,7 @@ Example response:
"current": true, "current": true,
"files_max_capacity": 10, "files_max_capacity": 10,
"repos_max_capacity": 25, "repos_max_capacity": 25,
"container_repositories_max_capacity": 10,
"verification_max_capacity": 100, "verification_max_capacity": 100,
"clone_protocol": "http" "clone_protocol": "http"
}, },
...@@ -40,6 +41,7 @@ Example response: ...@@ -40,6 +41,7 @@ Example response:
"current": false, "current": false,
"files_max_capacity": 10, "files_max_capacity": 10,
"repos_max_capacity": 25, "repos_max_capacity": 25,
"container_repositories_max_capacity": 10,
"verification_max_capacity": 100, "verification_max_capacity": 100,
"clone_protocol": "http" "clone_protocol": "http"
} }
...@@ -69,6 +71,7 @@ Example response: ...@@ -69,6 +71,7 @@ Example response:
"current": true, "current": true,
"files_max_capacity": 10, "files_max_capacity": 10,
"repos_max_capacity": 25, "repos_max_capacity": 25,
"container_repositories_max_capacity": 10,
"verification_max_capacity": 100, "verification_max_capacity": 100,
"clone_protocol": "http" "clone_protocol": "http"
} }
...@@ -94,6 +97,7 @@ PUT /geo_nodes/:id ...@@ -94,6 +97,7 @@ PUT /geo_nodes/:id
| `files_max_capacity` | integer | no | Control the maximum concurrency of LFS/attachment backfill for this secondary node. | | `files_max_capacity` | integer | no | Control the maximum concurrency of LFS/attachment backfill for this secondary node. |
| `repos_max_capacity` | integer | no | Control the maximum concurrency of repository backfill for this secondary node. | | `repos_max_capacity` | integer | no | Control the maximum concurrency of repository backfill for this secondary node. |
| `verification_max_capacity` | integer | no | Control the maximum concurrency of verification for this node. | | `verification_max_capacity` | integer | no | Control the maximum concurrency of verification for this node. |
| `container_repositories_max_capacity` | integer | no | Control the maximum concurrency of container repository sync for this node. |
Example response: Example response:
...@@ -108,6 +112,7 @@ Example response: ...@@ -108,6 +112,7 @@ Example response:
"current": true, "current": true,
"files_max_capacity": 10, "files_max_capacity": 10,
"repos_max_capacity": 25, "repos_max_capacity": 25,
"container_repositories_max_capacity": 10,
"verification_max_capacity": 100, "verification_max_capacity": 100,
"clone_protocol": "http" "clone_protocol": "http"
} }
...@@ -151,6 +156,7 @@ Example response: ...@@ -151,6 +156,7 @@ Example response:
"current": true, "current": true,
"files_max_capacity": 10, "files_max_capacity": 10,
"repos_max_capacity": 25, "repos_max_capacity": 25,
"container_repositories_max_capacity": 10,
"verification_max_capacity": 100, "verification_max_capacity": 100,
"clone_protocol": "http" "clone_protocol": "http"
} }
......
...@@ -57,6 +57,7 @@ class Admin::Geo::NodesController < Admin::Geo::ApplicationController ...@@ -57,6 +57,7 @@ class Admin::Geo::NodesController < Admin::Geo::ApplicationController
:files_max_capacity, :files_max_capacity,
:verification_max_capacity, :verification_max_capacity,
:minimum_reverification_interval, :minimum_reverification_interval,
:container_repositories_max_capacity,
selective_sync_shards: [] selective_sync_shards: []
) )
end end
......
...@@ -35,6 +35,7 @@ class GeoNode < ApplicationRecord ...@@ -35,6 +35,7 @@ class GeoNode < ApplicationRecord
validates :repos_max_capacity, numericality: { greater_than_or_equal_to: 0 } validates :repos_max_capacity, numericality: { greater_than_or_equal_to: 0 }
validates :files_max_capacity, numericality: { greater_than_or_equal_to: 0 } validates :files_max_capacity, numericality: { greater_than_or_equal_to: 0 }
validates :verification_max_capacity, numericality: { greater_than_or_equal_to: 0 } validates :verification_max_capacity, numericality: { greater_than_or_equal_to: 0 }
validates :container_repositories_max_capacity, numericality: { greater_than_or_equal_to: 0 }
validates :minimum_reverification_interval, numericality: { greater_than_or_equal_to: 1 } validates :minimum_reverification_interval, numericality: { greater_than_or_equal_to: 1 }
validate :require_current_node_to_be_primary, if: :secondary? validate :require_current_node_to_be_primary, if: :secondary?
......
...@@ -58,6 +58,13 @@ ...@@ -58,6 +58,13 @@
= form.number_field :verification_max_capacity, class: 'form-control col-sm-2', min: 0 = form.number_field :verification_max_capacity, class: 'form-control col-sm-2', min: 0
.form-text.text-muted= s_('Geo|Control the maximum concurrency of verification operations for this Geo node') .form-text.text-muted= s_('Geo|Control the maximum concurrency of verification operations for this Geo node')
- if Feature.enabled?(:geo_registry_replication)
.form-row.form-group
.col-sm-8
= form.label :container_repositories_max_capacity, s_('Geo|Container repositories sync capacity'), class: 'font-weight-bold'
= form.number_field :container_repositories_max_capacity, class: 'form-control col-sm-2', min: 0
.form-text.text-muted= s_('Geo|Control the maximum concurrency of container repository operations for this Geo node')
.form-row.form-group.js-hide-if-geo-secondary{ class: ('hidden' unless geo_node.primary?) } .form-row.form-group.js-hide-if-geo-secondary{ class: ('hidden' unless geo_node.primary?) }
.col-sm-8 .col-sm-8
= form.label :minimum_reverification_interval, s_('Geo|Re-verification interval'), class: 'font-weight-bold' = form.label :minimum_reverification_interval, s_('Geo|Re-verification interval'), class: 'font-weight-bold'
......
...@@ -146,6 +146,7 @@ module API ...@@ -146,6 +146,7 @@ module API
optional :files_max_capacity, type: Integer, desc: 'Control the maximum concurrency of LFS/attachment backfill for this secondary node' optional :files_max_capacity, type: Integer, desc: 'Control the maximum concurrency of LFS/attachment backfill for this secondary node'
optional :repos_max_capacity, type: Integer, desc: 'Control the maximum concurrency of repository backfill for this secondary node' optional :repos_max_capacity, type: Integer, desc: 'Control the maximum concurrency of repository backfill for this secondary node'
optional :verification_max_capacity, type: Integer, desc: 'Control the maximum concurrency of repository verification for this node' optional :verification_max_capacity, type: Integer, desc: 'Control the maximum concurrency of repository verification for this node'
optional :container_repositories_max_capacity, type: Integer, desc: 'Control the maximum concurrency of container repository sync for this node'
end end
put do put do
not_found!('GeoNode') unless geo_node not_found!('GeoNode') unless geo_node
......
...@@ -484,6 +484,7 @@ module EE ...@@ -484,6 +484,7 @@ module EE
expose :files_max_capacity expose :files_max_capacity
expose :repos_max_capacity expose :repos_max_capacity
expose :verification_max_capacity expose :verification_max_capacity
expose :container_repositories_max_capacity, if: ->(_, _) { ::Feature.enabled?(:geo_registry_replication) }
# Retained for backwards compatibility. Remove in API v5 # Retained for backwards compatibility. Remove in API v5
expose :clone_protocol do |_record, _options| expose :clone_protocol do |_record, _options|
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
"files_max_capacity", "files_max_capacity",
"repos_max_capacity", "repos_max_capacity",
"verification_max_capacity", "verification_max_capacity",
"container_repositories_max_capacity",
"clone_protocol", "clone_protocol",
"_links" "_links"
], ],
...@@ -24,6 +25,7 @@ ...@@ -24,6 +25,7 @@
"files_max_capacity": { "type": "integer" }, "files_max_capacity": { "type": "integer" },
"repos_max_capacity": { "type": "integer" }, "repos_max_capacity": { "type": "integer" },
"verification_max_capacity": { "type": "integer" }, "verification_max_capacity": { "type": "integer" },
"container_repositories_max_capacity": { "type": "integer" },
"clone_protocol": { "type": "string" }, "clone_protocol": { "type": "string" },
"web_edit_url": { "type": "string" }, "web_edit_url": { "type": "string" },
"web_geo_projects_url" : { "type": ["string", "null"] }, "web_geo_projects_url" : { "type": ["string", "null"] },
......
...@@ -14,6 +14,7 @@ export const mockNodes = [ ...@@ -14,6 +14,7 @@ export const mockNodes = [
current: true, current: true,
files_max_capacity: 10, files_max_capacity: 10,
repos_max_capacity: 25, repos_max_capacity: 25,
container_repositories_max_capacity: 10,
clone_protocol: 'http', clone_protocol: 'http',
_links: { _links: {
self: 'http://127.0.0.1:3001/api/v4/geo_nodes/1', self: 'http://127.0.0.1:3001/api/v4/geo_nodes/1',
...@@ -30,6 +31,7 @@ export const mockNodes = [ ...@@ -30,6 +31,7 @@ export const mockNodes = [
current: false, current: false,
files_max_capacity: 10, files_max_capacity: 10,
repos_max_capacity: 25, repos_max_capacity: 25,
container_repositories_max_capacity: 10,
clone_protocol: 'http', clone_protocol: 'http',
_links: { _links: {
self: 'http://127.0.0.1:3001/api/v4/geo_nodes/2', self: 'http://127.0.0.1:3001/api/v4/geo_nodes/2',
......
...@@ -29,6 +29,7 @@ describe GeoNode, :geo, type: :model do ...@@ -29,6 +29,7 @@ describe GeoNode, :geo, type: :model do
it { is_expected.to validate_numericality_of(:repos_max_capacity).is_greater_than_or_equal_to(0) } it { is_expected.to validate_numericality_of(:repos_max_capacity).is_greater_than_or_equal_to(0) }
it { is_expected.to validate_numericality_of(:files_max_capacity).is_greater_than_or_equal_to(0) } it { is_expected.to validate_numericality_of(:files_max_capacity).is_greater_than_or_equal_to(0) }
it { is_expected.to validate_numericality_of(:verification_max_capacity).is_greater_than_or_equal_to(0) } it { is_expected.to validate_numericality_of(:verification_max_capacity).is_greater_than_or_equal_to(0) }
it { is_expected.to validate_numericality_of(:container_repositories_max_capacity).is_greater_than_or_equal_to(0) }
it { is_expected.to validate_numericality_of(:minimum_reverification_interval).is_greater_than_or_equal_to(1) } it { is_expected.to validate_numericality_of(:minimum_reverification_interval).is_greater_than_or_equal_to(1) }
it { is_expected.to validate_presence_of(:name) } it { is_expected.to validate_presence_of(:name) }
it { is_expected.to validate_presence_of(:url) } it { is_expected.to validate_presence_of(:url) }
...@@ -116,6 +117,7 @@ describe GeoNode, :geo, type: :model do ...@@ -116,6 +117,7 @@ describe GeoNode, :geo, type: :model do
where(:attribute, :value) do where(:attribute, :value) do
:repos_max_capacity | 25 :repos_max_capacity | 25
:files_max_capacity | 10 :files_max_capacity | 10
:container_repositories_max_capacity | 10
end end
with_them do with_them do
......
...@@ -6820,9 +6820,15 @@ msgstr "" ...@@ -6820,9 +6820,15 @@ msgstr ""
msgid "Geo|Choose which groups you wish to synchronize to this secondary node." msgid "Geo|Choose which groups you wish to synchronize to this secondary node."
msgstr "" msgstr ""
msgid "Geo|Container repositories sync capacity"
msgstr ""
msgid "Geo|Control the maximum concurrency of LFS/attachment backfill for this secondary node" msgid "Geo|Control the maximum concurrency of LFS/attachment backfill for this secondary node"
msgstr "" msgstr ""
msgid "Geo|Control the maximum concurrency of container repository operations for this Geo node"
msgstr ""
msgid "Geo|Control the maximum concurrency of verification operations for this Geo node" msgid "Geo|Control the maximum concurrency of verification operations for this Geo node"
msgstr "" msgstr ""
......
Markdown is supported
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