Reshard form: discover all destination shards and known external stores#921
Merged
Conversation
The form's shard dropdown was derived from duckling statuses — the shards tenants already OCCUPY — so a freshly created empty shard (mw-dev shard-002) never appeared, exactly the shard a rebalancing reshard wants to target. New GET /reshards/targets: cnpg shards discovered from the CNPG instance pods (label cnpg.io/cluster, cnpg-shards namespace) via the same cluster-topology read the Nodes view uses — includes EMPTY shards; an RBAC Forbidden (the e2e CP) degrades to the occupied-shard fallback with cluster_discovery=false so the form can say why a new shard needs manual entry. Plus known external stores: distinct external metadata stores of live warehouses (endpoint + SM secret NAME + user/db — never a password), offered as prefill for the cnpg->ext escape hatch. UI: shard dropdown fed by the endpoint (unioned with occupied shards as fallback), a degrade notice, and a known-external-stores prefill select; the password stays manual always.
Test Impact PlanDeterministic summary of how this PR changes tests, CI runners, and coverage-risk signals. Summary
Signals
Coverage risk: needs review Warnings
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The reshard form's shard dropdown was derived from duckling statuses — i.e. the shards tenants already occupy — so a freshly stood-up empty shard (mw-dev's new shard-002) never appeared, which is exactly the shard a rebalancing reshard wants to target.
New
GET /reshards/targetscnpg.io/clusterlabel,cnpg-shardsnamespace) via the same cluster-topology pod read the Nodes view already uses — includes empty shards, no new RBAC. An RBAC Forbidden (the e2e CP's SA) degrades to the occupied-shard fallback withcluster_discovery: false, so the UI can explain why a brand-new shard would need manual entry there.UI
Shard dropdown fed by the endpoint (unioned with occupied shards as a belt-and-suspenders fallback; free-text "other…" stays), a notice when discovery is degraded, and a "Known external stores" prefill select on the external target form. The password field remains manual, always.
Tests
admin/reshard_test.go: cluster discovery surfaces an empty shard + unions occupied ones; Forbidden and nil-client degrade paths; external stores present.tests/configstore/reshard_postgres_test.go:ListExternalMetadataStoresdistinct/live-only/field mapping.reshard_targetsassertion — occupied-shard fallback contains the cnpg org's shard, the ext org's RDS appears as a known external store, and the response never carries a password field. Verifies the degrade path for real (the e2e CP has no cluster RBAC).npm run build+ vitest green.On a real deployment (mw-dev/prod CPs have the cluster-topology ClusterRole) the dropdown now shows shard-002 the moment its pods exist — no tenant required.
🤖 Generated with Claude Code