Commit 0fd34d82 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'docker_image_replication-ui-3-3' into 'master'

[Geo] Configure capacity for Docker sync service(3/4)

See merge request gitlab-org/gitlab-ee!14599
parents a2d4a6af b6effa88
......@@ -27,6 +27,7 @@ Example response:
"current": true,
"files_max_capacity": 10,
"repos_max_capacity": 25,
"container_repositories_max_capacity": 10,
"verification_max_capacity": 100,
"clone_protocol": "http"
},
......@@ -40,6 +41,7 @@ Example response:
"current": false,
"files_max_capacity": 10,
"repos_max_capacity": 25,
"container_repositories_max_capacity": 10,
"verification_max_capacity": 100,
"clone_protocol": "http"
}
......@@ -69,6 +71,7 @@ Example response:
"current": true,
"files_max_capacity": 10,
"repos_max_capacity": 25,
"container_repositories_max_capacity": 10,
"verification_max_capacity": 100,
"clone_protocol": "http"
}
......@@ -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. |
| `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. |
| `container_repositories_max_capacity` | integer | no | Control the maximum concurrency of container repository sync for this node. |
Example response:
......@@ -108,6 +112,7 @@ Example response:
"current": true,
"files_max_capacity": 10,
"repos_max_capacity": 25,
"container_repositories_max_capacity": 10,
"verification_max_capacity": 100,
"clone_protocol": "http"
}
......@@ -151,6 +156,7 @@ Example response:
"current": true,
"files_max_capacity": 10,
"repos_max_capacity": 25,
"container_repositories_max_capacity": 10,
"verification_max_capacity": 100,
"clone_protocol": "http"
}
......
......@@ -57,6 +57,7 @@ class Admin::Geo::NodesController < Admin::Geo::ApplicationController
:files_max_capacity,
:verification_max_capacity,
:minimum_reverification_interval,
:container_repositories_max_capacity,
selective_sync_shards: []
)
end
......
......@@ -35,6 +35,7 @@ class GeoNode < ApplicationRecord
validates :repos_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 :container_repositories_max_capacity, numericality: { greater_than_or_equal_to: 0 }
validates :minimum_reverification_interval, numericality: { greater_than_or_equal_to: 1 }
validate :require_current_node_to_be_primary, if: :secondary?
......
......@@ -58,6 +58,13 @@
= 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')
- 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?) }
.col-sm-8
= form.label :minimum_reverification_interval, s_('Geo|Re-verification interval'), class: 'font-weight-bold'
......
......@@ -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 :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 :container_repositories_max_capacity, type: Integer, desc: 'Control the maximum concurrency of container repository sync for this node'
end
put do
not_found!('GeoNode') unless geo_node
......
......@@ -484,6 +484,7 @@ module EE
expose :files_max_capacity
expose :repos_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
expose :clone_protocol do |_record, _options|
......
......@@ -10,6 +10,7 @@
"files_max_capacity",
"repos_max_capacity",
"verification_max_capacity",
"container_repositories_max_capacity",
"clone_protocol",
"_links"
],
......@@ -24,6 +25,7 @@
"files_max_capacity": { "type": "integer" },
"repos_max_capacity": { "type": "integer" },
"verification_max_capacity": { "type": "integer" },
"container_repositories_max_capacity": { "type": "integer" },
"clone_protocol": { "type": "string" },
"web_edit_url": { "type": "string" },
"web_geo_projects_url" : { "type": ["string", "null"] },
......
......@@ -14,6 +14,7 @@ export const mockNodes = [
current: true,
files_max_capacity: 10,
repos_max_capacity: 25,
container_repositories_max_capacity: 10,
clone_protocol: 'http',
_links: {
self: 'http://127.0.0.1:3001/api/v4/geo_nodes/1',
......@@ -30,6 +31,7 @@ export const mockNodes = [
current: false,
files_max_capacity: 10,
repos_max_capacity: 25,
container_repositories_max_capacity: 10,
clone_protocol: 'http',
_links: {
self: 'http://127.0.0.1:3001/api/v4/geo_nodes/2',
......
......@@ -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(: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(: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_presence_of(:name) }
it { is_expected.to validate_presence_of(:url) }
......@@ -114,8 +115,9 @@ describe GeoNode, :geo, type: :model do
context 'default values' do
where(:attribute, :value) do
:repos_max_capacity | 25
:files_max_capacity | 10
:repos_max_capacity | 25
:files_max_capacity | 10
:container_repositories_max_capacity | 10
end
with_them do
......
......@@ -6820,9 +6820,15 @@ msgstr ""
msgid "Geo|Choose which groups you wish to synchronize to this secondary node."
msgstr ""
msgid "Geo|Container repositories sync capacity"
msgstr ""
msgid "Geo|Control the maximum concurrency of LFS/attachment backfill for this secondary node"
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"
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