Skip to content

feat(fs): support the Filesystem-only azure-centralus placement - #77

Closed
srstack wants to merge 1 commit into
tidbcloud:mainfrom
srstack:fix/fs-only-azure-centralus
Closed

srstack wants to merge 1 commit into
tidbcloud:mainfrom
srstack:fix/fs-only-azure-centralus

Conversation

@srstack

@srstack srstack commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Alternative to #76: keep azure-centralus a Filesystem-only placement instead of adding it to the shared placement table. The two changes conflict in internal/config/region; only one should merge.

Problem

ti fs --region azure-centralus ... fails local region validation even though the Azure Central US Filesystem deployment (https://azure-centralus.drive9.ai) is available.

region.supported is shared by Starter and Filesystem resolution, so only adding azure there also makes ti db accept the placement locally:

$ ti db create-db-cluster --db-cluster-type starter --db-cluster-name demo --region azure-centralus --dry-run
"region": { "name": "regions/azure-centralus" }   # EXIT=0, the request would be sent

README (Regions supporting TiDB Cloud Starter), docs/priciples.md, and the published regions page do not list Azure as a Starter placement, so that would send an unsupported region to the Starter API instead of failing locally.

Change

  • internal/config/region: add ProviderAzure and the azure-centralus placement plus a filesystemOnly marker. Validate (Starter) rejects marked placements with placement "azure-centralus" serves TiDB Cloud Filesystem only, not TiDB Cloud Starter; the new ValidateFilesystem accepts them. ParsePlacementCode and CanonicalCode keep accepting every known placement, so --region, ti configure, profiles, and stored credentials are unaffected.
  • internal/api/endpoints: Filesystem resolution uses ValidateFilesystem, and the built-in mapping gains azure-centralus -> https://azure-centralus.drive9.ai (mode=tidb_cloud_native).
  • Telemetry: the CLI normalizer and the backend validator accept the azure provider and the azure-centralus region code.
  • Docs and installers: README, docs/priciples.md, AGENTS.md, the telemetry backend design table, and the ti fs regions line of both installers.

Resulting behavior:

Command Result
ti fs ... --region azure-centralus routes to https://azure-centralus.drive9.ai (dry-run shows azure centralus)
ti db ... --region azure-centralus config.invalid_region, exit 2, Filesystem-only message, no request sent
ti configure --region-code azure-centralus accepted as a Filesystem placement

gcp-us-east1 intentionally keeps its current behavior here; applying the same Filesystem-only model to it is a separate decision, and the filesystemOnly marker makes that a one-line follow-up.

Verification

  • gofmt -l is clean on the changed files, and go mod tidy leaves go.mod/go.sum unchanged.
  • go test ./... passes.
  • TI_E2E_BIN=bin/ti go test ./e2e/ passes except the pre-existing TestTelemetryUsesFakeIngestionServer, which also fails on unmodified main in this environment (local telemetry ingestion fixture, unrelated to this change).
  • Binary probes:
    • ti --region azure-centralus fs create-file-system --dry-run -> "message": "azure centralus", /v1/admin/tenants, exit 0.
    • ti --region azure-centralus db create-db-cluster --db-cluster-type starter --db-cluster-name demo --dry-run -> ti [ERROR]: placement "azure-centralus" serves TiDB Cloud Filesystem only, not TiDB Cloud Starter, exit 2.
    • ti --region gcp-us-east1 db create-db-cluster ... --dry-run -> unchanged, still proceeds locally.
  • New coverage: placement validation, built-in endpoint routing, Starter rejection at the CLI and against the compiled binary, stored credentials under an AWS-default profile, token-only companion routing with inherited DRIVE9_* isolation, and telemetry acceptance on both sides.

Follow-ups (not in this PR)

  • The deployed ti-telemetry-backend must accept azure/azure-centralus before or with this CLI release. The column is an unconstrained VARCHAR(32), so no migration is needed.
  • The published English ti regions page (docs/pingcap-docs/docs, ai/ti/reference/ti-regions-security-and-limitations.md) lives in a separate docs repo/submodule and is not updated here. It currently lists neither GCP nor Azure.
  • The Azure Filesystem deployment itself was verified live in fix(fs): support Azure Central US with cloud routing regressions #76 (15/15 checks). This PR changes placement validation only, not the Filesystem transport.

`ti fs --region azure-centralus ...` failed local region validation even
though the Azure Central US Filesystem deployment is available. Add the
azure provider and its built-in Filesystem endpoint, and keep the Azure
placement out of TiDB Cloud Starter placement validation.

`region.supported` is shared by DB and Filesystem resolution, so adding
azure there would also let `ti db` commands accept `azure-centralus` and
send `regions/azure-centralus` to the Starter API, which the product
documentation does not list as a Starter placement. Instead, mark the
placement as Filesystem-only: `region.Validate` (Starter) rejects it with
an explicit error, while the new `region.ValidateFilesystem` accepts it
for Filesystem endpoint resolution. `ParsePlacementCode` and
`CanonicalCode` keep accepting every known placement so `--region`,
`ti configure`, and stored credentials still work.

- internal/config/region: add `ProviderAzure`, the azure-centralus
  placement, and the `filesystemOnly` marker plus `ValidateFilesystem`.
- internal/api/endpoints: resolve Filesystem endpoints through
  `ValidateFilesystem` and add the built-in azure-centralus mapping
  (`https://azure-centralus.drive9.ai`).
- telemetry: accept the azure provider and azure-centralus region code in
  the CLI normalizer and the backend validator.
- README, docs/priciples.md, AGENTS.md, telemetry backend design, and both
  installers document the new Filesystem region and the Filesystem-only
  rule.
- Regression coverage: placement validation, built-in endpoint routing,
  Starter rejection at the CLI and binary boundary, stored credentials
  under an AWS-default profile, token-only companion routing, and
  telemetry acceptance.

`gcp-us-east1` keeps its current behavior in this change; aligning it with
the same Filesystem-only model is a separate decision.
Copilot AI balanced review requested due to automatic review settings October 15, 2026 11:25
@pingcap-cla-assistant

pingcap-cla-assistant Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

It alters core placement-validation semantics shared by ti db and ti fs and is an explicitly conflicting alternative to #76 where only one approach should merge, which is a human design decision.

0 open findings

What changed in this PR

This PR adds azure-centralus as a Filesystem-only placement. It is explicitly an alternative to #76: rather than adding Azure to the shared placement table (which would also make ti db accept it and send an unsupported region to the Starter API), it introduces a filesystemOnly marker so that ti fs accepts the placement while ti db rejects it locally with an explicit message. The change fits cleanly into the centralized internal/config/region placement model and the built-in Filesystem endpoint mapping, and it is threaded through telemetry (CLI + backend), docs, and installers.

Changes:

  • Split region validation into Validate (Starter, rejects filesystem-only placements) and ValidateFilesystem (accepts them), with ParsePlacementCode/CanonicalCode now using a shared validatePlacement so --region, ti configure, profiles, and stored credentials accept every known placement.
  • Routed ResolveFS through ValidateFilesystem and registered azure-centralus → https://azure-centralus.drive9.ai in the built-in FS region manifest.
  • Accepted the azure provider and azure-centralus region in both the CLI telemetry normalizer and the backend validator, and updated README, docs/priciples.md, AGENTS.md, the telemetry design doc, and both installers.
File Description
internal/​config/​region/​region.go Adds Azure provider/prefix, filesystemOnly marker, and the Validate/ValidateFilesystem/validatePlacement split.
internal/​config/​region/​region_test.go Covers filesystem-only acceptance for FS, Starter rejection, and placement parsing/canonical round-trips.
internal/​api/​endpoints/​endpoints.go FS resolution uses ValidateFilesystem; built-in manifest gains the Azure Central US endpoint.
internal/​api/​endpoints/​endpoints_test.go Verifies Azure FS routing and Starter rejection of the filesystem-only placement.
internal/​telemetry/​telemetry.go Normalizer accepts the azure provider.
internal/​telemetry/​telemetry_test.go Asserts Azure placement is preserved end-to-end.
internal/​telemetrybackend/​event.go Backend validator allows azure provider and azure-centralus region.
internal/​telemetrybackend/​event_test.go Parameterizes GCP/Azure acceptance; moves azure out of the rejected cases.
internal/​fs/​fscred/​credential_test.go Confirms a filesystem-only region is stored/resolved without mutating profile placement.
internal/​cli/​root_test.go CLI-level Starter rejection and FS dry-run acceptance for azure-centralus.
e2e/​cli_test.go Compiled-binary routing to the Azure FS endpoint plus Starter rejection.
e2e/​installer_test.go Installer region-listing assertions include azure-centralus.
README.md, docs/​priciples.md, AGENTS.md, docs/​telemetry-backend-design.md Document the new Filesystem-only placement and provider mapping.
scripts/​install.sh, scripts/​install.ps1 Add azure-centralus to the printed ti fs regions list.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@srstack

srstack commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by commit 4b7faa3 on the #76 branch (codex/azure-region-support), which now keeps azure-centralus a Filesystem-only placement. Closing this alternative so there is a single PR for the change.

@srstack srstack closed this Oct 15, 2026
@srstack
srstack deleted the fix/fs-only-azure-centralus branch October 15, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants