Commit 65e23cf5 authored by Rajendra Kadam's avatar Rajendra Kadam Committed by Michael Kozono

Add and expose shards, namespace and reverification params in geo node to...

Add and expose shards, namespace and reverification params in geo node to update Geonode API and add specs
parent a7573838
---
title: Add selective sync support to Geo Nodes API update endpoint
merge_request: 22828
author: Rajendra Kadam
type: added
......@@ -84,6 +84,10 @@ Example response:
"repos_max_capacity": 25,
"container_repositories_max_capacity": 10,
"verification_max_capacity": 100,
"selective_sync_type": "namespaces",
"selective_sync_shards": [],
"selective_sync_namespace_ids": [1, 25],
"minimum_reverification_interval": 7,
"clone_protocol": "http",
"web_edit_url": "https://primary.example.com/admin/geo/nodes/1/edit",
"_links": {
......@@ -104,6 +108,10 @@ Example response:
"repos_max_capacity": 25,
"container_repositories_max_capacity": 10,
"verification_max_capacity": 100,
"selective_sync_type": "namespaces",
"selective_sync_shards": [],
"selective_sync_namespace_ids": [1, 25],
"minimum_reverification_interval": 7,
"sync_object_storage": true,
"clone_protocol": "http",
"web_edit_url": "https://primary.example.com/admin/geo/nodes/2/edit",
......@@ -142,6 +150,10 @@ Example response:
"repos_max_capacity": 25,
"container_repositories_max_capacity": 10,
"verification_max_capacity": 100,
"selective_sync_type": "namespaces",
"selective_sync_shards": [],
"selective_sync_namespace_ids": [1, 25],
"minimum_reverification_interval": 7,
"clone_protocol": "http",
"web_edit_url": "https://primary.example.com/admin/geo/nodes/1/edit",
"_links": {
......@@ -174,6 +186,10 @@ PUT /geo_nodes/:id
| `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. |
| `sync_object_storage` | boolean | no | Flag indicating if the secondary Geo node will replicate blobs in Object Storage. |
| `selective_sync_type` | string | no | Limit syncing to only specific groups or shards. Valid values: `"namespaces"`, `"shards"`, or `null`. |
| `selective_sync_shards` | array | no | The repository storage for the projects synced if `selective_sync_type` == `shards`. |
| `selective_sync_namespace_ids` | array | no | The IDs of groups that should be synced, if `selective_sync_type` == `namespaces`. |
| `minimum_reverification_interval` | integer | no | The interval (in days) in which the repository verification is valid. Once expired, it will be reverified. This has no effect when set on a secondary node. |
Example response:
......@@ -190,6 +206,10 @@ Example response:
"repos_max_capacity": 25,
"container_repositories_max_capacity": 10,
"verification_max_capacity": 100,
"selective_sync_type": "namespaces",
"selective_sync_shards": [],
"selective_sync_namespace_ids": [1, 25],
"minimum_reverification_interval": 7,
"sync_object_storage": true,
"clone_protocol": "http",
"web_edit_url": "https://primary.example.com/admin/geo/nodes/2/edit",
......
......@@ -179,6 +179,10 @@ module API
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'
optional :sync_object_storage, type: Boolean, desc: 'Flag indicating if the secondary Geo node will replicate blobs in Object Storage'
optional :selective_sync_type, type: String, desc: 'Limit syncing to only specific groups, or shards. Valid values: `"namespaces"`, `"shards"`, or `null`'
optional :selective_sync_shards, type: Array, desc: 'The repository storages whose projects should be synced, if `selective_sync_type` == `shards`'
optional :selective_sync_namespace_ids, as: :namespace_ids, type: Array, desc: 'The IDs of groups that should be synced, if `selective_sync_type` == `namespaces`'
optional :minimum_reverification_interval, type: Integer, desc: 'The interval (in days) in which the repository verification is valid. Once expired, it will be reverified. This has no effect when set on a secondary node.'
end
put do
not_found!('GeoNode') unless geo_node
......
......@@ -624,6 +624,10 @@ module EE
expose :repos_max_capacity
expose :verification_max_capacity
expose :container_repositories_max_capacity
expose :selective_sync_type
expose :selective_sync_shards
expose :namespace_ids, as: :selective_sync_namespace_ids
expose :minimum_reverification_interval
expose :sync_object_storage, if: ->(geo_node, _) { geo_node.secondary? }
# Retained for backwards compatibility. Remove in API v5
......
......@@ -11,6 +11,10 @@
"repos_max_capacity",
"verification_max_capacity",
"container_repositories_max_capacity",
"selective_sync_type",
"selective_sync_shards",
"selective_sync_namespace_ids",
"minimum_reverification_interval",
"clone_protocol",
"web_edit_url",
"_links"
......@@ -27,6 +31,20 @@
"repos_max_capacity": { "type": "integer" },
"verification_max_capacity": { "type": "integer" },
"container_repositories_max_capacity": { "type": "integer" },
"selective_sync_type": { "type": ["string", "null"] },
"selective_sync_shards": {
"type": ["array", "null"],
"items": {
"type": "string"
}
},
"selective_sync_namespace_ids": {
"type": ["array", "null"],
"items": {
"type": "integer"
}
},
"minimum_reverification_interval": { "type": "integer" },
"sync_object_storage" : { "type": "boolean" },
"clone_protocol": { "type": "string" },
"web_edit_url": { "type": "string" },
......
......@@ -13,6 +13,7 @@ describe API::GeoNodes, :geo, :prometheus, api: true do
set(:secondary_status) { create(:geo_node_status, :healthy, geo_node: secondary) }
let(:unexisting_node_id) { GeoNode.maximum(:id).to_i.succ }
let(:group_to_sync) { create(:group) }
set(:admin) { create(:admin) }
set(:user) { create(:user) }
......@@ -242,7 +243,11 @@ describe API::GeoNodes, :geo, :prometheus, api: true do
internal_url: 'https://internal-com.com/',
files_max_capacity: 33,
repos_max_capacity: 44,
verification_max_capacity: 55
verification_max_capacity: 55,
selective_sync_type: "shards",
selective_sync_shards: %w[shard1 shard2],
selective_sync_namespace_ids: [group_to_sync.id],
minimum_reverification_interval: 10
}.stringify_keys
put api("/geo_nodes/#{secondary.id}", admin), params: params
......
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