Prepare clusters_kubernetes_namespaces for sharding

What does this MR do and why?

Prepare clusters_kubernetes_namespaces for sharding:

  • add organization_id, group_id, and sharding_project_id columns
  • create a trigger that assigns the sharding keys from the associated cluster (copies organization_id, group_id, and project_id from the clusters table)
  • create indexes on each sharding key column (organization_id, group_id, sharding_project_id)
  • add foreign key constraints on organization_id (to organizations), group_id (to namespaces), and sharding_project_id (to projects)
  • add a multi-column not null constraint (not valid) ensuring exactly one sharding key is set
  • queue a batched background migration to backfill the sharding key columns from the associated cluster

Addresses #584433

Changelog: other

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Tomasz Skorupa

Merge request reports

Loading