# Cluster Metadata and Service Plan

## Why This Change Exists

Before TiDB-X support, Metrics Integration could rely on Dedicated-oriented cluster metadata from `core-svc`.
That was no longer sufficient once Premium, Essential, and Starter needed service-plan-aware behavior.

The control plane now has to understand:

- cluster family differences
- service plan differences
- partial metadata shapes for non-Dedicated clusters
- downstream config differences for pipeline deployment

## Main Change

The Global-side cluster lookup path moves from `core-svc` to `tidb-mgmt`.

This is the foundation for all later TiDB-X behavior because `tidb-mgmt` can provide the cluster information needed to:

- derive `ServicePlan`
- build correct target-cluster config
- choose the right datasource routing
- avoid Dedicated-only assumptions in pipeline materialization

## Functional Impact

### 1. Metadata Source of Truth

- old path: `core-svc`
- new path: `tidb-mgmt`

### 2. Service Plan Becomes Runtime Input

`ServicePlan` is no longer descriptive metadata only.
It directly affects:

- datasource bizType selection
- query matcher logic
- output label transform
- whether project and node concepts remain exposed

### 3. Backward Compatibility

Dedicated remains the compatibility baseline.
If service plan is missing or not recognized, routing falls back to Dedicated behavior rather than producing an empty or invalid path.

## What to Verify in Code Review

- Global reads cluster metadata from `tidb-mgmt`
- service-plan-aware config is rendered into pipeline deployment inputs
- old Dedicated pipelines still work
- no control-plane path still depends on Dedicated-only cluster shape assumptions

## Related Docs

- `06-tidb-mgmt-migration-design.md`
- `08-pipeline-update-design.md`
