Geo selective sync by repository shard

Description

Currently, ~Geo selective sync allows you to select a list of namespaces to replicate for a particular secondary. However, GitLab.com would like to be able to select a particular shard.

I think if it's useful for GitLab.com, it may well be useful to other large deployments. It seems a natural fit for gradual rollout, whereas selective sync by namespace is a more natural fit for more-or-less permanent organisational divisions.

Proposal

Add two new columns to the geo_nodes table:

  • selective_sync_type
    • namespace
    • shard
  • selective_sync_shards
    • serialized array like application_settings.repository_storages

Modify GeoNode#projects to take account of the two new columns

Add UI to allow the user to select between selective_sync_types on the geo node edit/new pages, add a shards dropdown to select multiple shards, and show that or the namespaces dropdown depending on the selected type.

Links / references

/cc @jramsay @jarv @stanhu

Edited by Nick Thomas