Commit 91f7b726 authored by Gabriel Mazetto's avatar Gabriel Mazetto Committed by Michael Kozono

Add flag for object storage synchronization to Geo Nodes

This is a configuration flag that controls when a Geo node will
synchronize Object Storage. Default is false.
parent c56b054b
...@@ -22,7 +22,7 @@ export default function geoNodeForm() { ...@@ -22,7 +22,7 @@ export default function geoNodeForm() {
const $container = $('.js-geo-node-form'); const $container = $('.js-geo-node-form');
const $namespaces = $('.js-hide-if-geo-primary', $container); const $namespaces = $('.js-hide-if-geo-primary', $container);
const $reverification = $('.js-hide-if-geo-secondary', $container); const $reverification = $('.js-hide-if-geo-secondary', $container);
const $primaryCheckbox = $('input[type="checkbox"]', $container); const $primaryCheckbox = $('input#geo_node_primary', $container);
const $selectiveSyncTypeSelect = $('.js-geo-node-selective-sync-type', $container); const $selectiveSyncTypeSelect = $('.js-geo-node-selective-sync-type', $container);
const $select2Dropdown = $('.js-geo-node-namespaces', $container); const $select2Dropdown = $('.js-geo-node-namespaces', $container);
const $syncByNamespaces = $('.js-sync-by-namespace', $container); const $syncByNamespaces = $('.js-sync-by-namespace', $container);
......
...@@ -58,6 +58,7 @@ class Admin::Geo::NodesController < Admin::Geo::ApplicationController ...@@ -58,6 +58,7 @@ class Admin::Geo::NodesController < Admin::Geo::ApplicationController
:verification_max_capacity, :verification_max_capacity,
:minimum_reverification_interval, :minimum_reverification_interval,
:container_repositories_max_capacity, :container_repositories_max_capacity,
:sync_object_storage,
selective_sync_shards: [] selective_sync_shards: []
) )
end end
......
...@@ -10,12 +10,6 @@ ...@@ -10,12 +10,6 @@
= form.text_field :url, class: 'form-control qa-node-url-field' = form.text_field :url, class: 'form-control qa-node-url-field'
.form-text.text-muted= _('The user-facing URL of the Geo node') .form-text.text-muted= _('The user-facing URL of the Geo node')
.form-group.col-sm-6.js-internal-url{ class: ('hidden' unless geo_node.primary?) }
= form.label :internal_url, s_('Geo|Internal URL (optional)'), class: 'font-weight-bold'
= form.text_field :internal_url, class: 'form-control'
.form-text.text-muted= s_('Geo|The URL defined on the primary node that secondary nodes should use to contact it. Defaults to URL')
.form-group.row .form-group.row
.col-sm-10 .col-sm-10
.form-check .form-check
...@@ -23,6 +17,12 @@ ...@@ -23,6 +17,12 @@
= form.label :primary, class: 'form-check-label' do = form.label :primary, class: 'form-check-label' do
%span= s_('Geo|This is a primary node') %span= s_('Geo|This is a primary node')
.form-row.form-group.js-internal-url{ class: ('hidden' unless geo_node.primary?) }
.col-sm-6
= form.label :internal_url, s_('Geo|Internal URL (optional)'), class: 'font-weight-bold'
= form.text_field :internal_url, class: 'form-control'
.form-text.text-muted= s_('Geo|The URL defined on the primary node that secondary nodes should use to contact it. Defaults to URL')
.form-row.form-group.js-hide-if-geo-primary{ class: ('hidden' unless geo_node.secondary?) } .form-row.form-group.js-hide-if-geo-primary{ class: ('hidden' unless geo_node.secondary?) }
.col-sm-4 .col-sm-4
= form.label :selective_sync_type, s_('Geo|Selective synchronization'), class: 'font-weight-bold' = form.label :selective_sync_type, s_('Geo|Selective synchronization'), class: 'font-weight-bold'
...@@ -69,3 +69,13 @@ ...@@ -69,3 +69,13 @@
= 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'
= form.number_field :minimum_reverification_interval, class: 'form-control col-sm-2', min: 1 = form.number_field :minimum_reverification_interval, class: 'form-control col-sm-2', min: 1
.form-text.text-muted= s_('Geo|Control the minimum interval in days that a repository should be reverified for this primary node') .form-text.text-muted= s_('Geo|Control the minimum interval in days that a repository should be reverified for this primary node')
.form-group.row.js-hide-if-geo-primary{ class: ('hidden' unless geo_node.secondary?) }
.col-sm-10
= form.label :sync_object_storage, _('Object Storage replication'), class: 'label-bold'
.form-check
= form.check_box :sync_object_storage, class: 'form-check-input'
= form.label :sync_object_storage, class: 'form-check-label' do
%span= s_('Geo|Allow GitLab to replicate content on Object Storage')
.form-text.text-muted= s_('Geo|If enabled, GitLab will perform Object Storage replication using Geo')
---
title: 'Geo: Make Object Storage synchronization in Geo Nodes configurable via Admin UI'
merge_request: 15000
author:
type: added
...@@ -9,10 +9,12 @@ FactoryBot.define do ...@@ -9,10 +9,12 @@ FactoryBot.define do
end end
primary false primary false
sync_object_storage true
trait :primary do trait :primary do
primary true primary true
minimum_reverification_interval 7 minimum_reverification_interval 7
sync_object_storage false
end end
end end
end end
...@@ -89,16 +89,48 @@ describe 'admin Geo Nodes', :js, :geo do ...@@ -89,16 +89,48 @@ describe 'admin Geo Nodes', :js, :geo do
end end
end end
it 'changes re-verification interval field visibility based on primary node checkbox' do it 'toggles the visibility of secondary only params based on primary node checkbox' do
expect(page).not_to have_field('Re-verification interval') primary_only_fields = [
'Internal URL (optional)',
'Re-verification interval'
]
secondary_only_fields = [
'Selective synchronization',
'Repository sync capacity',
'File sync capacity',
'Object Storage replication'
]
expect(page).to have_unchecked_field('This is a primary node')
primary_only_fields.each do |field|
expect(page).to have_field(field, visible: false)
end
secondary_only_fields.each do |field|
expect(page).to have_field(field)
end
check 'This is a primary node' check 'This is a primary node'
expect(page).to have_field('Re-verification interval') primary_only_fields.each do |field|
expect(page).to have_field(field)
end
secondary_only_fields.each do |field|
expect(page).to have_field(field, visible: false)
end
uncheck 'This is a primary node' uncheck 'This is a primary node'
expect(page).not_to have_field('Re-verification interval') primary_only_fields.each do |field|
expect(page).to have_field(field, visible: false)
end
secondary_only_fields.each do |field|
expect(page).to have_field(field)
end
end end
it 'returns an error message when a duplicate primary is added' do it 'returns an error message when a duplicate primary is added' do
......
...@@ -6814,6 +6814,9 @@ msgstr "" ...@@ -6814,6 +6814,9 @@ msgstr ""
msgid "Geo|All projects are being scheduled for re-verify" msgid "Geo|All projects are being scheduled for re-verify"
msgstr "" msgstr ""
msgid "Geo|Allow GitLab to replicate content on Object Storage"
msgstr ""
msgid "Geo|Batch operations" msgid "Geo|Batch operations"
msgstr "" msgstr ""
...@@ -6853,6 +6856,9 @@ msgstr "" ...@@ -6853,6 +6856,9 @@ msgstr ""
msgid "Geo|Groups to synchronize" msgid "Geo|Groups to synchronize"
msgstr "" msgstr ""
msgid "Geo|If enabled, GitLab will perform Object Storage replication using Geo"
msgstr ""
msgid "Geo|In sync" msgid "Geo|In sync"
msgstr "" msgstr ""
...@@ -10106,6 +10112,9 @@ msgstr "" ...@@ -10106,6 +10112,9 @@ msgstr ""
msgid "OK" msgid "OK"
msgstr "" msgstr ""
msgid "Object Storage replication"
msgstr ""
msgid "Object does not exist on the server or you don't have permissions to access it" msgid "Object does not exist on the server or you don't have permissions to access it"
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